Java Code Examples for android.service.quicksettings.Tile#STATE_ACTIVE
The following examples show how to use
android.service.quicksettings.Tile#STATE_ACTIVE .
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: WadbTileService.java From WADB with Apache License 2.0 | 6 votes |
@Override public void onClick() { super.onClick(); Log.d(TAG, "onClick"); boolean enableScreenLockSwitch = WadbApplication.getDefaultSharedPreferences().getBoolean(WadbPreferences.KEY_SCREEN_LOCK_SWITCH, false); if (getQsTile().getState() == Tile.STATE_ACTIVE) { if (enableScreenLockSwitch) { STOP_WADB.run(); } else { unlockAndRun(STOP_WADB); } } else { if (enableScreenLockSwitch) { mStartWadbRunnable.run(); } else { unlockAndRun(mStartWadbRunnable); } } }
Example 2
Source File: QuickSettingService.java From zephyr with MIT License | 6 votes |
private void updateTile() { boolean isServiceRunning = preferenceManager.getBoolean(PreferenceKeys.PREF_IS_SOCKET_SERVICE_RUNNING, false); boolean isJoinCodeSet = isJoinCodeSet(); int tileState = isJoinCodeSet ? (isServiceRunning ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE) : Tile.STATE_UNAVAILABLE; logger.log(LogLevel.DEBUG, LOG_TAG, "updateTile - isServiceRunning: %b, isJoinCodeSet: %b, tileState: %d", isServiceRunning, isJoinCodeSet, tileState); Tile tile = getQsTile(); if (tile != null) { tile.setState(tileState); tile.updateTile(); } else { logger.log(LogLevel.WARNING, LOG_TAG, "Unable to update tile: null"); } }
Example 3
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 4
Source File: MyTileService.java From journaldev with MIT License | 6 votes |
@Override public void onClick() { super.onClick(); Tile tile = getQsTile(); boolean isActive = (tile.getState() == Tile.STATE_ACTIVE); if (isActive) { tile.setState(Tile.STATE_INACTIVE); startActivityAndCollapse(new Intent(this, MainActivity.class)); tile.setLabel("Disabled"); tile.setContentDescription("Test App"); tile.setIcon(Icon.createWithResource(this, android.R.drawable.ic_media_play)); } else { mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); int counter = mSharedPreferences.getInt("counter", 0); tile.setState(Tile.STATE_ACTIVE); tile.setIcon(Icon.createWithResource(this, android.R.drawable.ic_media_pause)); tile.setLabel("Count " + counter); } tile.updateTile(); }
Example 5
Source File: ServerService.java From FireFiles with Apache License 2.0 | 6 votes |
@Override public void onClick() { super.onClick(); Tile tile = getQsTile(); switch (tile.getState()) { case Tile.STATE_INACTIVE: startServer(); updateTileState(Tile.STATE_ACTIVE); break; case Tile.STATE_ACTIVE: stopServer(); default: updateTileState(Tile.STATE_INACTIVE); break; } }
Example 6
Source File: ServerService.java From FireFiles with Apache License 2.0 | 6 votes |
@Override public void onClick() { super.onClick(); Tile tile = getQsTile(); switch (tile.getState()) { case Tile.STATE_INACTIVE: startServer(); updateTileState(Tile.STATE_ACTIVE); break; case Tile.STATE_ACTIVE: stopServer(); default: updateTileState(Tile.STATE_INACTIVE); break; } }
Example 7
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 8
Source File: ToggleService.java From Greyscale with Apache License 2.0 | 6 votes |
@Override public void onClick() { super.onClick(); if (!Util.hasPermission(this)) { showDialog(Util.createTipsDialog(this)); return; } int oldState = getQsTile().getState(); if (oldState == Tile.STATE_ACTIVE) { setState(Tile.STATE_INACTIVE); } else { setState(Tile.STATE_ACTIVE); } Util.toggleGreyscale(this, oldState == Tile.STATE_INACTIVE); }
Example 9
Source File: MyTileService.java From journaldev with MIT License | 6 votes |
@Override public void onStartListening() { super.onStartListening(); Tile tile = getQsTile(); if (tile.getState() == Tile.STATE_ACTIVE) { mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); int counter = mSharedPreferences.getInt("counter", 0); mSharedPreferences.edit().putInt("counter", ++counter).apply(); tile.setLabel("Count " + counter); } tile.updateTile(); }
Example 10
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 11
Source File: QuickRecordTile.java From screenrecorder with GNU Affero General Public License v3.0 | 5 votes |
@Override public void onClick() { Tile tile = getQsTile(); isTileActive = !(tile.getState() == Tile.STATE_ACTIVE); changeTileState(); if (isTileActive) { startActivity(new Intent(this, MainActivity.class).setAction(getString(R.string.app_shortcut_action))); } else { startService(new Intent(this, RecorderService.class).setAction(Const.SCREEN_RECORDING_STOP)); } isTileActive = !isTileActive; }
Example 12
Source File: SpectrumTile.java From SmartPack-Kernel-Manager with GNU General Public License v3.0 | 5 votes |
private void resetTileStatus() { int profile = Utils.strToInt(Spectrum.getProfile()); Tile tile = this.getQsTile(); Icon newIcon; String newLabel; int newState; // Update tile if (!(Spectrum.supported())) { newLabel = "No Spectrum support"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_logo); newState = Tile.STATE_INACTIVE; }else { if (profile == 3) { newLabel = "Gaming"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_game); newState = Tile.STATE_ACTIVE; } else if (profile == 2) { newLabel = "Battery"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_battery); newState = Tile.STATE_ACTIVE; } else if (profile == 1) { newLabel = "Performance"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_performance); newState = Tile.STATE_ACTIVE; } else { newLabel = "Balance"; newIcon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spectrum_balanced); newState = Tile.STATE_ACTIVE; } } // Change the UI of the tile. tile.setLabel(newLabel); tile.setIcon(newIcon); tile.setState(newState); tile.updateTile(); }
Example 13
Source File: QuickService.java From LLApp with Apache License 2.0 | 5 votes |
@Override public void onStartListening() { super.onStartListening(); Log.d(TAG, "onStartListening"); Tile tile = getQsTile(); if (tile != null) { if (tile.getState() == Tile.STATE_ACTIVE) { tile.setLabel("Running..."); } else { tile.setLabel("QuickStart"); } tile.updateTile(); } }
Example 14
Source File: ProofModeTileService.java From proofmode with GNU General Public License v3.0 | 5 votes |
private void updateTile() { if (Tile.STATE_ACTIVE == getQsTile().getState()) { changeTileState(Tile.STATE_INACTIVE); mPrefs.edit().putBoolean("doProof",false).commit(); } else if (Tile.STATE_INACTIVE == getQsTile().getState()) { changeTileState(Tile.STATE_ACTIVE); mPrefs.edit().putBoolean("doProof",true).commit(); } }
Example 15
Source File: QuickSettingService.java From KeyBlocker with GNU General Public License v3.0 | 5 votes |
private void updateView(boolean displayToast, boolean init) { Tile tile = getQsTile(); if (BaseMethod.isAccessibilitySettingsOn(this)) { boolean KeyBlocked = PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Config.ENABLED_KEYBLOCK, false); if (init) { if (KeyBlocked) { tile.setState(Tile.STATE_ACTIVE); tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_blocked)); } else { tile.setState(Tile.STATE_INACTIVE); tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_not_blocked)); } } else { if (tile.getState() == Tile.STATE_ACTIVE) { tile.setState(Tile.STATE_INACTIVE); tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_not_blocked)); } else if (tile.getState() == Tile.STATE_INACTIVE) { tile.setState(Tile.STATE_ACTIVE); tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_blocked)); } } } else { tile.setState(Tile.STATE_INACTIVE); tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_not_blocked)); if (displayToast) { BaseMethod.RunAccessibilityService(this); } } tile.updateTile(); }
Example 16
Source File: QSIntentService.java From android-n-quick-settings with Apache License 2.0 | 5 votes |
@Override public void onClick() { // Check to see if the device is currently locked. boolean isCurrentlyLocked = this.isLocked(); if (!isCurrentlyLocked) { Resources resources = getApplication().getResources(); Tile tile = getQsTile(); String tileLabel = tile.getLabel().toString(); String tileState = (tile.getState() == Tile.STATE_ACTIVE) ? resources.getString(R.string.service_active) : resources.getString(R.string.service_inactive); Intent intent = new Intent(getApplicationContext(), ResultActivity.class); intent.putExtra(ResultActivity.RESULT_ACTIVITY_NAME_KEY, tileLabel); intent.putExtra(ResultActivity.RESULT_ACTIVITY_INFO_KEY, tileState); startActivityAndCollapse(intent); } }
Example 17
Source File: HyperionGrabberTileService.java From hyperion-android-grabber with MIT License | 5 votes |
@Override public void onClick() { Tile tile = getQsTile(); tile.updateTile(); int tileState = tile.getState(); if (tileState == Tile.STATE_ACTIVE) { Intent intent = new Intent(this, HyperionScreenService.class); intent.setAction(HyperionScreenService.ACTION_EXIT); startService(intent); } else { Runnable runner = () -> { boolean setupStarted = startSetupIfNeeded(); if (!setupStarted){ final Intent i = new Intent(this, BootActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION |Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS |Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(i); } }; if (isLocked()) { unlockAndRun(runner); } else { runner.run(); } } }
Example 18
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 19
Source File: QuickSettingsTileService.java From screen-dimmer-pixel-filter with BSD 3-Clause "New" or "Revised" License | 4 votes |
private int getServiceState() { return FilterService.running ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; }
Example 20
Source File: QuickSettingsToggle.java From always-on-amoled with GNU General Public License v3.0 | 4 votes |
private int getState() { initPrefs(); return prefs.enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; }