From bbb0880a7e43270ba1f2e1a80e63fcbbf57c42f2 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Tue, 19 Mar 2013 13:51:13 +0100 Subject: [PATCH] Reload settings in main settings screen on returning to the screen. --- .../gui/settings/MainSettingsActivity.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java b/core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java index 0c7b97d1..7abf5e11 100644 --- a/core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java +++ b/core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java @@ -41,6 +41,17 @@ public class MainSettingsActivity extends SherlockPreferenceActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // Note: Settings are loaded in onResume() + + } + + @Override + protected void onResume() { + super.onResume(); + + if (getPreferenceScreen() != null) + getPreferenceScreen().removeAll(); + // Load the preference menu and attack actions addPreferencesFromResource(R.xml.pref_main); findPreference("header_addserver").setOnPreferenceClickListener(onAddServer); @@ -49,6 +60,13 @@ public class MainSettingsActivity extends SherlockPreferenceActivity { findPreference("header_background").setOnPreferenceClickListener(onBackgroundSettings); findPreference("header_system").setOnPreferenceClickListener(onSystemSettings); + loadSettings(); + + } + + @SuppressWarnings("deprecation") + private void loadSettings() { + // Add existing servers List servers = applicationSettings.getServerSettings(); for (ServerSetting serverSetting : servers) { @@ -90,7 +108,7 @@ public class MainSettingsActivity extends SherlockPreferenceActivity { // Supply the Preference list names and values setSite.setEntries(siteNames.toArray(new String[siteNames.size()])); setSite.setEntryValues(siteValues.toArray(new String[siteValues.size()])); - + } @Override