Prevent changing to a theme if it's already set

This may resolve issues with some devices reloading when attempting to enter settings.
This commit is contained in:
Ender's Games 2018-09-30 00:08:37 -04:00
parent 24504bc22e
commit e392d4702c
1 changed files with 5 additions and 2 deletions

View File

@ -197,12 +197,15 @@ public class OptionsFragment extends Fragment {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
String theme = String.valueOf(parentView.getItemAtPosition(position));
int current = mPrefs.getInt(Config.pref_app_theme, 0);
if (theme.equals("Dream")) {
mPrefs.edit().putInt(Config.pref_app_theme, 7).apply();
mCallback.recreateActivity();
if (current != 7)
mCallback.recreateActivity();
} else {
mPrefs.edit().putInt(Config.pref_app_theme, position).apply();
mCallback.recreateActivity();
if (current != position)
mCallback.recreateActivity();
}
}
@Override