Add the DefaultItemAnimator, without change animations

Change animations cause the addition of another view to be able to
crossfade/interpolate the two. Disabling change animations prevents us
losing the focus when a header row changes due to expanding or
collapsing.

Test: verified locally
Bug: 183378651
Change-Id: I07837b41748b5206936321c08d376069fa81b363
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index c09beb6..fb6ac0e 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -41,6 +41,7 @@
 
 import androidx.annotation.Nullable;
 import androidx.annotation.VisibleForTesting;
+import androidx.recyclerview.widget.DefaultItemAnimator;
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.launcher3.DeviceProfile;
@@ -677,6 +678,7 @@
 
         private final int mAdapterType;
         private final WidgetsListAdapter mWidgetsListAdapter;
+        private final DefaultItemAnimator mWidgetsListItemAnimator;
 
         private WidgetsRecyclerView mWidgetsRecyclerView;
 
@@ -703,13 +705,16 @@
                 default:
                     break;
             }
+            mWidgetsListItemAnimator = new DefaultItemAnimator();
+            // Disable change animations because it disrupts the item focus upon adapter item
+            // change.
+            mWidgetsListItemAnimator.setSupportsChangeAnimations(false);
         }
 
         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.setItemAnimator(mWidgetsListItemAnimator);
             mWidgetsRecyclerView.setHeaderViewDimensionsProvider(WidgetsFullSheet.this);
             mWidgetsRecyclerView.setEdgeEffectFactory(
                     ((TopRoundedCornerView) mContent).createEdgeEffectFactory());