From ef629e5329be0b5dc4e4aa907496b0cfcdde4404 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 28 May 2021 20:22:47 +0200 Subject: [PATCH] Badge count for Xiaomi (experimental) --- app/src/main/java/eu/faircode/email/Core.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index e7422cf9d8..d9103d36fd 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -130,6 +130,8 @@ import javax.mail.search.ReceivedDateTerm; import javax.mail.search.SearchTerm; import javax.mail.search.SentDateTerm; +import me.leolin.shortcutbadger.ShortcutBadger; + import static android.os.Process.THREAD_PRIORITY_BACKGROUND; import static androidx.core.app.NotificationCompat.DEFAULT_LIGHTS; import static androidx.core.app.NotificationCompat.DEFAULT_SOUND; @@ -4072,6 +4074,9 @@ class Core { " sort=" + notification.getSortKey()); try { nm.notify(tag, 1, notification); + // https://github.com/leolin310148/ShortcutBadger/wiki/Xiaomi-Device-Support + if (id == 0 && Helper.isXiaomi()) + ShortcutBadger.applyNotification(context, notification, current); } catch (Throwable ex) { Log.w(ex); }