Fix language settings UI

This commit is contained in:
topjohnwu 2018-06-03 11:50:12 +08:00
parent b2105f2d88
commit f2f7d77847
2 changed files with 5 additions and 10 deletions

View File

@ -201,13 +201,9 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
}
private void setLocalePreference(ListPreference lp) {
boolean isNew = lp == null;
if (isNew) {
lp = new ListPreference(getActivity());
}
CharSequence[] entries = new CharSequence[mm.locales.size() + 1];
CharSequence[] entryValues = new CharSequence[mm.locales.size() + 1];
entries[0] = getString(R.string.system_default);
entries[0] = Utils.getLocaleString(MagiskManager.defaultLocale, R.string.system_default);
entryValues[0] = "";
int i = 1;
for (Locale locale : mm.locales) {
@ -216,12 +212,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
}
lp.setEntries(entries);
lp.setEntryValues(entryValues);
lp.setTitle(R.string.language);
lp.setKey(Const.Key.LOCALE);
lp.setSummary(MagiskManager.locale.getDisplayName(MagiskManager.locale));
if (isNew) {
generalCatagory.addPreference(lp);
}
}
@Override

View File

@ -10,6 +10,10 @@
android:title="@string/settings_dark_theme_title"
android:summary="@string/settings_dark_theme_summary" />
<ListPreference
android:key="locale"
android:title="@string/language"/>
<Preference
android:key="clear"
android:title="@string/settings_clear_cache_title"