added ShortcutBadger as a dependency to create unread counts on launcher icon
This commit is contained in:
parent
a4ec7a7df1
commit
2364710afb
|
@ -35,6 +35,7 @@ dependencies {
|
||||||
compile 'com.google.zxing:android-integration:3.1.0'
|
compile 'com.google.zxing:android-integration:3.1.0'
|
||||||
compile 'de.measite.minidns:minidns:0.1.3'
|
compile 'de.measite.minidns:minidns:0.1.3'
|
||||||
compile 'de.timroes.android:EnhancedListView:0.3.4'
|
compile 'de.timroes.android:EnhancedListView:0.3.4'
|
||||||
|
compile 'me.leolin:ShortcutBadger:1.1.1@aar'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
@ -44,8 +45,8 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 21
|
targetSdkVersion 21
|
||||||
versionCode 67
|
versionCode 68
|
||||||
versionName "1.4.1"
|
versionName "1.5.0-alpha"
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|
|
@ -134,6 +134,7 @@ public class NotificationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void push(final Message message) {
|
public void push(final Message message) {
|
||||||
|
mXmppConnectionService.updateUnreadCountBadge();
|
||||||
if (!notify(message)) {
|
if (!notify(message)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ import eu.siacs.conversations.xmpp.pep.Avatar;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
|
import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.PresencePacket;
|
import eu.siacs.conversations.xmpp.stanzas.PresencePacket;
|
||||||
|
import me.leolin.shortcutbadger.ShortcutBadger;
|
||||||
|
|
||||||
public class XmppConnectionService extends Service implements OnPhoneContactsLoadedListener {
|
public class XmppConnectionService extends Service implements OnPhoneContactsLoadedListener {
|
||||||
|
|
||||||
|
@ -2254,6 +2255,17 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
public void markRead(final Conversation conversation) {
|
public void markRead(final Conversation conversation) {
|
||||||
mNotificationService.clear(conversation);
|
mNotificationService.clear(conversation);
|
||||||
conversation.markRead();
|
conversation.markRead();
|
||||||
|
updateUnreadCountBadge();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateUnreadCountBadge() {
|
||||||
|
int count = unreadCount();
|
||||||
|
Log.d(Config.LOGTAG,"update unread count to "+count);
|
||||||
|
if (count > 0) {
|
||||||
|
ShortcutBadger.with(getApplicationContext()).count(count);
|
||||||
|
} else {
|
||||||
|
ShortcutBadger.with(getApplicationContext()).remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendReadMarker(final Conversation conversation) {
|
public void sendReadMarker(final Conversation conversation) {
|
||||||
|
|
Loading…
Reference in a new issue