1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-27 06:41:15 +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.DeviceID = "";
mDevice.Addresses = "dynamic"; mDevice.Addresses = "dynamic";
mDevice.Compression = "always"; mDevice.Compression = "always";
mDevice.Introducer = false;
((EditTextPreference) mDeviceId).setText(mDevice.DeviceID); ((EditTextPreference) mDeviceId).setText(mDevice.DeviceID);
} }
} }
@ -163,6 +164,7 @@ public class DeviceSettingsFragment extends PreferenceFragment implements
mAddresses.setSummary(mDevice.Addresses); mAddresses.setSummary(mDevice.Addresses);
mCompression.setValue(mDevice.Compression); mCompression.setValue(mDevice.Compression);
mCompression.setSummary(mDevice.Compression); mCompression.setSummary(mDevice.Compression);
mIntroducer.setChecked(mDevice.Introducer);
} }
@Override @Override
@ -223,6 +225,14 @@ public class DeviceSettingsFragment extends PreferenceFragment implements
EditTextPreference pref = (EditTextPreference) preference; EditTextPreference pref = (EditTextPreference) preference;
pref.setSummary((String) o); 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)) { if (preference.equals(mDeviceId)) {
mDevice.DeviceID = (String) o; mDevice.DeviceID = (String) o;
deviceUpdated(); deviceUpdated();
@ -237,7 +247,6 @@ public class DeviceSettingsFragment extends PreferenceFragment implements
return true; return true;
} else if (preference.equals(mCompression)) { } else if (preference.equals(mCompression)) {
mDevice.Compression = (String) o; mDevice.Compression = (String) o;
preference.setSummary(mDevice.Compression);
deviceUpdated(); deviceUpdated();
return true; return true;
} else if (preference.equals(mIntroducer)) { } else if (preference.equals(mIntroducer)) {