Merge "A11y fix for all widgets tray (Part 2 / n)" into sc-dev

This commit is contained in:
Steven Ng 2021-03-22 10:22:54 +00:00 committed by Android (Google) Code Review
commit f3814eea2d
2 changed files with 7 additions and 1 deletions

View File

@ -577,6 +577,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
apps.getIconCache(),
/* iconClickListener= */ WidgetsFullSheet.this,
/* iconLongClickListener= */ WidgetsFullSheet.this);
mWidgetsListAdapter.setHasStableIds(true);
switch (mAdapterType) {
case PRIMARY:
mWidgetsListAdapter.setFilter(mPrimaryWidgetsFilter);
@ -592,6 +593,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet
void setup(WidgetsRecyclerView recyclerView) {
mWidgetsRecyclerView = recyclerView;
mWidgetsRecyclerView.setAdapter(mWidgetsListAdapter);
// Disables animation because it disrupts the item focus upon adapter item change.
mWidgetsRecyclerView.setItemAnimator(null);
mWidgetsRecyclerView.setHeaderViewDimensionsProvider(WidgetsFullSheet.this);
mWidgetsRecyclerView.setEdgeEffectFactory(
((TopRoundedCornerView) mContent).createEdgeEffectFactory());

View File

@ -43,6 +43,7 @@ import com.android.launcher3.widget.model.WidgetsListHeaderEntry;
import com.android.launcher3.widget.model.WidgetsListSearchHeaderEntry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.function.Predicate;
@ -216,7 +217,9 @@ public class WidgetsListAdapter extends Adapter<ViewHolder> implements OnHeaderC
@Override
public long getItemId(int pos) {
return pos;
return Arrays.hashCode(new Object[]{
mVisibleEntries.get(pos).mPkgItem.hashCode(),
getItemViewType(pos)});
}
@Override