Always have a PinWatcher on a Pin

captchafix
Florens Douwes 11 years ago
parent 6476d65da2
commit c87e6ecfc3
  1. 2
      Clover/app/src/main/java/org/floens/chan/core/manager/PinnedManager.java
  2. 24
      Clover/app/src/main/java/org/floens/chan/core/model/Pin.java

@ -136,9 +136,7 @@ public class PinnedManager {
} }
public void onPinViewed(Pin pin) { public void onPinViewed(Pin pin) {
if (pin.getPinWatcher() != null) {
pin.getPinWatcher().onViewed(); pin.getPinWatcher().onViewed();
}
onPinsChanged(); onPinsChanged();
} }

@ -62,10 +62,6 @@ public class Pin {
public boolean isError = false; public boolean isError = false;
public PinWatcher getPinWatcher() {
return pinWatcher;
}
public int getNewPostsCount() { public int getNewPostsCount() {
if (watchLastCount < 0 || watchNewCount < 0) { if (watchLastCount < 0 || watchNewCount < 0) {
return 0; return 0;
@ -79,19 +75,11 @@ public class Pin {
} }
public Post getLastSeenPost() { public Post getLastSeenPost() {
if (pinWatcher == null) { return getPinWatcher().getLastSeenPost();
return null;
} else {
return pinWatcher.getLastSeenPost();
}
} }
public void updateWatch() { public void updateWatch() {
if (pinWatcher == null) { getPinWatcher().update();
pinWatcher = new PinWatcher(this);
}
pinWatcher.update();
} }
public void destroyWatcher() { public void destroyWatcher() {
@ -108,4 +96,12 @@ public class Pin {
updateWatch(); updateWatch();
} }
} }
public PinWatcher getPinWatcher() {
if (pinWatcher == null) {
pinWatcher = new PinWatcher(this);
}
return pinWatcher;
}
} }

Loading…
Cancel
Save