Cleanup SettingsFragment
@@ -66,24 +66,27 @@ public class SettingsFragment extends PreferenceFragment {
// Set the summary to reflect the new value.
preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null);
+ } else if(!(preference instanceof CheckBoxPreference)) {
+ // For all other preferences, set the summary to the value's
+ // simple string representation.
+ preference.setSummary(stringValue);
+ }
- if(finishedLoadingPrefs && preference.getKey().equals("theme")) {
+ if(finishedLoadingPrefs) {
+ switch(preference.getKey()) {
+ case "theme":
// Restart MainActivity
Intent intent = new Intent(getActivity(), MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("theme_change", true);
startActivity(intent);
getActivity().overridePendingTransition(0, 0);
+ break;
}
- } else if(!(preference instanceof CheckBoxPreference)) {
- // For all other preferences, set the summary to the value's
- // simple string representation.
- preference.setSummary(stringValue);
+ U.restartTaskbar(getActivity());
}
- if(finishedLoadingPrefs) U.restartTaskbar(getActivity());
-
return true;
}
};
