diff --git a/src/org/fdroid/fdroid/FDroidApp.java b/src/org/fdroid/fdroid/FDroidApp.java index 1e120dd97..c344db3c5 100644 --- a/src/org/fdroid/fdroid/FDroidApp.java +++ b/src/org/fdroid/fdroid/FDroidApp.java @@ -327,4 +327,8 @@ public class FDroidApp extends Application { } } } + + public static boolean isLocalRepoServiceRunnig() { + return localRepoServiceIsBound; + } } diff --git a/src/org/fdroid/fdroid/views/LocalRepoActivity.java b/src/org/fdroid/fdroid/views/LocalRepoActivity.java index aaf7695d0..b7d4e3f21 100644 --- a/src/org/fdroid/fdroid/views/LocalRepoActivity.java +++ b/src/org/fdroid/fdroid/views/LocalRepoActivity.java @@ -58,6 +58,7 @@ public class LocalRepoActivity extends Activity { public void onResume() { super.onResume(); resetNetworkInfo(); + setRepoSwitchChecked(FDroidApp.isLocalRepoServiceRunnig()); LocalBroadcastManager.getInstance(this).registerReceiver(onWifiChange, new IntentFilter(WifiStateChangeService.BROADCAST)); @@ -71,6 +72,9 @@ public class LocalRepoActivity extends Activity { // start repo by default FDroidApp.startLocalRepoService(LocalRepoActivity.this); + // reset the timer if viewing this Activity again + if (stopTimer != null) + stopTimer.cancel(); // automatically turn off after 15 minutes stopTimer = new Timer(); stopTimer.schedule(new TimerTask() {