From 91cc90ec04ef0d756beb4fbe40ffe81345238ea3 Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Fri, 21 Apr 2017 07:23:39 +0200 Subject: [PATCH] Fix unread badge for archive --- .../java/ch/dissem/apps/abit/MainActivity.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/ch/dissem/apps/abit/MainActivity.java b/app/src/main/java/ch/dissem/apps/abit/MainActivity.java index d744b99..f7d2c07 100644 --- a/app/src/main/java/ch/dissem/apps/abit/MainActivity.java +++ b/app/src/main/java/ch/dissem/apps/abit/MainActivity.java @@ -78,6 +78,7 @@ import ch.dissem.bitmessage.entity.valueobject.Label; import static android.widget.Toast.LENGTH_LONG; import static ch.dissem.apps.abit.ComposeMessageActivity.launchReplyTo; +import static ch.dissem.apps.abit.repository.AndroidMessageRepository.LABEL_ARCHIVE; import static ch.dissem.apps.abit.service.BitmessageService.isRunning; @@ -321,7 +322,7 @@ public class MainActivity extends AppCompatActivity final ArrayList drawerItems = new ArrayList<>(); drawerItems.add(new PrimaryDrawerItem() .withName(R.string.archive) - .withTag(AndroidMessageRepository.LABEL_ARCHIVE) + .withTag(LABEL_ARCHIVE) .withIcon(CommunityMaterial.Icon.cmd_archive) ); drawerItems.add(new DividerDrawerItem()); @@ -533,13 +534,15 @@ public class MainActivity extends AppCompatActivity for (IDrawerItem item : drawer.getDrawerItems()) { if (item.getTag() instanceof Label) { Label label = (Label) item.getTag(); - int unread = bmc.messages().countUnread(label); - if (unread > 0) { - ((PrimaryDrawerItem) item).withBadge(String.valueOf(unread)); - } else { - ((PrimaryDrawerItem) item).withBadge((String) null); + if (label != LABEL_ARCHIVE) { + int unread = bmc.messages().countUnread(label); + if (unread > 0) { + ((PrimaryDrawerItem) item).withBadge(String.valueOf(unread)); + } else { + ((PrimaryDrawerItem) item).withBadge((String) null); + } + drawer.updateItem(item); } - drawer.updateItem(item); } } }