Java Code Examples for android.service.quicksettings.Tile#setState()
The following examples show how to use
android.service.quicksettings.Tile#setState() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServerService.java From FireFiles with Apache License 2.0 | 6 votes |
private void updateTileState(int state) { Tile tile = getQsTile(); if (tile != null) { tile.setState(state); Icon icon = tile.getIcon(); switch (state) { case Tile.STATE_ACTIVE: icon.setTint(Color.WHITE); break; case Tile.STATE_INACTIVE: case Tile.STATE_UNAVAILABLE: default: icon.setTint(Color.GRAY); break; } tile.updateTile(); } }
Example 2
Source File: QuickSettingsToggle.java From always-on-amoled with GNU General Public License v3.0 | 6 votes |
private void setCurrentState(int state) { initPrefs(); Tile tile = getQsTile(); if (tile != null) { tile.setState(state); switch (state) { case Tile.STATE_ACTIVE: tile.setLabel(getString(R.string.quick_settings_title) + " " + getString(R.string.quick_settings_service_active)); Log("Active"); break; case Tile.STATE_INACTIVE: tile.setLabel(getString(R.string.quick_settings_title) + " " + getString(R.string.quick_settings_service_inactive)); Log("Inactive"); break; default: tile.setLabel(getString(R.string.quick_settings_title) + " " + (prefs.enabled ? getString(R.string.quick_settings_service_active) : getString(R.string.quick_settings_service_inactive))); Log("Active"); break; } tile.updateTile(); } }
Example 3
Source File: QuickSettingsTapService.java From ui with Apache License 2.0 | 6 votes |
@Override public void onStartListening() { Log.d(TAG, "onStartListening"); boolean working = getServiceStatus(); Tile tile = getQsTile(); if (working) { //turn on the tile here. tile.setIcon(Icon.createWithResource(this, R.drawable.cooltile_on)); tile.setLabel("Cool tile"); tile.setContentDescription("cool tile is On"); tile.setState(Tile.STATE_ACTIVE); } else { //turn on the tile here. tile.setIcon(Icon.createWithResource(this, R.drawable.cooltile_off)); tile.setLabel("Cool tile"); tile.setContentDescription("cool tile is Off"); tile.setState(Tile.STATE_INACTIVE); } tile.updateTile(); }
Example 4
Source File: QuickSettingsTileService.java From Taskbar with Apache License 2.0 | 6 votes |
private void updateState() { Tile tile = getQsTile(); if(tile != null) { SharedPreferences pref = U.getSharedPreferences(this); tile.setIcon(Icon.createWithResource(this, pref.getString(PREF_START_BUTTON_IMAGE, U.getDefaultStartButtonImage(this)).equals("app_logo") ? R.drawable.tb_system : R.drawable.tb_allapps)); if(U.canDrawOverlays(this)) tile.setState(U.isServiceRunning(this, NotificationService.class) ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE); else tile.setState(Tile.STATE_UNAVAILABLE); tile.updateTile(); } }
Example 5
Source File: TileService.java From GeometricWeather with GNU Lesser General Public License v3.0 | 6 votes |
private static void refreshTile(Context context, Tile tile) { if (tile == null) { return; } Location location = DatabaseHelper.getInstance(context).readLocationList().get(0); Weather weather = DatabaseHelper.getInstance(context).readWeather(location); if (weather != null) { tile.setIcon( ResourceHelper.getMinimalIcon( ResourcesProviderFactory.getNewInstance(), weather.getCurrent().getWeatherCode(), TimeManager.getInstance(context).isDayTime() ) ); tile.setLabel( weather.getCurrent().getTemperature().getTemperature( context, SettingsOptionManager.getInstance(context).getTemperatureUnit()) ); tile.setState(Tile.STATE_INACTIVE); tile.updateTile(); } }
Example 6
Source File: FakeOperatorTile.java From LocationReportEnabler with GNU General Public License v3.0 | 6 votes |
private void updateTile() { TelephonyManager manager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); String code = manager.getSimOperator(); String country = manager.getSimCountryIso(); SharedPreferences preferences = PropUtil.getProtecredSharedPreferences(this); Tile tile = getQsTile(); tile.setLabel(String.format("%s %s", code, country)); if (preferences.getBoolean(PropUtil.PREFERENCE_ENABLED, PropUtil.PREFERENCE_ENABLED_DEFAULT)) { tile.setState(Tile.STATE_ACTIVE); } else { tile.setState(Tile.STATE_INACTIVE); } tile.updateTile(); }
Example 7
Source File: WadbTileService.java From WADB with Apache License 2.0 | 5 votes |
private void showStateOff() { Log.d(TAG, "showStateOff"); final Tile tile = getQsTile(); if (tile.getState() == Tile.STATE_INACTIVE) { return; } final Context context = this; tile.setState(Tile.STATE_INACTIVE); tile.setIcon(Icon.createWithResource(context, R.drawable.ic_qs_network_adb_off)); tile.setLabel(context.getString(R.string.app_name)); tile.updateTile(); }
Example 8
Source File: ServiceTileGraph.java From NetGuard with GNU General Public License v3.0 | 5 votes |
private void update() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean stats = prefs.getBoolean("show_stats", false); Tile tile = getQsTile(); if (tile != null) { tile.setState(stats ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE); tile.setIcon(Icon.createWithResource(this, stats ? R.drawable.ic_equalizer_white_24dp : R.drawable.ic_equalizer_white_24dp_60)); tile.updateTile(); } }
Example 9
Source File: MaskTileService.java From Blackbulb with GNU General Public License v3.0 | 5 votes |
private void updateInactiveTile(Tile tile) { Icon inActiveIcon = Icon .createWithResource(getApplicationContext(), R.drawable.ic_qs_night_mode_off); tile.setIcon(inActiveIcon); tile.setState(Tile.STATE_INACTIVE); tile.updateTile(); }
Example 10
Source File: DaedalusTileService.java From Daedalus with GNU General Public License v3.0 | 5 votes |
@Override public void onClick() { Tile tile = getQsTile(); tile.setLabel(getString(R.string.quick_toggle)); tile.setContentDescription(getString(R.string.app_name)); tile.setState(Daedalus.switchService() ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE); tile.updateTile(); }
Example 11
Source File: QSDialogService.java From android-n-quick-settings with Apache License 2.0 | 5 votes |
private void updateTile() { Tile tile = super.getQsTile(); int activeState = isTileActive ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; tile.setState(activeState); tile.updateTile(); }
Example 12
Source File: NightModeTileService.java From SystemUITuner2 with MIT License | 5 votes |
@Override public void onClick() { Tile nightMode = getQsTile(); int state; try { state = nightMode.getState(); if (state == Tile.STATE_ACTIVE) { if (Build.VERSION.SDK_INT == 24) { Settings.Secure.putInt(getContentResolver(), "twilight_mode", 0); } else { Settings.Secure.putInt(getContentResolver(), NIGHT_DISPLAY_ACTIVATED, 0); } nightMode.setState(Tile.STATE_INACTIVE); } else { if (Build.VERSION.SDK_INT == 24) { Settings.Secure.putInt(getContentResolver(), "twilight_mode", 1); } else { Settings.Secure.putInt(getContentResolver(), NIGHT_DISPLAY_ACTIVATED, 1); } nightMode.setState(Tile.STATE_ACTIVE); } mToggleIntent.putExtra("state", state == Tile.STATE_INACTIVE); sendBroadcast(mToggleIntent); } catch (Exception e) { e.printStackTrace(); } nightMode.updateTile(); }
Example 13
Source File: QuickStartTileService.java From Virtual-Hosts with GNU General Public License v3.0 | 5 votes |
@Override public void onStartListening () { Tile tile = getQsTile(); if (tile==null)return; if(VhostsService.isRunning()){ tile.setState(Tile.STATE_ACTIVE); }else{ tile.setState(Tile.STATE_INACTIVE); } tile.updateTile(); }
Example 14
Source File: DaedalusTileService.java From Daedalus with GNU General Public License v3.0 | 5 votes |
private void updateTile() { boolean activate = DaedalusVpnService.isActivated(); Tile tile = getQsTile(); tile.setLabel(getString(R.string.quick_toggle)); tile.setContentDescription(getString(R.string.app_name)); tile.setState(activate ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE); tile.updateTile(); }
Example 15
Source File: MainTileEntry.java From rebootmenu with GNU General Public License v3.0 | 5 votes |
@Override public void onStartListening() { boolean isLocked = isLocked(); Tile tile = getQsTile(); if (tile == null) return; int qsTileState = tile.getState(); new DebugLog("MainTileEntry.onStartListening: isLocked=" + isLocked + " qsTileState=" + qsTileState, DebugLog.LogLevel.I); if (!isLocked && qsTileState != Tile.STATE_ACTIVE) { tile.setState(Tile.STATE_ACTIVE); tile.updateTile(); } }
Example 16
Source File: QuickRecordTile.java From screenrecorder with GNU Affero General Public License v3.0 | 5 votes |
private void changeTileState() { Tile tile = super.getQsTile(); int activeState = isTileActive ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; if (!isTileActive) tile.setLabel(getString(R.string.quick_settings_tile_start_title)); else tile.setLabel(getString(R.string.quick_settings_tile_stop_title)); tile.setState(activeState); tile.updateTile(); }
Example 17
Source File: ServiceTileFilter.java From NetGuard with GNU General Public License v3.0 | 5 votes |
private void update() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean filter = prefs.getBoolean("filter", false); Tile tile = getQsTile(); if (tile != null) { tile.setState(filter ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE); tile.setIcon(Icon.createWithResource(this, filter ? R.drawable.ic_filter_list_white_24dp : R.drawable.ic_filter_list_white_24dp_60)); tile.updateTile(); } }
Example 18
Source File: WadbTileService.java From WADB with Apache License 2.0 | 4 votes |
private void showStateUnavailable() { Tile tile = getQsTile(); tile.setState(Tile.STATE_UNAVAILABLE); tile.updateTile(); }
Example 19
Source File: ProfileTile.java From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 | 4 votes |
private void updateTile() { Tile tile = this.getQsTile(); boolean isActive = getServiceStatus(); Icon newIcon; String newLabel; int newState; // Update tile and set profile if (!Spectrum.supported(getApplicationContext())){ newLabel = "No Spectrum support"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_logo); newState = Tile.STATE_INACTIVE; }else { if (isActive && click) { newLabel = "Spectrum Gaming"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_game); newState = Tile.STATE_ACTIVE; click = false; Spectrum.setProfile(3, getApplicationContext()); } else if (!isActive && click) { newLabel = "Spectrum Battery"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_battery); newState = Tile.STATE_ACTIVE; click = true; Spectrum.setProfile(2, getApplicationContext()); } else if (isActive && !click) { newLabel = "Spectrum Performance"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_performance); newState = Tile.STATE_ACTIVE; click = true; Spectrum.setProfile(1, getApplicationContext()); } else { newLabel = "Spectrum Balance"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_balanced); newState = Tile.STATE_ACTIVE; click = false; Spectrum.setProfile(0, getApplicationContext()); } } // Change the UI of the tile. tile.setLabel(newLabel); tile.setIcon(newIcon); tile.setState(newState); tile.updateTile(); }
Example 20
Source File: ProfileTile.java From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 | 4 votes |
private void resetTileStatus() { int profile = Spectrum.getProfile(getApplicationContext()); Tile tile = this.getQsTile(); Icon newIcon; String newLabel; int newState; // Update tile if (!Spectrum.supported(getApplicationContext())){ newLabel = "No Spectrum support"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_logo); newState = Tile.STATE_INACTIVE; }else { if (profile == 3) { newLabel = "Spectrum Gaming"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_game); newState = Tile.STATE_ACTIVE; click = false; } else if (profile == 2) { newLabel = "Spectrum Battery"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_battery); newState = Tile.STATE_ACTIVE; click = true; } else if (profile == 1) { newLabel = "Spectrum Performance"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_performance); newState = Tile.STATE_ACTIVE; click = true; } else if (profile == 0) { newLabel = "Spectrum Balance"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_balanced); newState = Tile.STATE_ACTIVE; click = false; } else { newLabel = "Spectrum Custom"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_tile_logo); newState = Tile.STATE_ACTIVE; click = false; } } // Change the UI of the tile. tile.setLabel(newLabel); tile.setIcon(newIcon); tile.setState(newState); tile.updateTile(); }