Add notification count

captchafix
Florens Douwes 11 years ago
parent e75f20b0ee
commit ab36e3522b
  1. 13
      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; 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 { } else {
return null; return null;
} }
@ -187,11 +187,11 @@ public class WatchNotifier extends Service {
int s = watchingPins.size(); int s = watchingPins.size();
String message = "Watching " + s + " thread" + (s != 1 ? "s" : ""); 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") @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<CharSequence> lines, boolean makeSound, Pin targetPin) { List<CharSequence> lines, boolean makeSound, Pin targetPin) {
Intent intent = new Intent(this, BoardActivity.class); Intent intent = new Intent(this, BoardActivity.class);
@ -214,7 +214,12 @@ public class WatchNotifier extends Service {
builder.setTicker(tickerText); builder.setTicker(tickerText);
builder.setContentTitle(title); builder.setContentTitle(title);
builder.setContentText(content); builder.setContentText(content);
builder.setContentInfo(count);
if (count >= 0) {
builder.setContentInfo(Integer.toString(count));
builder.setNumber(count);
}
builder.setSmallIcon(R.drawable.ic_stat_notify); builder.setSmallIcon(R.drawable.ic_stat_notify);
Intent pauseWatching = new Intent(this, WatchNotifier.class); Intent pauseWatching = new Intent(this, WatchNotifier.class);

Loading…
Cancel
Save