mirror of https://github.com/M66B/FairEmail.git
Small optimization
This commit is contained in:
parent
8b81bd8e4d
commit
5cf86d5eb8
|
@ -41,6 +41,9 @@ public class ServiceTileUnseen extends ServiceTileBase {
|
||||||
|
|
||||||
DB db = DB.getInstance(this);
|
DB db = DB.getInstance(this);
|
||||||
|
|
||||||
|
Icon iconSeen = Icon.createWithResource(this, R.drawable.twotone_mail_outline_24);
|
||||||
|
Icon iconUnseen = Icon.createWithResource(this, R.drawable.twotone_mail_24);
|
||||||
|
|
||||||
db.message().liveUnseenNotify().observe(owner, new Observer<List<TupleMessageEx>>() {
|
db.message().liveUnseenNotify().observe(owner, new Observer<List<TupleMessageEx>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(List<TupleMessageEx> messages) {
|
public void onChanged(List<TupleMessageEx> messages) {
|
||||||
|
@ -58,8 +61,7 @@ public class ServiceTileUnseen extends ServiceTileBase {
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
try {
|
try {
|
||||||
tile.setState(unseen > 0 ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
|
tile.setState(unseen > 0 ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
|
||||||
tile.setIcon(Icon.createWithResource(ServiceTileUnseen.this,
|
tile.setIcon(unseen > 0 ? iconUnseen : iconSeen);
|
||||||
unseen > 0 ? R.drawable.twotone_mail_24 : R.drawable.twotone_mail_outline_24));
|
|
||||||
String status = getResources().getQuantityString(
|
String status = getResources().getQuantityString(
|
||||||
R.plurals.title_tile_unseen, unseen, unseen);
|
R.plurals.title_tile_unseen, unseen, unseen);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
|
Loading…
Reference in New Issue