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

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

Loading…
Cancel
Save