本文整理匯總了Java中android.service.quicksettings.Tile.STATE_INACTIVE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Tile.STATE_INACTIVE屬性的具體用法?Java Tile.STATE_INACTIVE怎麽用?Java Tile.STATE_INACTIVE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.service.quicksettings.Tile
的用法示例。
在下文中一共展示了Tile.STATE_INACTIVE屬性的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() {
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();
}
示例5: 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");
}
}
示例6: 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();
}
}
示例7: 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();
}
}
示例8: 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;
}
}
示例9: 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();
}
示例10: updateTileUI
/**
* Updates the QSTile icon and label
* @param state - State of night light. True value means night light is on, and vice versa
*/
private void updateTileUI(boolean state) {
Tile tile = this.getQsTile();
if (tile == null) return;
Icon newIcon;
int newState;
String title;
// Change the tile to match the service status.
if (state) {
newIcon = Icon.createWithResource(getApplicationContext(), ic_lightbulb_outline);
newState = Tile.STATE_ACTIVE;
title = getString(R.string.on);
} else {
newIcon = Icon.createWithResource(getApplicationContext(), ic_lightbulb_outline_disabled);
newState = Tile.STATE_INACTIVE;
title = getString(R.string.off);
}
// Change the UI of the tile.
tile.setLabel(title);
tile.setIcon(newIcon);
tile.setState(newState);
// Need to call updateTile for the tile to pick up changes.
tile.updateTile();
}
示例11: onClick
@Override
public void onClick() {
super.onClick();
Tile tile = getQsTile();
if (!ImmersiveModeUtils.hasSecureSettingsPermission(this.getApplicationContext())) {
tile.setState(Tile.STATE_UNAVAILABLE);
tile.updateTile();
}
switch (tile.getState()) {
case Tile.STATE_UNAVAILABLE:
showToast("Unable to toggle immersive mode. Open ImmersiveModeUtils for more details.");
break;
case Tile.STATE_ACTIVE:
// Disable immersive mode
if (ImmersiveModeUtils.disableImmersiveMode(this.getApplicationContext())) {
tile.setState(Tile.STATE_INACTIVE);
tile.updateTile();
} else {
showToast("Unable to disable immersive mode due to unknown error.");
}
break;
case Tile.STATE_INACTIVE:
// Enable immersive mode
if (ImmersiveModeUtils.enableImmersiveMode(this.getApplicationContext())) {
tile.setState(Tile.STATE_ACTIVE);
tile.updateTile();
} else {
showToast("Unable to enable immersive mode due to unknown error.");
}
break;
}
}
示例12: updateTileState
private void updateTileState(boolean isTileActive) {
Tile tile = getQsTile();
if (tile == null) {
return;
}
int newState = isTileActive ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
tile.setState(newState);
tile.updateTile();
mIsTileActive = isTileActive;
}
示例13: updateView
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();
}
示例14: onClick
/**
* Called when the tile is clicked, regardless of its current state
*/
@Override
public void onClick()
{
super.onClick();
Tile tile = getQsTile();
switch (tile.getState())
{
case Tile.STATE_ACTIVE:
{
setTileState(Tile.STATE_INACTIVE, tile);
// Code to turn off something, in this case, the service that draws the grid overlay
// getApplicationContext().stopService(new Intent(this, KeylineGridService.class));
break;
}
case Tile.STATE_INACTIVE:
{
setTileState(Tile.STATE_ACTIVE, tile);
// Code to turn on something, in this case, the service that draws the grid overlay
// getApplicationContext().startService(new Intent(this, KeylineGridService.class));
break;
}
case Tile.STATE_UNAVAILABLE:
{
setTileState(Tile.STATE_UNAVAILABLE, tile);
// Code to handle cases in which the tile is unavailable
break;
}
}
}
示例15: updateTile
private void updateTile() {
Tile tile = this.getQsTile();
boolean isActive = this.getServiceStatus();
String newLabel;
Icon newIcon;
int newState;
if (isActive) {
newLabel = "MyQs is active.";
newIcon = Icon.createWithResource(getApplicationContext(),
android.R.drawable.ic_dialog_alert);
newState = Tile.STATE_ACTIVE;
//open result activity
Intent intent = new Intent(getApplicationContext(), ResultActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
} else {
newLabel = "MyQs is inactive.";
newIcon = Icon.createWithResource(getApplicationContext(),
R.mipmap.ic_tile_inactive);
newState = Tile.STATE_INACTIVE;
}
tile.setIcon(newIcon);
tile.setLabel(newLabel);
tile.setState(newState);
tile.updateTile();
}