Fix locale settings duplicate

This commit is contained in:
topjohnwu 2017-07-24 18:37:13 +08:00
parent 58acc75cf6
commit 0275a8558d

View File

@ -127,6 +127,7 @@ public class SettingsActivity extends Activity {
private ListPreference setLocalePreference(ListPreference lp) { private ListPreference setLocalePreference(ListPreference lp) {
if (lp == null) { if (lp == null) {
lp = new ListPreference(getActivity()); lp = new ListPreference(getActivity());
generalCatagory.addPreference(lp);
} }
CharSequence[] entries = new CharSequence[magiskManager.locales.size() + 1]; CharSequence[] entries = new CharSequence[magiskManager.locales.size() + 1];
CharSequence[] entryValues = new CharSequence[magiskManager.locales.size() + 1]; CharSequence[] entryValues = new CharSequence[magiskManager.locales.size() + 1];
@ -255,12 +256,11 @@ public class SettingsActivity extends Activity {
@Override @Override
public void onTrigger(CallbackEvent event) { public void onTrigger(CallbackEvent event) {
ListPreference language = setLocalePreference(null); ListPreference language = setLocalePreference((ListPreference) findPreference("locale"));
language.setOnPreferenceClickListener((pref) -> { language.setOnPreferenceClickListener((pref) -> {
setLocalePreference((ListPreference) pref); setLocalePreference((ListPreference) pref);
return false; return false;
}); });
generalCatagory.addPreference(language);
} }
@Override @Override