Search in sources :

Example 6 with Tile

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));
}
Also used : IntentFilter(android.content.IntentFilter) HandlerThread(android.os.HandlerThread) UserHandle(android.os.UserHandle) Handler(android.os.Handler) Tile(android.service.quicksettings.Tile) ComponentName(android.content.ComponentName) Intent(android.content.Intent)

Example 7 with Tile

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();
}
Also used : Tile(android.service.quicksettings.Tile)

Example 8 with Tile

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));
}
Also used : IntentFilter(android.content.IntentFilter) HandlerThread(android.os.HandlerThread) UserHandle(android.os.UserHandle) Handler(android.os.Handler) Tile(android.service.quicksettings.Tile) ComponentName(android.content.ComponentName) Intent(android.content.Intent)

Example 9 with Tile

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();
                    }
                }
            }
        });
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Tile(android.service.quicksettings.Tile) Intent(android.content.Intent) ComponentName(android.content.ComponentName)

Example 10 with Tile

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();
}
Also used : Tile(android.service.quicksettings.Tile)

Aggregations

Tile (android.service.quicksettings.Tile)26 ComponentName (android.content.ComponentName)13 Intent (android.content.Intent)13 Handler (android.os.Handler)12 UserHandle (android.os.UserHandle)12 PendingIntent (android.app.PendingIntent)7 QSTile (com.android.systemui.qs.QSTile)7 CustomTile (com.android.systemui.qs.external.CustomTile)7 TileLifecycleManager (com.android.systemui.qs.external.TileLifecycleManager)7 AirplaneModeTile (com.android.systemui.qs.tiles.AirplaneModeTile)7 BatteryTile (com.android.systemui.qs.tiles.BatteryTile)7 BluetoothTile (com.android.systemui.qs.tiles.BluetoothTile)7 CastTile (com.android.systemui.qs.tiles.CastTile)7 CellularTile (com.android.systemui.qs.tiles.CellularTile)7 ColorInversionTile (com.android.systemui.qs.tiles.ColorInversionTile)7 DataSaverTile (com.android.systemui.qs.tiles.DataSaverTile)7 DndTile (com.android.systemui.qs.tiles.DndTile)7 FlashlightTile (com.android.systemui.qs.tiles.FlashlightTile)7 HotspotTile (com.android.systemui.qs.tiles.HotspotTile)7 IntentTile (com.android.systemui.qs.tiles.IntentTile)7