diff --git a/Clover/app/src/main/java/org/floens/chan/core/manager/PinnedManager.java b/Clover/app/src/main/java/org/floens/chan/core/manager/PinnedManager.java index e5a5f7ef..a87a1b74 100644 --- a/Clover/app/src/main/java/org/floens/chan/core/manager/PinnedManager.java +++ b/Clover/app/src/main/java/org/floens/chan/core/manager/PinnedManager.java @@ -136,9 +136,7 @@ public class PinnedManager { } public void onPinViewed(Pin pin) { - if (pin.getPinWatcher() != null) { - pin.getPinWatcher().onViewed(); - } + pin.getPinWatcher().onViewed(); onPinsChanged(); } diff --git a/Clover/app/src/main/java/org/floens/chan/core/model/Pin.java b/Clover/app/src/main/java/org/floens/chan/core/model/Pin.java index 039a4dec..0927a9a6 100644 --- a/Clover/app/src/main/java/org/floens/chan/core/model/Pin.java +++ b/Clover/app/src/main/java/org/floens/chan/core/model/Pin.java @@ -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; + } }