Don't show notification when background watching is disabled

This could happen if the WatchService loop did an iteration in the background.
captchafix
Florens Douwes 11 years ago
parent 320410f695
commit 93e260f8b3
  1. 3
      Clover/app/src/main/java/org/floens/chan/core/watch/WatchNotifier.java
  2. 4
      Clover/app/src/main/java/org/floens/chan/service/WatchService.java

@ -26,6 +26,7 @@ import android.support.v4.app.NotificationCompat;
import org.floens.chan.ChanApplication;
import org.floens.chan.R;
import org.floens.chan.core.ChanPreferences;
import org.floens.chan.core.model.Pin;
import org.floens.chan.core.model.Post;
import org.floens.chan.service.WatchService;
@ -61,7 +62,7 @@ public class WatchNotifier {
}
public void onForegroundChanged() {
if (WatchService.getActivityInForeground()) {
if (WatchService.getActivityInForeground() && ChanPreferences.getWatchBackgroundEnabled()) {
nm.cancel(NOTIFICATION_ID);
} else {

@ -163,8 +163,6 @@ public class WatchService extends Service {
while (running) {
Logger.d(TAG, "Loadthread loop");
update();
if (!running)
return;
@ -180,6 +178,8 @@ public class WatchService extends Service {
Logger.d(TAG, "Interrupted!");
}
} else {
update();
try {
Thread.sleep(timeout);
} catch (InterruptedException e) {

Loading…
Cancel
Save