Small settings tile improvements

This commit is contained in:
M66B 2022-11-07 20:54:51 +01:00
parent b8bdf1ec8b
commit 9c54607b1b
2 changed files with 10 additions and 2 deletions

View File

@ -54,6 +54,9 @@ public class ServiceTileSynchronize extends TileService implements SharedPrefere
tile.setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.setIcon(Icon.createWithResource(this,
enabled ? R.drawable.twotone_sync_24 : R.drawable.twotone_sync_disabled_24));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
tile.setSubtitle(getString(
enabled ? R.string.title_power_menu_on : R.string.title_power_menu_off));
tile.updateTile();
} catch (Throwable ex) {
Log.w(ex);

View File

@ -61,8 +61,13 @@ public class ServiceTileUnseen extends TileService {
tile.setState(unseen > 0 ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.setIcon(Icon.createWithResource(ServiceTileUnseen.this,
unseen > 0 ? R.drawable.twotone_mail_24 : R.drawable.twotone_mail_outline_24));
tile.setLabel(getResources().getQuantityString(
R.plurals.title_tile_unseen, unseen, unseen));
String status = getResources().getQuantityString(
R.plurals.title_tile_unseen, unseen, unseen);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
tile.setLabel(getString(R.string.app_name));
tile.setSubtitle(status);
} else
tile.setLabel(status);
tile.updateTile();
} catch (Throwable ex) {
Log.w(ex);