mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-26 22:31:16 +00:00
Fixed settings not being enabled after restart
This commit is contained in:
parent
2ecca8f1bd
commit
a3c30f4ac6
1 changed files with 9 additions and 8 deletions
|
@ -157,16 +157,17 @@ public class SettingsFragment extends PreferenceFragment
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApiChange(SyncthingService.State currentState) {
|
public void onApiChange(SyncthingService.State currentState) {
|
||||||
boolean enabled = currentState == SyncthingService.State.ACTIVE;
|
boolean syncthingActive = currentState == SyncthingService.State.ACTIVE;
|
||||||
if (!enabled || !mSyncthingService.getApi().isConfigLoaded()) {
|
boolean enableAllPrefs = syncthingActive && mSyncthingService.getApi().isConfigLoaded();
|
||||||
PreferenceScreen ps = getPreferenceScreen();
|
PreferenceScreen ps = getPreferenceScreen();
|
||||||
for (int i = 0; i < ps.getPreferenceCount(); i++) {
|
for (int i = 0; i < ps.getPreferenceCount(); i++) {
|
||||||
Preference p = ps.getPreference(i);
|
Preference p = ps.getPreference(i);
|
||||||
p.setEnabled("category_run_conditions".equals(p.getKey()));
|
p.setEnabled(enableAllPrefs || "category_run_conditions".equals(p.getKey()));
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!enableAllPrefs)
|
||||||
|
return;
|
||||||
|
|
||||||
mApi = mSyncthingService.getApi();
|
mApi = mSyncthingService.getApi();
|
||||||
mSyncthingVersion.setSummary(mApi.getVersion());
|
mSyncthingVersion.setSummary(mApi.getVersion());
|
||||||
mOptions = mApi.getOptions();
|
mOptions = mApi.getOptions();
|
||||||
|
|
Loading…
Reference in a new issue