diff --git a/Chan/src/org/floens/chan/core/model/Pin.java b/Chan/src/org/floens/chan/core/model/Pin.java index 95cb5f81..b4203baa 100644 --- a/Chan/src/org/floens/chan/core/model/Pin.java +++ b/Chan/src/org/floens/chan/core/model/Pin.java @@ -41,6 +41,22 @@ public class Pin { public PinWatcher getPinWatcher() { return pinWatcher; } + + public int getNewPostsCount() { + if (watchLastCount <= 0) { + return 0; + } else { + return Math.max(0, watchNewCount - watchLastCount); + } + } + + public int getNewQuoteCount() { + if (quoteLastCount <= 0) { + return 0; + } else { + return Math.max(0, quoteNewCount - quoteLastCount); + } + } public void updateWatch() { if (pinWatcher == null) { diff --git a/Chan/src/org/floens/chan/core/watch/PinWatcher.java b/Chan/src/org/floens/chan/core/watch/PinWatcher.java index f7760b69..0bf3f915 100644 --- a/Chan/src/org/floens/chan/core/watch/PinWatcher.java +++ b/Chan/src/org/floens/chan/core/watch/PinWatcher.java @@ -50,15 +50,7 @@ public class PinWatcher implements Loader.LoaderListener { if (posts.size() == 0) { return posts; } else { - return posts.subList(Math.max(0, posts.size() - getNewPostsCount()), posts.size()); - } - } - - public int getNewPostsCount() { - if (pin.watchLastCount <= 0) { - return 0; - } else { - return Math.max(0, pin.watchNewCount - pin.watchLastCount); + return posts.subList(Math.max(0, posts.size() - pin.getNewPostsCount()), posts.size()); } } @@ -66,15 +58,7 @@ public class PinWatcher implements Loader.LoaderListener { if (posts.size() == 0) { return posts; } else { - return posts.subList(Math.max(0, posts.size() - getNewQuoteCount()), posts.size()); - } - } - - public int getNewQuoteCount() { - if (pin.quoteLastCount <= 0) { - return 0; - } else { - return Math.max(0, pin.quoteNewCount - pin.quoteLastCount); + return posts.subList(Math.max(0, posts.size() - pin.getNewQuoteCount()), posts.size()); } } diff --git a/Chan/src/org/floens/chan/core/watch/WatchNotifier.java b/Chan/src/org/floens/chan/core/watch/WatchNotifier.java index 07d5d470..5a0b191d 100644 --- a/Chan/src/org/floens/chan/core/watch/WatchNotifier.java +++ b/Chan/src/org/floens/chan/core/watch/WatchNotifier.java @@ -80,8 +80,8 @@ public class WatchNotifier { boolean add = false; - if (watcher.getNewPostsCount() > 0) { - newPostsCount += watcher.getNewPostsCount(); + if (pin.getNewPostsCount() > 0) { + newPostsCount += pin.getNewPostsCount(); for (Post p : watcher.getNewPosts()) { p.title = pin.loadable.title; posts.add(p); @@ -91,8 +91,8 @@ public class WatchNotifier { add = true; } - if (watcher.getNewQuoteCount() > 0) { - newQuotesCount += watcher.getNewQuoteCount(); + if (pin.getNewQuoteCount() > 0) { + newQuotesCount += pin.getNewQuoteCount(); show = true; add = true; } diff --git a/Chan/src/org/floens/chan/ui/adapter/PinnedAdapter.java b/Chan/src/org/floens/chan/ui/adapter/PinnedAdapter.java index 9069a82d..93e6af1e 100644 --- a/Chan/src/org/floens/chan/ui/adapter/PinnedAdapter.java +++ b/Chan/src/org/floens/chan/ui/adapter/PinnedAdapter.java @@ -53,7 +53,7 @@ public class PinnedAdapter extends ArrayAdapter { if (item.isError()) { itemCount.setText("Err"); } else { - int count = item.getPinWatcher() == null ? 0 : item.getPinWatcher().getNewPostsCount(); + int count = item.getPinWatcher() == null ? 0 : item.getNewPostsCount(); String total = Integer.toString(count); if (count > 999) { total = "1k+";