[Settings] Show intro preference in numbering system as well

Bug: 377664066
Test: manual
Flag: EXEMPT refactor
Change-Id: I63cbaaa1e9fa3f3530cb05b1a62020bf8f54d1ac
This commit is contained in:
Zoey Chen
2025-01-16 08:50:02 +00:00
parent cc0c66a7ee
commit 41a7b5ee9b
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>
<!-- 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="top_intro_numbering_system_title">The digits used will be dependent on the numbering system</string>
<!-- Regional Preferences begin -->
<!-- The title of the menu entry of regional preferences. [CHAR LIMIT=50] -->

View File

@@ -22,8 +22,7 @@
<com.android.settingslib.widget.TopIntroPreference
android:key="top_intro_region"
android:title="@string/top_intro_region_title"
settings:isPreferenceVisible="false"/>
android:title="@string/top_intro_region_title"/>
<PreferenceCategory
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.RegionAndNumberingSystemPickerFragment.EXTRA_IS_NUMBERING_SYSTEM;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.LocaleList;
@@ -178,7 +179,9 @@ public abstract class LocalePickerBaseListPreferenceController extends
pref.setTitle(localeName);
pref.setKey(locale.toString());
pref.setOnPreferenceClickListener(clickedPref -> {
// TODO: b/390347399 - Should pop up a dialog when changes the region.
switchFragment(locale);
((Activity) mContext).finish();
return true;
});
mPreferences.put(locale.getId(), pref);

View File

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

View File

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