當前位置: 首頁>>代碼示例>>Java>>正文


Java Tile.STATE_UNAVAILABLE屬性代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:18,代碼來源:ServerService.java

示例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();
	}
}
 
開發者ID:genonbeta,項目名稱:TrebleShot,代碼行數:22,代碼來源:CommunicationToggleTile.java

示例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;
    }
}
 
開發者ID:kz,項目名稱:immersify,代碼行數:35,代碼來源:ImmersifyTileService.java

示例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;
        }
    }
}
 
開發者ID:faizmalkani,項目名稱:KeylineTileSample,代碼行數:38,代碼來源:KeylineTileService.java


注:本文中的android.service.quicksettings.Tile.STATE_UNAVAILABLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。