Disable the defulat animation of the RecyclerView to avoid UI jank.

When users go to a sub page in Settings and come back to the homepage
again, those sticky cards flicker which makes the UI janky. This is
because we rebind sticky cards to ensure it's always up-to-date, where
the recyclerView has its default animation while notifyItemInserted(),
ane thus introduce the jank.

Fixes: 158627602
Test: Open Settings -> go to sub pages -> back to the homepage -> cards
are not flickering.

Change-Id: I2104dbe0bed8b2486c35521bcc0b5c8b54efb995
This commit is contained in:
Yi-Ling Chuang
2020-06-22 14:53:10 +08:00
parent 3f8d40bd95
commit b54f9b4921

View File

@@ -109,6 +109,7 @@ public class ContextualCardsFragment extends InstrumentedFragment implements
mCardsContainer.setLayoutManager(mLayoutManager); mCardsContainer.setLayoutManager(mLayoutManager);
mContextualCardsAdapter = new ContextualCardsAdapter(context, this /* lifecycleOwner */, mContextualCardsAdapter = new ContextualCardsAdapter(context, this /* lifecycleOwner */,
mContextualCardManager); mContextualCardManager);
mCardsContainer.setItemAnimator(null);
mCardsContainer.setAdapter(mContextualCardsAdapter); mCardsContainer.setAdapter(mContextualCardsAdapter);
mContextualCardManager.setListener(mContextualCardsAdapter); mContextualCardManager.setListener(mContextualCardsAdapter);
mCardsContainer.setListener(this); mCardsContainer.setListener(this);