blob: 47a2c3528fa37c2793bad4b772fae456e01dfdeb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package it.niedermann.nextcloud.deck.ui.tiles;
import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import it.niedermann.nextcloud.deck.ui.pickstack.PickStackActivity;
@TargetApi(Build.VERSION_CODES.N)
public class EditCardTileService extends TileService {
@Override
public void onStartListening() {
Tile tile = getQsTile();
tile.setState(Tile.STATE_ACTIVE);
tile.updateTile();
}
@Override
public void onClick() {
Intent intent = new Intent(getApplicationContext(), PickStackActivity.class);
// ensure it won't open twice if already running
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
// ask to unlock the screen if locked, then start new note intent
unlockAndRun(() -> startActivityAndCollapse(intent));
}
}
|