From b54f9b4921547ea931ad1c939a6220279daa34c8 Mon Sep 17 00:00:00 2001 From: Yi-Ling Chuang Date: Mon, 22 Jun 2020 14:53:10 +0800 Subject: [PATCH] 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 --- .../homepage/contextualcards/ContextualCardsFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardsFragment.java b/src/com/android/settings/homepage/contextualcards/ContextualCardsFragment.java index ebfaca9544e..9f0023aa15c 100644 --- a/src/com/android/settings/homepage/contextualcards/ContextualCardsFragment.java +++ b/src/com/android/settings/homepage/contextualcards/ContextualCardsFragment.java @@ -109,6 +109,7 @@ public class ContextualCardsFragment extends InstrumentedFragment implements mCardsContainer.setLayoutManager(mLayoutManager); mContextualCardsAdapter = new ContextualCardsAdapter(context, this /* lifecycleOwner */, mContextualCardManager); + mCardsContainer.setItemAnimator(null); mCardsContainer.setAdapter(mContextualCardsAdapter); mContextualCardManager.setListener(mContextualCardsAdapter); mCardsContainer.setListener(this);