From 588973e0ad8b66f8fa21cb61aa60506b9b88fbcb Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Sat, 12 Dec 2020 17:24:06 +0200 Subject: [PATCH] Rename Device related preferences and commit them. --- .../main/java/dev/nuculabs/nucuhub/domain/SettingValues.java | 3 ++- .../dev/nuculabs/nucuhub/ui/settings/SettingsFragment.java | 2 +- .../nucuhub/ui/settings/device/DeviceManagementDialog.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/domain/SettingValues.java b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/domain/SettingValues.java index 1b79cd6..7515aec 100644 --- a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/domain/SettingValues.java +++ b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/domain/SettingValues.java @@ -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"; } diff --git a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/SettingsFragment.java b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/SettingsFragment.java index 416e060..c804a88 100644 --- a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/SettingsFragment.java +++ b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/SettingsFragment.java @@ -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 savedEntries = sp.getStringSet(SettingValues.CURRENT_DEVICE_LIST, null); + Set savedEntries = sp.getStringSet(SettingValues.DEVICE_LIST, null); if (savedEntries != null) { CharSequence[] items = new CharSequence[savedEntries.size()]; int index = 0; diff --git a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/device/DeviceManagementDialog.java b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/device/DeviceManagementDialog.java index 799b099..042ce6a 100644 --- a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/device/DeviceManagementDialog.java +++ b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/device/DeviceManagementDialog.java @@ -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() {