Added ShortcutBadger

This commit is contained in:
M66B 2019-03-27 09:48:20 +00:00
parent 082b77019c
commit b672ab77f8
5 changed files with 11 additions and 3 deletions

5
FAQ.md
View File

@ -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:

View File

@ -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

View File

@ -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')
}

View File

@ -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();

View File

@ -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();