当前位置: 首页>>代码示例>>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;未经允许,请勿转载。