Only reset pin.watchLastCount when it is valid.

captchafix
Florens Douwes 11 years ago
parent c33fc1649f
commit f31f5df28c
  1. 4
      Clover/app/src/main/java/org/floens/chan/core/model/Pin.java
  2. 5
      Clover/app/src/main/java/org/floens/chan/core/watch/PinWatcher.java

@ -54,7 +54,7 @@ public class Pin {
public int watchLastCount = -1; public int watchLastCount = -1;
@DatabaseField @DatabaseField
public int watchNewCount = 0; public int watchNewCount = -1;
@DatabaseField @DatabaseField
public int quoteLastCount = 0; public int quoteLastCount = 0;
@ -69,7 +69,7 @@ public class Pin {
} }
public int getNewPostsCount() { public int getNewPostsCount() {
if (watchLastCount < 0) { if (watchLastCount < 0 || watchNewCount < 0) {
return 0; return 0;
} else { } else {
return Math.max(0, watchNewCount - watchLastCount); return Math.max(0, watchNewCount - watchLastCount);

@ -58,7 +58,10 @@ public class PinWatcher implements Loader.LoaderListener {
} }
public void onViewed() { public void onViewed() {
pin.watchLastCount = pin.watchNewCount; if (pin.watchNewCount >= 0) {
pin.watchLastCount = pin.watchNewCount;
}
pin.quoteLastCount = pin.quoteNewCount; pin.quoteLastCount = pin.quoteNewCount;
wereNewQuotes = false; wereNewQuotes = false;
} }

Loading…
Cancel
Save