Browse Source

Reload settings in main settings screen on returning to the screen.

pull/11/head
Eric Kok 12 years ago
parent
commit
bbb0880a7e
  1. 18
      core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java

18
core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java

@ -41,6 +41,17 @@ public class MainSettingsActivity extends SherlockPreferenceActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(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 // Load the preference menu and attack actions
addPreferencesFromResource(R.xml.pref_main); addPreferencesFromResource(R.xml.pref_main);
findPreference("header_addserver").setOnPreferenceClickListener(onAddServer); findPreference("header_addserver").setOnPreferenceClickListener(onAddServer);
@ -49,6 +60,13 @@ public class MainSettingsActivity extends SherlockPreferenceActivity {
findPreference("header_background").setOnPreferenceClickListener(onBackgroundSettings); findPreference("header_background").setOnPreferenceClickListener(onBackgroundSettings);
findPreference("header_system").setOnPreferenceClickListener(onSystemSettings); findPreference("header_system").setOnPreferenceClickListener(onSystemSettings);
loadSettings();
}
@SuppressWarnings("deprecation")
private void loadSettings() {
// Add existing servers // Add existing servers
List<ServerSetting> servers = applicationSettings.getServerSettings(); List<ServerSetting> servers = applicationSettings.getServerSettings();
for (ServerSetting serverSetting : servers) { for (ServerSetting serverSetting : servers) {

Loading…
Cancel
Save