mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-23 12:51:16 +00:00
Properly update device preferences (fixes #294).
This commit is contained in:
parent
771ff06345
commit
6151dd1d41
1 changed files with 10 additions and 1 deletions
|
@ -103,6 +103,7 @@ public class DeviceSettingsFragment extends PreferenceFragment implements
|
|||
mDevice.DeviceID = "";
|
||||
mDevice.Addresses = "dynamic";
|
||||
mDevice.Compression = "always";
|
||||
mDevice.Introducer = false;
|
||||
((EditTextPreference) mDeviceId).setText(mDevice.DeviceID);
|
||||
}
|
||||
}
|
||||
|
@ -163,6 +164,7 @@ public class DeviceSettingsFragment extends PreferenceFragment implements
|
|||
mAddresses.setSummary(mDevice.Addresses);
|
||||
mCompression.setValue(mDevice.Compression);
|
||||
mCompression.setSummary(mDevice.Compression);
|
||||
mIntroducer.setChecked(mDevice.Introducer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -223,6 +225,14 @@ public class DeviceSettingsFragment extends PreferenceFragment implements
|
|||
EditTextPreference pref = (EditTextPreference) preference;
|
||||
pref.setSummary((String) o);
|
||||
}
|
||||
if (preference instanceof CheckBoxPreference) {
|
||||
CheckBoxPreference pref = (CheckBoxPreference) preference;
|
||||
pref.setChecked((Boolean) o);
|
||||
}
|
||||
if (preference instanceof ListPreference) {
|
||||
ListPreference pref = (ListPreference) preference;
|
||||
pref.setSummary((String) o);
|
||||
}
|
||||
if (preference.equals(mDeviceId)) {
|
||||
mDevice.DeviceID = (String) o;
|
||||
deviceUpdated();
|
||||
|
@ -237,7 +247,6 @@ public class DeviceSettingsFragment extends PreferenceFragment implements
|
|||
return true;
|
||||
} else if (preference.equals(mCompression)) {
|
||||
mDevice.Compression = (String) o;
|
||||
preference.setSummary(mDevice.Compression);
|
||||
deviceUpdated();
|
||||
return true;
|
||||
} else if (preference.equals(mIntroducer)) {
|
||||
|
|
Loading…
Reference in a new issue