From dc1dfcb8d2bbc1af6b0c349319dee3f04fe81cbf Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 14 Jul 2021 10:26:40 +0200 Subject: [PATCH] Show same color for summary notification --- app/src/main/java/eu/faircode/email/Core.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 78b3d17c58..f883429618 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -4275,22 +4275,29 @@ class Core { builder.setSound(null); } - if (group != 0 && messages.size() > 0) { - TupleMessageEx amessage = messages.get(0); - Integer color = getColor(amessage); - if (pro && color != null) { + if (pro) { + Integer color = null; + for (TupleMessageEx message : messages) { + Integer mcolor = getColor(message); + if (mcolor == null) { + color = null; + break; + } else if (color == null) + color = mcolor; + else if (!color.equals(mcolor)) { + color = null; + break; + } + } + + if (color != null) { builder.setColor(color); builder.setColorized(true); } - - // Disabled to show number of new messages - if (notify_subtext && false) - if (group < 0) // folder - builder.setSubText(amessage.accountName + " - " + amessage.getFolderName(context)); - else if (group > 0) // account - builder.setSubText(amessage.accountName); } + // Subtext should not be set, to show number of new messages + Notification pub = builder.build(); builder .setVisibility(NotificationCompat.VISIBILITY_PRIVATE) @@ -4716,8 +4723,8 @@ class Core { mbuilder.addPerson(you.build()); } - Integer color = getColor(message); - if (pro && color != null) { + if (pro) { + Integer color = getColor(message); mbuilder.setColor(color); mbuilder.setColorized(true); }