make new instances of LocalRepoActivity show state properly
LocalRepoActivity needs to get the current state of the LocalRepoService so it can correctly represent it in the UI. fixes #25 https://gitlab.com/fdroid/fdroidclient/issues/25
This commit is contained in:
parent
776ad3f540
commit
09cbd036fa
@ -327,4 +327,8 @@ public class FDroidApp extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isLocalRepoServiceRunnig() {
|
||||||
|
return localRepoServiceIsBound;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ public class LocalRepoActivity extends Activity {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
resetNetworkInfo();
|
resetNetworkInfo();
|
||||||
|
setRepoSwitchChecked(FDroidApp.isLocalRepoServiceRunnig());
|
||||||
|
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(onWifiChange,
|
LocalBroadcastManager.getInstance(this).registerReceiver(onWifiChange,
|
||||||
new IntentFilter(WifiStateChangeService.BROADCAST));
|
new IntentFilter(WifiStateChangeService.BROADCAST));
|
||||||
@ -71,6 +72,9 @@ public class LocalRepoActivity extends Activity {
|
|||||||
|
|
||||||
// start repo by default
|
// start repo by default
|
||||||
FDroidApp.startLocalRepoService(LocalRepoActivity.this);
|
FDroidApp.startLocalRepoService(LocalRepoActivity.this);
|
||||||
|
// reset the timer if viewing this Activity again
|
||||||
|
if (stopTimer != null)
|
||||||
|
stopTimer.cancel();
|
||||||
// automatically turn off after 15 minutes
|
// automatically turn off after 15 minutes
|
||||||
stopTimer = new Timer();
|
stopTimer = new Timer();
|
||||||
stopTimer.schedule(new TimerTask() {
|
stopTimer.schedule(new TimerTask() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user