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
|
||||
public void onApiChange(SyncthingService.State currentState) {
|
||||
boolean enabled = currentState == SyncthingService.State.ACTIVE;
|
||||
if (!enabled || !mSyncthingService.getApi().isConfigLoaded()) {
|
||||
PreferenceScreen ps = getPreferenceScreen();
|
||||
for (int i = 0; i < ps.getPreferenceCount(); i++) {
|
||||
Preference p = ps.getPreference(i);
|
||||
p.setEnabled("category_run_conditions".equals(p.getKey()));
|
||||
}
|
||||
return;
|
||||
boolean syncthingActive = currentState == SyncthingService.State.ACTIVE;
|
||||
boolean enableAllPrefs = syncthingActive && mSyncthingService.getApi().isConfigLoaded();
|
||||
PreferenceScreen ps = getPreferenceScreen();
|
||||
for (int i = 0; i < ps.getPreferenceCount(); i++) {
|
||||
Preference p = ps.getPreference(i);
|
||||
p.setEnabled(enableAllPrefs || "category_run_conditions".equals(p.getKey()));
|
||||
}
|
||||
|
||||
if (!enableAllPrefs)
|
||||
return;
|
||||
|
||||
mApi = mSyncthingService.getApi();
|
||||
mSyncthingVersion.setSummary(mApi.getVersion());
|
||||
mOptions = mApi.getOptions();
|
||||
|
|
Loading…
Reference in a new issue