From b1af659e794de18fddfa3d3c6516d587c2650f7c Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 27 Oct 2016 03:15:38 +0900 Subject: [PATCH] Don't load folders/devices in onResume() --- .../fragments/DeviceListFragment.java | 22 +++++++------------ .../fragments/FolderListFragment.java | 22 +++++++------------ 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceListFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceListFragment.java index 25563e2f..329fc327 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceListFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceListFragment.java @@ -35,19 +35,6 @@ public class DeviceListFragment extends ListFragment implements SyncthingService private Timer mTimer; - @Override - public void onResume() { - super.onResume(); - mTimer = new Timer(); - mTimer.schedule(new TimerTask() { - @Override - public void run() { - getActivity().runOnUiThread(DeviceListFragment.this::updateList); - } - - }, 0, SyncthingService.GUI_UPDATE_INTERVAL); - } - @Override public void onPause() { super.onPause(); @@ -59,7 +46,14 @@ public class DeviceListFragment extends ListFragment implements SyncthingService if (currentState != SyncthingService.State.ACTIVE) return; - updateList(); + mTimer = new Timer(); + mTimer.schedule(new TimerTask() { + @Override + public void run() { + getActivity().runOnUiThread(DeviceListFragment.this::updateList); + } + + }, 0, SyncthingService.GUI_UPDATE_INTERVAL); } @Override diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/FolderListFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/FolderListFragment.java index 66b2f18d..a2f98675 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/FolderListFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/FolderListFragment.java @@ -43,19 +43,6 @@ public class FolderListFragment extends ListFragment implements SyncthingService private Timer mTimer; - @Override - public void onResume() { - super.onResume(); - mTimer = new Timer(); - mTimer.schedule(new TimerTask() { - @Override - public void run() { - getActivity().runOnUiThread(FolderListFragment.this::updateList); - } - - }, 0, SyncthingService.GUI_UPDATE_INTERVAL); - } - @Override public void onPause() { super.onPause(); @@ -67,7 +54,14 @@ public class FolderListFragment extends ListFragment implements SyncthingService if (currentState != SyncthingService.State.ACTIVE) return; - updateList(); + mTimer = new Timer(); + mTimer.schedule(new TimerTask() { + @Override + public void run() { + getActivity().runOnUiThread(FolderListFragment.this::updateList); + } + + }, 0, SyncthingService.GUI_UPDATE_INTERVAL); } @Override