diff --git a/FAQ.md b/FAQ.md index 3bbd3775df..92f16dc8da 100644 --- a/FAQ.md +++ b/FAQ.md @@ -40,10 +40,9 @@ Anything on this list is in random order and *might* be added in the near future * *Rich text editor* / [Markdown](https://en.wikipedia.org/wiki/Markdown) support: besides that very few people would use this on a small mobile device, Android doesn't support a rich text editor and most rich text editor open source projects are abandoned. See [here](https://forum.xda-developers.com/showpost.php?p=79061829&postcount=4919) for some more details. * *Widget to read messages*: widgets can have limited user interaction only, so a widget to read e-mail would not be very useful. Moreover, it would be not very useful to duplicate functions which are already available in the app. -* *Badge count*: there is no standard Android API for this and third party solutions might stop working anytime. For example *ShortcutBadger* [has lots of problems](https://github.com/leolin310148/ShortcutBadger/issues). You can use the provided widget instead. * *Switch language*: Android is not designed to change the language of an app and on recent Android versions it even causes problems. So, better fix the translation in your language if needed, see [this FAQ](#user-content-faq26) about how to. -* *Design*: the design is based on many discussions and if you like you can discuss about it too [in this forum](https://forum.xda-developers.com/android/apps-games/source-email-t3824168). -* *ActiveSync*: using the Exchange ActiveSync protocol requires [a license](https://en.wikipedia.org/wiki/Exchange_ActiveSync#Licensing), so this cannot be added. +* *Design*: the design is based on many discussions and if you like you can discuss about it [in this forum](https://forum.xda-developers.com/android/apps-games/source-email-t3824168) too. +* *ActiveSync*: using the Exchange ActiveSync protocol requires [a license](https://en.wikipedia.org/wiki/Exchange_ActiveSync#Licensing), so this cannot be added. Moreover, the ActiveSync protocol is being phased out. Since FairEmail is meant to be privacy friendly, the following will not be added: diff --git a/README.md b/README.md index 95586a0990..0606d3a302 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ FairEmail uses: * [Android SQLite support library](https://github.com/requery/sqlite-android). Copyright (C) 2017 requery.io. [Apache License 2.0](https://github.com/requery/sqlite-android/blob/master/LICENSE). * [App shortcut icon generator](https://romannurik.github.io/AndroidAssetStudio/icons-app-shortcut.html). Copyright ???. [Apache License 2.0](https://github.com/romannurik/AndroidAssetStudio/blob/master/LICENSE). * [Mozilla ISPDB](https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration#ISPDB). *Free to use for any client.* +* [ShortcutBadger](https://github.com/leolin310148/ShortcutBadger). Copyright 2014 Leo Lin. [Apache license](https://github.com/leolin310148/ShortcutBadger/blob/master/LICENSE). ## License diff --git a/app/build.gradle b/app/build.gradle index fb6a0199be..c0bc2ff9c3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -118,6 +118,7 @@ dependencies { def dnsjava_version = "2.1.8" def openpgp_version = "12.0" def requery_version = "3.27.1" + def badge_version = "1.1.22" // https://developer.android.com/jetpack/docs/release-notes @@ -179,6 +180,9 @@ dependencies { // https://github.com/requery/sqlite-android/ implementation "io.requery:sqlite-android:$requery_version" + // https://github.com/leolin310148/ShortcutBadger + implementation "me.leolin:ShortcutBadger:$badge_version" + // git clone https://android.googlesource.com/platform/frameworks/opt/colorpicker implementation project(path: ':colorpicker') } diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index ae3c097b39..90bb2b5de0 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -84,6 +84,7 @@ import javax.net.ssl.SSLException; import androidx.annotation.NonNull; import androidx.core.app.NotificationCompat; import androidx.preference.PreferenceManager; +import me.leolin.shortcutbadger.ShortcutBadger; import static android.os.Process.THREAD_PRIORITY_BACKGROUND; @@ -1393,6 +1394,7 @@ class Core { Log.i("Notify messages=" + messages.size()); Widget.update(context, messages.size()); + ShortcutBadger.applyCount(context, messages.size()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor editor = prefs.edit(); diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 661695d519..3014ac41f7 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -80,6 +80,7 @@ import androidx.core.content.ContextCompat; import androidx.lifecycle.LifecycleService; import androidx.lifecycle.Observer; import androidx.preference.PreferenceManager; +import me.leolin.shortcutbadger.ShortcutBadger; import static android.os.Process.THREAD_PRIORITY_BACKGROUND; @@ -162,6 +163,7 @@ public class ServiceSynchronize extends LifecycleService { cm.unregisterNetworkCallback(networkCallback); Widget.update(this, -1); + ShortcutBadger.applyCount(this, 0); WorkerCleanup.cancel();