mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Improved quick settings tiles
This commit is contained in:
parent
d56296eda3
commit
5790bb6a48
3 changed files with 8 additions and 2 deletions
|
@ -113,7 +113,7 @@
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".ServiceTileSynchronize"
|
android:name=".ServiceTileSynchronize"
|
||||||
android:icon="@drawable/baseline_compare_arrows_24"
|
android:icon="@drawable/baseline_sync_disabled_24"
|
||||||
android:label="@string/tile_synchronize"
|
android:label="@string/tile_synchronize"
|
||||||
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
|
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".ServiceTileUnseen"
|
android:name=".ServiceTileUnseen"
|
||||||
android:icon="@drawable/baseline_mail_24"
|
android:icon="@drawable/baseline_mail_outline_24"
|
||||||
android:label="@string/tile_unseen"
|
android:label="@string/tile_unseen"
|
||||||
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
|
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.drawable.Icon;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.service.quicksettings.Tile;
|
import android.service.quicksettings.Tile;
|
||||||
|
@ -50,6 +51,8 @@ public class ServiceTileSynchronize extends TileService implements SharedPrefere
|
||||||
Tile tile = getQsTile();
|
Tile tile = getQsTile();
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
tile.setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
|
tile.setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
|
||||||
|
tile.setIcon(Icon.createWithResource(this,
|
||||||
|
enabled ? R.drawable.baseline_sync_24 : R.drawable.baseline_sync_disabled_24));
|
||||||
tile.updateTile();
|
tile.updateTile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.drawable.Icon;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.service.quicksettings.Tile;
|
import android.service.quicksettings.Tile;
|
||||||
|
@ -72,6 +73,8 @@ public class ServiceTileUnseen extends TileService {
|
||||||
Tile tile = getQsTile();
|
Tile tile = getQsTile();
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
tile.setState(messages.size() > 0 ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
|
tile.setState(messages.size() > 0 ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
|
||||||
|
tile.setIcon(Icon.createWithResource(ServiceTileUnseen.this,
|
||||||
|
messages.size() > 0 ? R.drawable.baseline_mail_24 : R.drawable.baseline_mail_outline_24));
|
||||||
tile.setLabel(getResources().getQuantityString(
|
tile.setLabel(getResources().getQuantityString(
|
||||||
R.plurals.title_tile_unseen, messages.size(), messages.size()));
|
R.plurals.title_tile_unseen, messages.size(), messages.size()));
|
||||||
tile.updateTile();
|
tile.updateTile();
|
||||||
|
|
Loading…
Reference in a new issue