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


Java Tile.setState方法代碼示例

本文整理匯總了Java中android.service.quicksettings.Tile.setState方法的典型用法代碼示例。如果您正苦於以下問題:Java Tile.setState方法的具體用法?Java Tile.setState怎麽用?Java Tile.setState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.service.quicksettings.Tile的用法示例。


在下文中一共展示了Tile.setState方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateTileState

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
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,代碼行數:19,代碼來源:ServerService.java

示例2: getTileState

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
private void getTileState() {
    Tile tile = getQsTile();

    // Check if permissions are granted
    if (!ImmersiveModeUtils.hasSecureSettingsPermission(this.getApplicationContext())) {
        tile.setState(Tile.STATE_UNAVAILABLE);
        tile.updateTile();
        return;
    }

    // Update tile based on PolicyControl
    if (ImmersiveModeUtils.isImmersiveModeActive(this.getApplicationContext())) {
        tile.setState(Tile.STATE_ACTIVE);
    } else {
        tile.setState(Tile.STATE_INACTIVE);
    }
    tile.updateTile();
}
 
開發者ID:kz,項目名稱:immersify,代碼行數:19,代碼來源:ImmersifyTileService.java

示例3: updateState

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
private void updateState() {
    Tile tile = getQsTile();
    if(tile != null) {
        SharedPreferences pref = U.getSharedPreferences(this);
        tile.setIcon(Icon.createWithResource(this, pref.getBoolean("app_drawer_icon", false)
                ? R.drawable.ic_system
                : R.drawable.ic_allapps));

        if(U.canDrawOverlays(this))
            tile.setState(U.isServiceRunning(this, NotificationService.class)
                    ? Tile.STATE_ACTIVE
                    : Tile.STATE_INACTIVE);
        else
            tile.setState(Tile.STATE_UNAVAILABLE);

        tile.updateTile();
    }
}
 
開發者ID:farmerbb,項目名稱:Taskbar,代碼行數:19,代碼來源:QuickSettingsTileService.java

示例4: updateTileState

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
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,代碼行數:23,代碼來源:CommunicationToggleTile.java

示例5: onClick

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
@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();
    }
}
 
開發者ID:Alex-Jerry,項目名稱:LLApp,代碼行數:19,代碼來源:QuickService.java

示例6: updateTile

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
private void updateTile() {
    TelephonyManager manager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    String code = manager.getSimOperator();
    String country = manager.getSimCountryIso();

    SharedPreferences preferences = PropUtil.getProtecredSharedPreferences(this);

    Tile tile = getQsTile();
    tile.setLabel(String.format("%s %s", code, country));
    if (preferences.getBoolean(PropUtil.PREFERENCE_ENABLED, PropUtil.PREFERENCE_ENABLED_DEFAULT)) {
        tile.setState(Tile.STATE_ACTIVE);
    }
    else {
        tile.setState(Tile.STATE_INACTIVE);
    }
    tile.updateTile();
}
 
開發者ID:GhostFlying,項目名稱:LocationReportEnabler,代碼行數:18,代碼來源:FakeOperatorTile.java

示例7: onStartListening

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
@Override
    public void onStartListening() {
        final Tile nightMode = getQsTile();
        boolean isActive;

        if (Build.VERSION.SDK_INT == 24) isActive = Settings.Secure.getInt(getContentResolver(), "twilight_mode", 0) == 1;
        else {
            isActive = Settings.Secure.getInt(getContentResolver(), NIGHT_DISPLAY_ACTIVATED, 0) == 1;
            nightMode.setLabel(getResources().getText(R.string.night_display));
        }

        nightMode.setState(isActive ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
        nightMode.updateTile();

//        service = this;

        mToggleIntent = new Intent("toggle_night");

        mToggleReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                if (intent.getAction().equals("toggle_night")) {
                    boolean state = intent.getBooleanExtra("state", false);
                    nightMode.setState(state ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
                    nightMode.updateTile();
                }
            }
        };

        IntentFilter filter = new IntentFilter("toggle_night");
        registerReceiver(mToggleReceiver, filter);
    }
 
開發者ID:zacharee,項目名稱:SystemUITuner2,代碼行數:33,代碼來源:NightModeTileService.java

示例8: onClick

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
@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();
}
 
開發者ID:zacharee,項目名稱:SystemUITuner2,代碼行數:32,代碼來源:NightModeTileService.java

示例9: onStartListening

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
@Override
public void onStartListening() {
    Tile battery = getQsTile();
    mBatteryStatus = registerReceiver(mReceiver = new BC(), mFilter);

    battery.setState(Tile.STATE_ACTIVE);
    setBat(mBatteryStatus);
    battery.updateTile();
}
 
開發者ID:zacharee,項目名稱:SystemUITuner2,代碼行數:10,代碼來源:BatteryTileService.java

示例10: _isRunning

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
private void _isRunning(Tile tile) {
    if (isCharging()) {
        tile.setState(Tile.STATE_ACTIVE);
        tile.setIcon(mIconEyeOpen);
        tile.setLabel(getString(R.string.tile_active_charging_text));
    } else {
        tile.setState(Tile.STATE_ACTIVE);
        tile.setIcon(mIconEyeOpen);
        long timeRemaining = MAX_TIME_SEC - mTimeRunning_sec;
        final String formatTime = formatTime(timeRemaining);
        tile.setLabel(getString(R.string.tile_active_text, formatTime));
    }
}
 
開發者ID:r3bl-alliance,項目名稱:stay-awake-app,代碼行數:14,代碼來源:MyTileService.java

示例11: update

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
private void update() {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    boolean enabled = prefs.getBoolean("enabled", false);
    Tile tile = getQsTile();
    if (tile != null) {
        tile.setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
        tile.updateTile();
    }
}
 
開發者ID:miankai,項目名稱:MKAPP,代碼行數:10,代碼來源:ServiceTileMain.java

示例12: update

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
private void update() {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    boolean stats = prefs.getBoolean("show_stats", false);
    Tile tile = getQsTile();
    if (tile != null) {
        tile.setState(stats ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
        tile.updateTile();
    }
}
 
開發者ID:miankai,項目名稱:MKAPP,代碼行數:10,代碼來源:ServiceTileGraph.java

示例13: update

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
private void update() {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    boolean filter = prefs.getBoolean("filter", false);
    Tile tile = getQsTile();
    if (tile != null) {
        tile.setState(filter ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
        tile.updateTile();
    }
}
 
開發者ID:miankai,項目名稱:MKAPP,代碼行數:10,代碼來源:ServiceTileFilter.java

示例14: update

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
private void update() {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    boolean lockdown = prefs.getBoolean("lockdown", false);
    Tile tile = getQsTile();
    if (tile != null) {
        tile.setState(lockdown ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
        tile.updateTile();
    }
}
 
開發者ID:miankai,項目名稱:MKAPP,代碼行數:10,代碼來源:ServiceTileLockdown.java

示例15: updateTile

import android.service.quicksettings.Tile; //導入方法依賴的package包/類
private void updateTile() {
    boolean activate = DaedalusVpnService.isActivated();
    Tile tile = getQsTile();
    tile.setLabel(getString(R.string.quick_toggle));
    tile.setContentDescription(getString(R.string.app_name));
    tile.setState(activate ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
    tile.updateTile();
}
 
開發者ID:iTXTech,項目名稱:Daedalus,代碼行數:9,代碼來源:DaedalusTileService.java


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