本文整理匯總了Java中android.service.quicksettings.Tile.STATE_UNAVAILABLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Tile.STATE_UNAVAILABLE屬性的具體用法?Java Tile.STATE_UNAVAILABLE怎麽用?Java Tile.STATE_UNAVAILABLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.service.quicksettings.Tile
的用法示例。
在下文中一共展示了Tile.STATE_UNAVAILABLE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
}
示例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();
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;
}
}
示例4: 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;
}
}
}