本文整理汇总了Java中android.service.quicksettings.Tile类的典型用法代码示例。如果您正苦于以下问题:Java Tile类的具体用法?Java Tile怎么用?Java Tile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tile类属于android.service.quicksettings包,在下文中一共展示了Tile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStartListening
import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onStartListening() {
c = getApplicationContext();
sp = getSharedPreferences(TAG2, Context.MODE_PRIVATE);
sp.registerOnSharedPreferenceChangeListener(new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
tile = getQsTile();
if(sp.getBoolean(TAG2,false)){
tile.setState(Tile.STATE_ACTIVE);
} else {
tile.setState(Tile.STATE_INACTIVE);
}
tile.updateTile();
}
});
tile = getQsTile();
Log.i(TAG,String.valueOf(tile.getState()));
}
示例2: onClick
import android.service.quicksettings.Tile; //导入依赖的package包/类
@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();
}
示例3: 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();
}
}
示例4: onClick
import android.service.quicksettings.Tile; //导入依赖的package包/类
@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;
}
}
示例5: onClick
import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onClick() {
int state = getQsTile().getState();
if (state == Tile.STATE_ACTIVE) {
getQsTile().setState(Tile.STATE_INACTIVE);
FeatureHelper.writeSimulateColorSpace(this,
FeatureHelper.ACCESSIBILITY_DISPLAY_DALTONIZER_DISABLE);
} else {
getQsTile().setState(Tile.STATE_ACTIVE);
FeatureHelper.writeSimulateColorSpace(this,
FeatureHelper.ACCESSIBILITY_DISPLAY_DALTONIZER_MONOCHROMACY);
}
getQsTile().updateTile();
}
示例6: 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();
}
示例7: onClick
import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onClick() {
super.onClick();
Icon icon;
if (toggleState == 1) {
toggleState = 0;
// Hide/unmount Magisk root
Shell.su("setprop magisk.root 0");
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_root_off);
getQsTile().setIcon(icon);
getQsTile().setState(Tile.STATE_INACTIVE);
getQsTile().updateTile();
} else {
toggleState = 1;
// Mount Magisk root
Shell.su("setprop magisk.root 1");
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_root);
getQsTile().setIcon(icon);
getQsTile().setState(Tile.STATE_ACTIVE);
getQsTile().updateTile();
}
}
示例8: updateTile
import android.service.quicksettings.Tile; //导入依赖的package包/类
protected static void updateTile(TileService context) {
if(context == null) return;
Tile tile = context.getQsTile();
if (ki4aService.current_status == Util.STATUS_SOCKS) {
tile.setLabel(context.getString(R.string.text_status_connected));
tile.setState(Tile.STATE_ACTIVE);
}
else if (ki4aService.current_status == Util.STATUS_CONNECTING) {
tile.setLabel(context.getString(R.string.text_status_connecting));
tile.setState(Tile.STATE_INACTIVE);
}
else if (ki4aService.current_status == Util.STATUS_DISCONNECT) {
tile.setLabel(context.getString(R.string.text_status_disconnected));
tile.setState(Tile.STATE_INACTIVE);
}
tile.updateTile();
}
示例9: 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();
}
}
示例10: onStartListening
import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onStartListening() {
super.onStartListening();
volumePollingSubscription = Observable.just(0l)
.mergeWith(Observable.interval(500, TimeUnit.MILLISECONDS))
.subscribe(t -> {
int volume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
int max = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
Tile tile = getQsTile();
tile.setLabel(
getString(R.string.tile_level_label, (int) (volume * 100 / max))
);
tile.updateTile();
});
}
示例11: updateTileState
import android.service.quicksettings.Tile; //导入依赖的package包/类
public void updateTileState(final boolean active) {
Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable() {
@Override
public void run() {
Tile tile = getQsTile();
if (tile != null) {
tile.setLabel(active ? "ForceDoze on" : "ForceDoze off");
tile.setState(active ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.updateTile();
}
if (active) {
settings.edit().putBoolean("serviceEnabled", true).apply();
sendBroadcastToApp(active);
} else {
settings.edit().putBoolean("serviceEnabled", false).apply();
sendBroadcastToApp(active);
}
}
}, 1500);
}
示例12: onClick
import android.service.quicksettings.Tile; //导入依赖的package包/类
@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();
}
示例13: onClick
import android.service.quicksettings.Tile; //导入依赖的package包/类
@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");
}
}
示例14: setCurrentState
import android.service.quicksettings.Tile; //导入依赖的package包/类
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();
}
}
示例15: refreshTile
import android.service.quicksettings.Tile; //导入依赖的package包/类
/** <br> UI. */
@RequiresApi(api = Build.VERSION_CODES.N)
public static void refreshTile(Context context, Tile tile) {
if (tile == null) {
return;
}
Location location = DatabaseHelper.getInstance(context).readLocationList().get(0);
location.weather = DatabaseHelper.getInstance(context).readWeather(location);
if (location.weather != null) {
boolean f = PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(context.getString(R.string.key_fahrenheit), false);
tile.setIcon(
Icon.createWithResource(
context,
WeatherHelper.getNotificationWeatherIcon(
location.weather.realTime.weatherKind,
TimeManager.getInstance(context).isDayTime())));
tile.setLabel(
ValueUtils.buildCurrentTemp(
location.weather.realTime.temp,
false,
f));
tile.updateTile();
}
}