Optimize updating All Apps Predictions.

* Prefetch existing predictions in onResume.
* Only update predictions if something has been changed.
* Swap predictions in place (if possible) -- this avoids
  having to relayout all of All Apps when just the predictions
  change.

Bug: 64126588
Bug: 63711551
Change-Id: Iffa0d9d7d6f99f606dd68b7df5893d6eba1574f5
This commit is contained in:
Jon Miranda
2017-07-28 10:09:34 -07:00
parent 1201982233
commit 7653a60c74
3 changed files with 69 additions and 17 deletions

View File

@@ -224,6 +224,8 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
mAppsRecyclerView.setLayoutManager(mLayoutManager);
mAppsRecyclerView.setAdapter(mAdapter);
mAppsRecyclerView.setHasFixedSize(true);
// Removes the animation that can occur when updating the predicted apps in place.
mAppsRecyclerView.getItemAnimator().setChangeDuration(0);
if (FeatureFlags.LAUNCHER3_PHYSICS) {
mAppsRecyclerView.setSpringAnimationHandler(mSpringAnimationHandler);
}