Rename Device related preferences and commit them.
This commit is contained in:
parent
3cd90abdc9
commit
588973e0ad
3 changed files with 5 additions and 3 deletions
|
@ -2,5 +2,6 @@ package dev.nuculabs.nucuhub.domain;
|
|||
|
||||
public class SettingValues {
|
||||
public static final String NAME = "settings";
|
||||
public static final String CURRENT_DEVICE_LIST = "current_device_list";
|
||||
public static final String DEVICE_LIST = "device_list";
|
||||
public static final String SELECTED_DEVICE = "selected_device";
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||
private void initializeDeviceListItems() {
|
||||
SharedPreferences sp = Objects.requireNonNull(getContext()).getSharedPreferences(SettingValues.NAME, Activity.MODE_PRIVATE);
|
||||
DeviceListPreference devicesList = findPreference(DEVICE_LIST_PREFERENCE);
|
||||
Set<String> savedEntries = sp.getStringSet(SettingValues.CURRENT_DEVICE_LIST, null);
|
||||
Set<String> savedEntries = sp.getStringSet(SettingValues.DEVICE_LIST, null);
|
||||
if (savedEntries != null) {
|
||||
CharSequence[] items = new CharSequence[savedEntries.size()];
|
||||
int index = 0;
|
||||
|
|
|
@ -96,7 +96,8 @@ public class DeviceManagementDialog extends Dialog {
|
|||
preference.setEntries(entries);
|
||||
|
||||
SharedPreferences.Editor spe = sharedPreferences.edit();
|
||||
spe.putStringSet(SettingValues.CURRENT_DEVICE_LIST, entriesSet);
|
||||
spe.putStringSet(SettingValues.DEVICE_LIST, entriesSet);
|
||||
spe.commit();
|
||||
}
|
||||
|
||||
private void setupToolbar() {
|
||||
|
|
Loading…
Reference in a new issue