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 d3df5bdf8436f320f1370922a52cf7d8e38d809b)
This commit is contained in:
parent
246a190e03
commit
a15af39f7f
@ -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)
|
||||
|
@ -348,8 +348,4 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable {
|
||||
public Filter getFilter() {
|
||||
return new FilterByNativeAndUiNames();
|
||||
}
|
||||
|
||||
public String getAppPackageName() {
|
||||
return mAppPackageName;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user