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

Commit a15af39f authored by Calvin Pan's avatar Calvin Pan
Browse files

Fix fetching incorrect items after filtering

Using parent view's adapter to prevent getting incorrect item after
filtering the list.

Bug: 227447626
Bug: 227289977
Bug: 227279371

Test: By manual
Change-Id: Ic7dde57cdc0dd44adf803317f836131d578f044b
(cherry picked from commit d3df5bdf)
parent 246a190e
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -264,10 +264,9 @@ public class LocalePickerWithRegion extends ListFragment implements SearchView.O
    }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        SuggestedLocaleAdapter adapter = (SuggestedLocaleAdapter) getListAdapter();
    public void onListItemClick(ListView parent, View v, int position, long id) {
        final LocaleStore.LocaleInfo locale =
                (LocaleStore.LocaleInfo) adapter.getItem(position);
                (LocaleStore.LocaleInfo) parent.getAdapter().getItem(position);
        // Special case for resetting the app locale to equal the system locale.
        boolean isSystemLocale = locale.isSystemLocale();
        boolean isRegionLocale = locale.getParent() != null;
@@ -280,7 +279,7 @@ public class LocalePickerWithRegion extends ListFragment implements SearchView.O
        } else {
            LocalePickerWithRegion selector = LocalePickerWithRegion.createCountryPicker(
                    getContext(), mListener, locale, mTranslatedOnly /* translate only */,
                    adapter.getAppPackageName());
                    mAppPackageName);
            if (selector != null) {
                getFragmentManager().beginTransaction()
                        .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
+0 −4
Original line number Diff line number Diff line
@@ -348,8 +348,4 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable {
    public Filter getFilter() {
        return new FilterByNativeAndUiNames();
    }

    public String getAppPackageName() {
        return mAppPackageName;
    }
}