Skip to content

Commit

Permalink
Re-added ShortcutBadger.
Browse files Browse the repository at this point in the history
  • Loading branch information
johanw666 committed Mar 26, 2019
1 parent ea1a219 commit c416c53
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ repositories {
maven {
url "https://repo1.maven.org/maven2/"
}
maven {
url "https://raw.github.com/whispersystems/maven/master/shortcutbadger/releases/"
}
jcenter()
mavenLocal()
}
Expand All @@ -28,6 +31,7 @@ subprojects {
}

dependencies {
compile "me.leolin:ShortcutBadger:1.1.16"
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.jpardogo.materialtabstrip:library:1.0.9'
compile project (':org.w3c.dom')
Expand Down Expand Up @@ -130,6 +134,7 @@ dependencyVerification {
'org.apache.httpcomponents:httpclient-android:6f56466a9bd0d42934b90bfbfe9977a8b654c058bf44a12bdc2877c4e1f033f1',
'se.emilsjolander:stickylistheaders:a08ca948aa6b220f09d82f16bbbac395f6b78897e9eeac6a9f0b0ba755928eeb',
'com.davemorrissey.labs:subsampling-scale-image-view:550c5baa07e0bb4ff0a18b705e96d34436d22619248bd8c08c08c730b1f55cfe',
'me.leolin:ShortcutBadger:e3cb3e7625892129b0c92dd5e4bc649faffdd526d5af26d9c45ee31ff8851774',
]
}

Expand All @@ -140,7 +145,7 @@ android {

defaultConfig {
versionCode 142
versionName "0.15.13.3-JW"
versionName "0.15.13.4-JW"

minSdkVersion 9
targetSdkVersion 22
Expand Down
11 changes: 11 additions & 0 deletions src/org/smssecure/smssecure/notifications/MessageNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
import java.util.ListIterator;
import java.util.concurrent.TimeUnit;

import me.leolin.shortcutbadger.ShortcutBadger; // JW

/**
* Handles posting system notifications for new messages.
*
Expand Down Expand Up @@ -490,6 +492,15 @@ protected Void doInBackground(Void... params) {

private static void updateBadge(Context context, int count) {
BadgeWidgetProvider.getInstance(context, (Class) ConversationListActivity.class).updateBadge(count);
// JW: re-implement badges on icon
try {
if (count == 0) ShortcutBadger.removeCount(context);
else ShortcutBadger.applyCount(context, count);
} catch (Throwable t) {
// NOTE :: I don't totally trust this thing, so I'm catching
// everything.
Log.w("MessageNotifier", t);
}
}

}

0 comments on commit c416c53

Please sign in to comment.