1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 11:21:29 +00:00

Properly update device preferences (fixes #294).

This commit is contained in:
Lode Hoste 2015-03-24 20:48:53 +01:00
parent 771ff06345
commit 6151dd1d41

View file

@ -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)) {