Fix background timeout on watch manager

filtering
Floens 10 years ago
parent 71e9e7e16d
commit e9745d4a04
  1. 2
      Clover/app/src/main/java/org/floens/chan/core/loader/ChanLoader.java
  2. 5
      Clover/app/src/main/java/org/floens/chan/core/manager/WatchManager.java
  3. 4
      Clover/app/src/main/java/org/floens/chan/ui/activity/StartActivity.java
  4. 2
      Clover/app/src/main/java/org/floens/chan/ui/controller/WatchSettingsController.java
  5. 4
      Clover/app/src/main/java/org/floens/chan/ui/service/WatchNotifier.java

@ -253,7 +253,7 @@ public class ChanLoader {
}
private ChanReaderRequest getData() {
Logger.i(TAG, "Requested " + loadable.board + ", " + loadable.no);
Logger.d(TAG, "Requested " + loadable.board + ", " + loadable.no);
List<Post> cached = thread == null ? new ArrayList<Post>() : thread.posts;
ChanReaderRequest request = ChanReaderRequest.newInstance(loadable, cached,

@ -294,6 +294,7 @@ public class WatchManager {
}
private void updateTimerState(boolean watchEnabled, boolean backgroundEnabled, boolean invokeLoadNow) {
Logger.d(TAG, "updateTimerState watchEnabled=" + watchEnabled + " backgroundEnabled=" + backgroundEnabled + " invokeLoadNow=" + invokeLoadNow + " foreground=" + ChanApplication.getInstance().getApplicationInForeground());
if (watchEnabled) {
if (ChanApplication.getInstance().getApplicationInForeground()) {
setTimer(invokeLoadNow ? 1 : FOREGROUND_TIME);
@ -340,11 +341,11 @@ public class WatchManager {
}
}, time, TimeUnit.SECONDS);
pendingTimer = new PendingTimer(scheduledFuture, time);
// Logger.d(TAG, "Timer firing in " + time + " seconds");
Logger.d(TAG, "Timer firing in " + time + " seconds");
}
private void timerFired() {
// Logger.d(TAG, "Timer fired");
Logger.d(TAG, "Timer fired");
pendingTimer = null;
for (Pin pin : getWatchingPins()) {

@ -78,10 +78,6 @@ public class StartActivity extends AppCompatActivity {
stackTop().onDestroy();
stack.clear();
System.gc();
System.gc();
System.gc();
System.runFinalization();
}
@Override

@ -91,7 +91,7 @@ public class WatchSettingsController extends SettingsController implements Compo
ListSettingView.Item[] timeoutsItems = new ListSettingView.Item[timeouts.length];
for (int i = 0; i < timeouts.length; i++) {
String name = context.getResources().getQuantityString(R.plurals.minutes, timeouts[i], timeouts[i]);
timeoutsItems[i] = new ListSettingView.Item(name, String.valueOf(timeouts[i]));
timeoutsItems[i] = new ListSettingView.Item(name, String.valueOf(timeouts[i] * 60));
}
backgroundTimeout = settings.add(new ListSettingView(this, ChanSettings.watchBackgroundTimeout, string(R.string.setting_watch_background_timeout), timeoutsItems));

@ -33,7 +33,9 @@ import org.floens.chan.core.manager.WatchManager;
import org.floens.chan.core.model.Pin;
import org.floens.chan.core.model.Post;
import org.floens.chan.core.watch.PinWatcher;
import org.floens.chan.ui.activity.BoardActivity;
import org.floens.chan.ui.activity.ChanActivity;
import org.floens.chan.ui.activity.StartActivity;
import org.floens.chan.utils.AndroidUtils;
import java.util.ArrayList;
@ -213,7 +215,7 @@ public class WatchNotifier extends Service {
@SuppressWarnings("deprecation")
private Notification getNotificationFor(String tickerText, String contentTitle, String contentText, int contentNumber,
List<CharSequence> expandedLines, boolean light, boolean makeSound, Pin target) {
Intent intent = new Intent(this, ChanActivity.class);
Intent intent = new Intent(this, BoardActivity.class);
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK |

Loading…
Cancel
Save