本文整理汇总了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();
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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));
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}