本文整理了Java中android.service.quicksettings.Tile.setLabel()
方法的一些代码示例,展示了Tile.setLabel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tile.setLabel()
方法的具体详情如下:
包路径:android.service.quicksettings.Tile
类名称:Tile
方法名:setLabel
暂无
代码示例来源:origin: commonsguy/cw-omnibus
private void updateTile() {
Tile tile=getQsTile();
if (tile!=null) {
boolean isEnabled=getPrefs().getBoolean(MonitorApp.PREF_ENABLED, false);
int state=isEnabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
tile.setIcon(Icon.createWithResource(this,
R.drawable.ic_new_releases_24dp));
tile.setLabel(getString(R.string.app_name));
tile.setState(state);
tile.updateTile();
}
}
代码示例来源:origin: ukanth/afwall
public void cbFunc(RootCommand state) {
Api.setEnabled(context, state.exitCode != 0, true);
tile.setState(Tile.STATE_INACTIVE);// e() method form java, used in Kotlin as a property
tile.setLabel(getString(R.string.inactive));
tile.setIcon(Icon.createWithResource(context, R.drawable.notification_error));
tile.updateTile();
}
}));
代码示例来源:origin: ukanth/afwall
public void cbFunc(RootCommand state) {
// setEnabled always sends us a STATUS_CHANGED_MSG intent to update the icon
Api.setEnabled(context, state.exitCode == 0, true);
tile.setState(Tile.STATE_ACTIVE);
tile.setLabel(getString(R.string.active));
tile.setIcon(Icon.createWithResource(context, R.drawable.notification));
tile.updateTile();
}
}));
代码示例来源:origin: iTXTech/Daedalus
@Override
public void onClick() {
Tile tile = getQsTile();
tile.setLabel(getString(R.string.quick_toggle));
tile.setContentDescription(getString(R.string.app_name));
tile.setState(Daedalus.switchService() ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.updateTile();
}
代码示例来源:origin: iTXTech/Daedalus
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();
}
}
代码示例来源:origin: ukanth/afwall
@Override
public void onStartListening() {
super.onStartListening();
boolean status = Api.isEnabled(this);
Tile tile = getQsTile(); // this is getQsTile() method form java, used in Kotlin as a property
if (tile != null) {
if (!status) {
tile.setLabel(getString(R.string.inactive));
tile.setIcon(Icon.createWithResource(this, R.drawable.notification_error));
tile.setState(Tile.STATE_INACTIVE);
} else {
tile.setLabel(getString(R.string.active));
tile.setIcon(Icon.createWithResource(this, R.drawable.notification));
tile.setState(Tile.STATE_ACTIVE);
}
tile.updateTile();
}
}
代码示例来源:origin: by-syk/NetUpDown
private void updateTitle(String title) {
if (title == null) {
return;
}
Tile tile = getQsTile();
if (tile != null) {
tile.setLabel(title);
tile.updateTile();
}
}
}
代码示例来源:origin: AzimoLabs/Language-Switcher-Tile
public void enable() {
getQsTile().setState(Tile.STATE_ACTIVE);
if (prefs.getLastLanguage() != null) {
getQsTile().setLabel(prefs.getLastLanguage().toUpperCase());
} else {
getQsTile().setLabel(Locale.getDefault().getLanguage().toUpperCase());
}
getQsTile().updateTile();
}
代码示例来源:origin: Omico/CurrentActivity
private void setTile(Icon icon, String label, int state) {
tile.setIcon(icon);
tile.setLabel(label);
tile.setContentDescription(label);
tile.setState(state);
}
}
代码示例来源:origin: r3bl-org/stay-awake-app
private void _isNotRunning(Tile tile) {
tile.setState(Tile.STATE_INACTIVE);
tile.setIcon(mIconEyeClosed);
tile.setLabel(getString(R.string.tile_inactive_text));
}
代码示例来源:origin: r3bl-org/stay-awake-app
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));
}
}
代码示例来源:origin: by-syk/NetUpDown
private void switchState(boolean isActive) {
Tile tile = getQsTile();
if (tile != null) {
tile.setLabel(getString(R.string.tile_run));
if (isActive) {
tile.setState(Tile.STATE_ACTIVE);
} else {
tile.setState(Tile.STATE_INACTIVE);
}
tile.updateTile();
}
}
代码示例来源:origin: AlexMofer/ProjectX
private void updateTile(boolean active) {
final Tile tile = getQsTile();
if (active) {
tile.setIcon(Icon.createWithResource(this, R.drawable.ic_tile_ftp));
tile.setLabel(getString(R.string.ftp_tile_label_active));
tile.setState(Tile.STATE_ACTIVE);
} else {
tile.setIcon(Icon.createWithResource(this, R.drawable.ic_tile_ftp));
tile.setLabel(getString(R.string.ftp_tile_label_inactive));
tile.setState(Tile.STATE_INACTIVE);
}
tile.updateTile();
}
}
代码示例来源:origin: WangDaYeeeeee/GeometricWeather
/** <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();
}
}
}
代码示例来源:origin: haruue/WADB
private void showStateOff() {
Tile tile = getQsTile();
tile.setState(Tile.STATE_INACTIVE);
tile.setIcon(Icon.createWithResource(getApplication(), R.drawable.ic_qs_network_adb_off));
tile.setLabel(getApplication().getResources().getString(R.string.app_name));
tile.updateTile();
}
代码示例来源:origin: wolpi/prim-ftpd
/**
* Update the appearance of the tile.
*/
protected void updateTile() {
logger.debug("updateTile");
Tile tile = this.getQsTile();
boolean isActive = isActive();
String newLabel;
int newState;
// Change the tile to match the service status.
if (isActive) {
newLabel = getString(R.string.quickSettingsServerStarted);
newState = Tile.STATE_ACTIVE;
} else {
newLabel = getString(R.string.quickSettingsServerStopped);
newState = Tile.STATE_INACTIVE;
}
// Change the UI of the tile.
tile.setLabel(newLabel);
tile.setState(newState);
tile.updateTile();
}
代码示例来源:origin: haruue/WADB
private void showStateOn(String ip, int port) {
Tile tile = getQsTile();
tile.setState(Tile.STATE_ACTIVE);
tile.setIcon(Icon.createWithResource(getApplication(), R.drawable.ic_qs_network_adb_on));
tile.setLabel(ip + ":" + port);
tile.updateTile();
}
代码示例来源:origin: fgl27/isu
@Override
public void onStartListening() {
super.onStartListening();
mTile = getQsTile();
if (Tools.rootAccess(this) && Tools.SuVersionBool(Tools.SuVersion(this))) {
su = Tools.SuBinary();
mTile.setLabel((su ? this.getString(R.string.activated) : this.getString(R.string.deactivated)));
mTile.setState(su ? mTile.STATE_ACTIVE : mTile.STATE_INACTIVE);
} else {
mTile.setLabel(this.getString(R.string.not_available));
mTile.setState(mTile.STATE_UNAVAILABLE);
}
mTile.updateTile();
}
代码示例来源:origin: fgl27/isu
@Override
public void onClick() {
super.onClick();
mTile = getQsTile();
if (Tools.rootAccess(this) && Tools.SuVersionBool(Tools.SuVersion(this))) {
su = !Tools.SuBinary();
Tools.SwitchSu(su, false, this);
mTile.setLabel((su ? this.getString(R.string.activated) : this.getString(R.string.deactivated)));
mTile.setState(su ? mTile.STATE_ACTIVE : mTile.STATE_INACTIVE);
Tools.SendBroadcast("updateControlsReceiver", this);
} else {
mTile.setLabel(this.getString(R.string.not_available));
mTile.setState(mTile.STATE_UNAVAILABLE);
}
mTile.updateTile();
}
代码示例来源:origin: WireGuard/wireguard-android
private void updateTile() {
// Update the tunnel.
final Tunnel newTunnel = Application.getTunnelManager().getLastUsedTunnel();
if (newTunnel != tunnel) {
if (tunnel != null)
tunnel.removeOnPropertyChangedCallback(onStateChangedCallback);
tunnel = newTunnel;
if (tunnel != null)
tunnel.addOnPropertyChangedCallback(onStateChangedCallback);
}
// Update the tile contents.
final String label;
final int state;
final Tile tile = getQsTile();
if (tunnel != null) {
label = tunnel.getName();
state = tunnel.getState() == Tunnel.State.UP ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
} else {
label = getString(R.string.app_name);
state = Tile.STATE_INACTIVE;
}
if (tile == null)
return;
tile.setLabel(label);
if (tile.getState() != state) {
tile.setIcon(state == Tile.STATE_ACTIVE ? iconOn : iconOff);
tile.setState(state);
}
tile.updateTile();
}
内容来源于网络,如有侵权,请联系作者删除!