Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0c63aef authored by Zoey Chen's avatar Zoey Chen
Browse files

[Settings] Do not show the locale which is added already

Bug: 414756374
Test: manual
Flag: EXEMPT bugfix
Change-Id: I9bd53c1dc863ecd53e9dc6a4529a3506302f9b67
parent a8eb9bc4
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ public abstract class LocalePickerBaseListPreferenceController extends
    private Set<LocaleStore.LocaleInfo> mLocaleList;
    private List<LocaleStore.LocaleInfo> mLocaleOptions;
    private Map<String, Preference> mPreferences;
    private String mPackageName;
    private FragmentManager mFragmentManager;
    private boolean mIsCountryMode;
    @Nullable
@@ -174,6 +173,9 @@ public abstract class LocalePickerBaseListPreferenceController extends
                    mContext.getString(R.string.all_supported_numbering_system_title));
        }

        // Remove the locale which is added into system language's list already.
        List<LocaleStore.LocaleInfo> localeList = getUserLocaleList();
        localeInfoList.removeIf(localeInfo -> localeList.contains(localeInfo));
        localeInfoList.stream().forEach(locale ->
        {
            Preference pref = existingPreferences.remove(locale.getId());
@@ -213,10 +215,6 @@ public abstract class LocalePickerBaseListPreferenceController extends
    @Nullable
    protected abstract LocaleList getExplicitLocaleList();

    protected String getPackageName() {
        return mPackageName;
    }

    protected List<LocaleStore.LocaleInfo> getSuggestedLocaleList() {
        setupLocaleList();
        if (mLocaleList != null && !mLocaleList.isEmpty()) {