本文整理匯總了Java中android.service.quicksettings.Tile.STATE_ACTIVE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Tile.STATE_ACTIVE屬性的具體用法?Java Tile.STATE_ACTIVE怎麽用?Java Tile.STATE_ACTIVE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.service.quicksettings.Tile
的用法示例。
在下文中一共展示了Tile.STATE_ACTIVE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onClick
@Override
public void onClick() {
super.onClick();
if (Objects.equals(Settings.getString(Settings.Mode.SELECTION, Settings.Mode.NONE), Settings.Mode.NONE)) {
intentGuideActivity();
} else {
switch (tile.getState()) {
case Tile.STATE_ACTIVE:
setDisableTile();
setAction(ACTION_FLOAT_VIEW_SERVICE_STOP);
break;
case Tile.STATE_INACTIVE:
setEnableTile();
setAction(ACTION_FLOAT_VIEW_SERVICE_START);
break;
}
StatusBarUtils.collapseStatusBar(this);
}
tile.updateTile();
}
示例2: updateTileState
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();
}
}
示例3: onClick
@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;
}
}
示例4: onClick
@Override
public void onClick() {
int state = getQsTile().getState();
if (state == Tile.STATE_ACTIVE) {
getQsTile().setState(Tile.STATE_INACTIVE);
FeatureHelper.writeSimulateColorSpace(this,
FeatureHelper.ACCESSIBILITY_DISPLAY_DALTONIZER_DISABLE);
} else {
getQsTile().setState(Tile.STATE_ACTIVE);
FeatureHelper.writeSimulateColorSpace(this,
FeatureHelper.ACCESSIBILITY_DISPLAY_DALTONIZER_MONOCHROMACY);
}
getQsTile().updateTile();
}
示例5: onClick
@Override
public void onClick() {
Tile tile = getQsTile();
App utils = (App) getApplicationContext();
if (tile.getState() == Tile.STATE_ACTIVE) {
if (utils.StartShowWin) {
tile.setState(Tile.STATE_INACTIVE);
FloatManageMethod.ShutDown(this);
} else {
tile.setState(Tile.STATE_INACTIVE);
}
} else if (tile.getState() == Tile.STATE_INACTIVE) {
if (utils.StartShowWin) {
tile.setState(Tile.STATE_ACTIVE);
} else {
if (QuickStartMethod.Launch(this)) {
tile.setState(Tile.STATE_ACTIVE);
}
}
}
tile.updateTile();
super.onClick();
}
示例6: onClick
@Override
public void onClick() {
super.onClick();
Log("Clicked");
initPrefs();
Tile tile = getQsTile();
if (tile != null) {
switch (tile.getState()) {
case Tile.STATE_ACTIVE:
prefs.setBool(Prefs.KEYS.ENABLED.toString(), false);
setCurrentState(Tile.STATE_INACTIVE);
break;
case Tile.STATE_INACTIVE:
prefs.setBool(Prefs.KEYS.ENABLED.toString(), true);
setCurrentState(Tile.STATE_ACTIVE);
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;
}
} else {
Log("Tile is null");
}
}
示例7: setCurrentState
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();
}
}
示例8: updateTileState
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();
}
}
示例9: onClick
@Override
public void onClick() {
super.onClick();
Log.d(TAG, "onClick");
Tile tile = getQsTile();
if (tile != null) {
if (tile.getState() == Tile.STATE_ACTIVE) {
tile.setLabel("QuickStart");
tile.setState(Tile.STATE_INACTIVE);
} else {
tile.setLabel("Running...");
tile.setState(Tile.STATE_ACTIVE);
}
tile.updateTile();
}
}
示例10: onClick
@Override
public void onClick(){
Log.d(TAG, "Tile service onClick method called");
super.onClick();
Tile tile = getQsTile();
if (tile == null) return;
int status = tile.getState();
Log.d(TAG, "status:" + status + "\t receive");
switch (status) {
case Tile.STATE_INACTIVE:
ActionReceiver.sendActionStart(this);
updateActiveTile(tile);
break;
case Tile.STATE_ACTIVE:
ActionReceiver.sendActionStop(this);
updateInactiveTile(tile);
break;
}
}
示例11: onClick
@Override
public void onClick() {
super.onClick();
if (!Utils.isDumpPermissionGranted() || !Utils.isWriteSecureSettingsPermissionGranted()) {
Intent mainActivity = new Intent(getApplicationContext(), MainActivity.class);
mainActivity.setAction(Utils.MISSING_PERMISSION);
mainActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(mainActivity);
} else {
if (getQsTile().getState() == Tile.STATE_ACTIVE) {
getQsTile().setState(Tile.STATE_INACTIVE);
getQsTile().setIcon(Icon.createWithResource(getApplicationContext(), R.drawable.ic_off));
getQsTile().updateTile();
Utils.disableDemoMode();
} else {
getQsTile().setState(Tile.STATE_ACTIVE);
getQsTile().setIcon(Icon.createWithResource(getApplicationContext(), R.drawable.ic_on));
getQsTile().updateTile();
Utils.enableDemoMode();
}
}
}
示例12: onClick
@Override
public void onClick() {
super.onClick();
boolean enableScreenLockSwitch = PreferenceManager.getDefaultSharedPreferences(StandardUtils.getApplication()).getBoolean("pref_key_screen_lock_switch", false);
if (getQsTile().getState() == Tile.STATE_ACTIVE) {
if (enableScreenLockSwitch) {
stopWadbRunnable.run();
} else {
unlockAndRun(stopWadbRunnable);
}
} else {
if (enableScreenLockSwitch) {
startWadbRunnable.run();
} else {
unlockAndRun(startWadbRunnable);
}
}
}
示例13: onClick
@Override
public void onClick() {
super.onClick();
if (getQsTile().getState() == Tile.STATE_ACTIVE) {
getApplicationContext().sendBroadcast(new Intent(FTPService.ACTION_STOP_FTPSERVER));
} else {
if (FTPService.isConnectedToWifi(getApplicationContext())
|| FTPService.isConnectedToLocalNetwork(getApplicationContext())
|| FTPService.isEnabledWifiHotspot(getApplicationContext())) {
Intent i = new Intent(FTPService.ACTION_START_FTPSERVER);
i.putExtra(FTPService.TAG_STARTED_BY_TILE, true);
getApplicationContext().sendBroadcast(i);
} else {
Toast.makeText(getApplicationContext(), getString(R.string.ftp_no_wifi), Toast.LENGTH_LONG).show();
}
}
}
示例14: onClick
@Override
public void onClick() {
if(tile.getState() == Tile.STATE_INACTIVE){
enablePocketMode(c, true);
tile.setState(Tile.STATE_ACTIVE);
}
else if(tile.getState() == Tile.STATE_ACTIVE){
enablePocketMode(c, false);
tile.setState(Tile.STATE_INACTIVE);
}
tile.updateTile();
}
示例15: onClick
@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();
}