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


Java Tile.STATE_INACTIVE屬性代碼示例

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

示例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;
    }
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:17,代碼來源:ServerService.java

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

示例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");
    }
}
 
開發者ID:rosenpin,項目名稱:AlwaysOnDisplayAmoled,代碼行數:25,代碼來源:QuickSettingsToggle.java

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

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

示例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;
    }
}
 
開發者ID:fython,項目名稱:Blackbulb,代碼行數:20,代碼來源:MaskTileService.java

示例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();
}
 
開發者ID:ShreyanshLodha,項目名稱:BlueBolt-Kernel-Tweaking-app,代碼行數:12,代碼來源:QSTileService.java

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

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

示例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;
}
 
開發者ID:DysaniazzZ,項目名稱:TopActivity,代碼行數:13,代碼來源:SwitchTileService.java

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

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

示例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();
}
 
開發者ID:kevalpatel2106,項目名稱:android-samples,代碼行數:31,代碼來源:QuickSettingsService.java


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