Merge "[Settings] Show intro preference in numbering system as well" into main

This commit is contained in:
Zoey Chen
2025-01-19 21:17:08 -08:00
committed by Android (Google) Code Review
5 changed files with 19 additions and 9 deletions

View File

@@ -531,6 +531,7 @@
<string name="title_change_system_locale_region">Change region to %s ?</string> <string name="title_change_system_locale_region">Change region to %s ?</string>
<!-- Message for asking to change system locale region or not. [CHAR LIMIT=50]--> <!-- Message for asking to change system locale region or not. [CHAR LIMIT=50]-->
<string name="body_change_system_locale_region">Your device will keep %s as a system language</string> <string name="body_change_system_locale_region">Your device will keep %s as a system language</string>
<string name="top_intro_numbering_system_title">The digits used will be dependent on the numbering system</string>
<!-- Regional Preferences begin --> <!-- Regional Preferences begin -->
<!-- The title of the menu entry of regional preferences. [CHAR LIMIT=50] --> <!-- The title of the menu entry of regional preferences. [CHAR LIMIT=50] -->

View File

@@ -22,8 +22,7 @@
<com.android.settingslib.widget.TopIntroPreference <com.android.settingslib.widget.TopIntroPreference
android:key="top_intro_region" android:key="top_intro_region"
android:title="@string/top_intro_region_title" android:title="@string/top_intro_region_title"/>
settings:isPreferenceVisible="false"/>
<PreferenceCategory <PreferenceCategory
android:key="system_language_suggested_category" android:key="system_language_suggested_category"

View File

@@ -19,6 +19,7 @@ package com.android.settings.localepicker;
import static com.android.settings.localepicker.LocaleListEditor.EXTRA_RESULT_LOCALE; import static com.android.settings.localepicker.LocaleListEditor.EXTRA_RESULT_LOCALE;
import static com.android.settings.localepicker.RegionAndNumberingSystemPickerFragment.EXTRA_IS_NUMBERING_SYSTEM; import static com.android.settings.localepicker.RegionAndNumberingSystemPickerFragment.EXTRA_IS_NUMBERING_SYSTEM;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.os.LocaleList; import android.os.LocaleList;
@@ -178,7 +179,9 @@ public abstract class LocalePickerBaseListPreferenceController extends
pref.setTitle(localeName); pref.setTitle(localeName);
pref.setKey(locale.toString()); pref.setKey(locale.toString());
pref.setOnPreferenceClickListener(clickedPref -> { pref.setOnPreferenceClickListener(clickedPref -> {
// TODO: b/390347399 - Should pop up a dialog when changes the region.
switchFragment(locale); switchFragment(locale);
((Activity) mContext).finish();
return true; return true;
}); });
mPreferences.put(locale.getId(), pref); mPreferences.put(locale.getId(), pref);

View File

@@ -116,8 +116,8 @@ public class RegionAndNumberingSystemPickerFragment extends DashboardFragment im
} }
TopIntroPreference topIntroPreference = findPreference(KEY_TOP_INTRO_PREFERENCE); TopIntroPreference topIntroPreference = findPreference(KEY_TOP_INTRO_PREFERENCE);
if (topIntroPreference != null) { if (topIntroPreference != null && mIsNumberingMode) {
topIntroPreference.setVisible(!mIsNumberingMode); topIntroPreference.setTitle(R.string.top_intro_numbering_system_title);
} }
if (mSystemLocaleAllListPreferenceController != null) { if (mSystemLocaleAllListPreferenceController != null) {

View File

@@ -47,6 +47,7 @@ import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.widget.TopIntroPreference;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
@@ -71,14 +72,13 @@ public class SystemLocalePickerFragment extends DashboardFragment implements
private static final String KEY_PREFERENCE_SYSTEM_LOCALE_LIST = "system_locale_list"; private static final String KEY_PREFERENCE_SYSTEM_LOCALE_LIST = "system_locale_list";
private static final String KEY_PREFERENCE_SYSTEM_LOCALE_SUGGESTED_LIST = private static final String KEY_PREFERENCE_SYSTEM_LOCALE_SUGGESTED_LIST =
"system_locale_suggested_list"; "system_locale_suggested_list";
private static final String KEY_TOP_INTRO_PREFERENCE = "top_intro_region";
@Nullable @Nullable
private SearchView mSearchView = null; private SearchView mSearchView = null;
@Nullable @Nullable
private SearchFilter mSearchFilter = null; private SearchFilter mSearchFilter = null;
@Nullable @Nullable
private Set<LocaleStore.LocaleInfo> mLocaleList;
@Nullable
private List<LocaleStore.LocaleInfo> mLocaleOptions; private List<LocaleStore.LocaleInfo> mLocaleOptions;
@Nullable @Nullable
private List<LocaleStore.LocaleInfo> mOriginalLocaleInfos; private List<LocaleStore.LocaleInfo> mOriginalLocaleInfos;
@@ -106,8 +106,15 @@ public class SystemLocalePickerFragment extends DashboardFragment implements
} }
SystemLocaleCollector systemLocaleCollector = new SystemLocaleCollector(getContext(), null); SystemLocaleCollector systemLocaleCollector = new SystemLocaleCollector(getContext(), null);
mLocaleList = systemLocaleCollector.getSupportedLocaleList(null, false, false); Set<LocaleStore.LocaleInfo> localeList = systemLocaleCollector.getSupportedLocaleList(null,
mLocaleOptions = new ArrayList<>(mLocaleList.size()); false, false);
mLocaleOptions = new ArrayList<>(localeList.size());
TopIntroPreference topIntroPreference = findPreference(KEY_TOP_INTRO_PREFERENCE);
if (topIntroPreference != null) {
topIntroPreference.setVisible(false);
}
} }
@Override @Override
@@ -175,7 +182,7 @@ public class SystemLocalePickerFragment extends DashboardFragment implements
FilterResults results = new FilterResults(); FilterResults results = new FilterResults();
if (mOriginalLocaleInfos == null) { if (mOriginalLocaleInfos == null) {
mOriginalLocaleInfos = new ArrayList<>(mLocaleList); mOriginalLocaleInfos = new ArrayList<>(mLocaleOptions);
} }
if (TextUtils.isEmpty(prefix)) { if (TextUtils.isEmpty(prefix)) {