Small refactoring. Used existed method ApplicationMode.valueOfStringKey
This commit is contained in:
parent
b29d720c54
commit
d25c32404a
1 changed files with 1 additions and 11 deletions
|
@ -79,8 +79,7 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
|||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String key = preference.getKey();
|
||||
ApplicationMode applicationMode = getAppMode(key);
|
||||
ApplicationMode applicationMode = ApplicationMode.valueOfStringKey(preference.getKey(), null);
|
||||
if (applicationMode != null) {
|
||||
if (newValue instanceof Boolean) {
|
||||
boolean isChecked = (Boolean) newValue;
|
||||
|
@ -91,15 +90,6 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
|||
return super.onPreferenceChange(preference, newValue);
|
||||
}
|
||||
|
||||
ApplicationMode getAppMode(String key) {
|
||||
for (ApplicationMode applicationMode : allAppModes) {
|
||||
if (applicationMode.getStringKey().equals(key)) {
|
||||
return applicationMode;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setupConfigureProfilePref() {
|
||||
ApplicationMode selectedMode = app.getSettings().APPLICATION_MODE.get();
|
||||
String title = selectedMode.toHumanString(getContext());
|
||||
|
|
Loading…
Reference in a new issue