use of android.service.quicksettings.Tile in project android_frameworks_base by ResurrectionRemix.
the class TileLifecycleManagerTests method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mThread = new HandlerThread("TestThread");
mThread.start();
mHandler = new Handler(mThread.getLooper());
ComponentName component = new ComponentName(mContext, FakeTileService.class);
mStateManager = new TileLifecycleManager(mHandler, getContext(), Mockito.mock(IQSService.class), new Tile(), new Intent().setComponent(component), new UserHandle(UserHandle.myUserId()));
mCallbacks.clear();
getContext().registerReceiver(mReceiver, new IntentFilter(TILE_UPDATE_BROADCAST));
}
use of android.service.quicksettings.Tile in project android_frameworks_base by DirtyUnicorns.
the class NekoTile method updateState.
private void updateState() {
Tile tile = getQsTile();
int foodState = mPrefs.getFoodState();
Food food = new Food(foodState);
if (foodState != 0) {
NekoService.registerJobIfNeeded(this, food.getInterval(this));
}
tile.setIcon(food.getIcon(this));
tile.setLabel(food.getName(this));
tile.setState(foodState != 0 ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.updateTile();
}
use of android.service.quicksettings.Tile in project android_frameworks_base by DirtyUnicorns.
the class TileLifecycleManagerTests method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mThread = new HandlerThread("TestThread");
mThread.start();
mHandler = new Handler(mThread.getLooper());
ComponentName component = new ComponentName(mContext, FakeTileService.class);
mStateManager = new TileLifecycleManager(mHandler, getContext(), Mockito.mock(IQSService.class), new Tile(), new Intent().setComponent(component), new UserHandle(UserHandle.myUserId()));
mCallbacks.clear();
getContext().registerReceiver(mReceiver, new IntentFilter(TILE_UPDATE_BROADCAST));
}
use of android.service.quicksettings.Tile in project muzei by romannurik.
the class NextArtworkTileService method onClick.
@Override
public void onClick() {
Tile tile = getQsTile();
if (tile == null) {
// ignore late arriving clicks
return;
}
if (tile.getState() == Tile.STATE_ACTIVE) {
FirebaseAnalytics.getInstance(NextArtworkTileService.this).logEvent("tile_next_artwork_click", null);
// Active means we send the 'Next Artwork' command
SourceManager.sendAction(this, MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK);
} else {
// Inactive means we attempt to activate Muzei
unlockAndRun(new Runnable() {
@Override
public void run() {
FirebaseAnalytics.getInstance(NextArtworkTileService.this).logEvent("tile_next_artwork_activate", null);
try {
startActivityAndCollapse(new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER).putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(NextArtworkTileService.this, MuzeiWallpaperService.class)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
} catch (ActivityNotFoundException e) {
try {
startActivityAndCollapse(new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
} catch (ActivityNotFoundException e2) {
Toast.makeText(NextArtworkTileService.this, R.string.error_wallpaper_chooser, Toast.LENGTH_LONG).show();
}
}
}
});
}
}
use of android.service.quicksettings.Tile in project android_frameworks_base by crdroidandroid.
the class NekoTile method updateState.
private void updateState() {
Tile tile = getQsTile();
int foodState = mPrefs.getFoodState();
Food food = new Food(foodState);
if (foodState != 0) {
NekoService.registerJobIfNeeded(this, food.getInterval(this));
}
tile.setIcon(food.getIcon(this));
tile.setLabel(food.getName(this));
tile.setState(foodState != 0 ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.updateTile();
}
Aggregations