From ab36e3522b6f2f9dfb90c6158835b2699aabd082 Mon Sep 17 00:00:00 2001 From: Florens Douwes Date: Fri, 12 Sep 2014 22:24:25 +0200 Subject: [PATCH] Add notification count --- .../org/floens/chan/ui/service/WatchNotifier.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Clover/app/src/main/java/org/floens/chan/ui/service/WatchNotifier.java b/Clover/app/src/main/java/org/floens/chan/ui/service/WatchNotifier.java index e7cc9109..def798bc 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/service/WatchNotifier.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/service/WatchNotifier.java @@ -176,7 +176,7 @@ public class WatchNotifier extends Service { } boolean showTickerText = !ChanApplication.getInstance().getApplicationInForeground() && wereNewPosts; - return getNotificationFor(showTickerText ? tickerText : null, title, tickerText, Integer.toString(newPostsCount), lines, makeSound, targetPin); + return getNotificationFor(showTickerText ? tickerText : null, title, tickerText, newPostsCount, lines, makeSound, targetPin); } else { return null; } @@ -187,11 +187,11 @@ public class WatchNotifier extends Service { int s = watchingPins.size(); String message = "Watching " + s + " thread" + (s != 1 ? "s" : ""); - return getNotificationFor(null, message, message, "", null, false, null); + return getNotificationFor(null, message, message, -1, null, false, null); } @SuppressWarnings("deprecation") - private Notification getNotificationFor(String tickerText, String title, String content, String count, + private Notification getNotificationFor(String tickerText, String title, String content, int count, List lines, boolean makeSound, Pin targetPin) { Intent intent = new Intent(this, BoardActivity.class); @@ -214,7 +214,12 @@ public class WatchNotifier extends Service { builder.setTicker(tickerText); builder.setContentTitle(title); builder.setContentText(content); - builder.setContentInfo(count); + + if (count >= 0) { + builder.setContentInfo(Integer.toString(count)); + builder.setNumber(count); + } + builder.setSmallIcon(R.drawable.ic_stat_notify); Intent pauseWatching = new Intent(this, WatchNotifier.class);