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) {
if (pin.getPinWatcher() != null) {
pin.getPinWatcher().onViewed();
}
onPinsChanged();
}

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

Loading…
Cancel
Save