From 1e0665a49d59e99a73b37a9ff2034948cedd43ea Mon Sep 17 00:00:00 2001 From: Distopico Date: Tue, 13 Nov 2018 18:18:19 -0500 Subject: [PATCH] fix: crash on new notifications with account without color --- .../org/dystopia/email/ServiceSynchronize.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/dystopia/email/ServiceSynchronize.java b/app/src/main/java/org/dystopia/email/ServiceSynchronize.java index 77ff377e..4fe42b8f 100644 --- a/app/src/main/java/org/dystopia/email/ServiceSynchronize.java +++ b/app/src/main/java/org/dystopia/email/ServiceSynchronize.java @@ -167,8 +167,7 @@ public class ServiceSynchronize extends LifecycleService { new Observer() { @Override public void onChanged(@Nullable TupleAccountStats stats) { - NotificationManager nm = - getSystemService(NotificationManager.class); + NotificationManager nm = getSystemService(NotificationManager.class); nm.notify( NOTIFICATION_SYNCHRONIZE, getNotificationService(stats).build()); @@ -185,8 +184,7 @@ public class ServiceSynchronize extends LifecycleService { @Override public void onChanged(List messages) { - NotificationManager nm = - getSystemService(NotificationManager.class); + NotificationManager nm = getSystemService(NotificationManager.class); Map> messagesByAccount = new HashMap<>(); @@ -201,8 +199,7 @@ public class ServiceSynchronize extends LifecycleService { newList.add(message); if (messagesByAccount.containsKey(accountKey)) { - ArrayList msgList = - messagesByAccount.get(accountKey); + ArrayList msgList = messagesByAccount.get(accountKey); newList.addAll(msgList); } @@ -211,8 +208,7 @@ public class ServiceSynchronize extends LifecycleService { Integer accountColor = message.accountColor; accounts.put( accountKey, - new Pair( - accountName, accountColor)); + new Pair(accountName, accountColor)); } messagesByAccount.put(accountKey, newList); } @@ -222,9 +218,7 @@ public class ServiceSynchronize extends LifecycleService { messagesByAccount.entrySet()) { Long accountId = messagesAccount.getKey(); List notifications = - getNotificationUnseen( - messagesAccount.getValue(), - accounts.get(accountId)); + getNotificationUnseen(messagesAccount.getValue(), accounts.get(accountId)); List all = new ArrayList<>(); List added = new ArrayList<>(); List removed = new ArrayList<>(); @@ -453,7 +447,7 @@ public class ServiceSynchronize extends LifecycleService { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String accountName = (String) account.first; - Integer accountColor = (int) account.second; + Integer accountColor = (Integer) account.second; Integer groupColor = accountColor != null ? accountColor