diff options
author | Winson Chung <winsonc@google.com> | 2015-05-15 15:15:11 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2015-05-15 23:49:24 +0000 |
commit | 2d58471e8d3da621e209cec58a43d159778f8a0e (patch) | |
tree | b396a5d3d1e6fdb8eeeed977ede3ee283596f6e8 /src/com/android/launcher3/widget | |
parent | 2a1580ca7d24e4b5dbe815e831332d1dd1d3b392 (diff) | |
download | android_packages_apps_Trebuchet-2d58471e8d3da621e209cec58a43d159778f8a0e.tar.gz android_packages_apps_Trebuchet-2d58471e8d3da621e209cec58a43d159778f8a0e.tar.bz2 android_packages_apps_Trebuchet-2d58471e8d3da621e209cec58a43d159778f8a0e.zip |
Reducing calls to onCreateViewHolder due to animating children.
Bug 21133230
Change-Id: Ib5be0766d1ea56976195e33526d7595a16672eef
Diffstat (limited to 'src/com/android/launcher3/widget')
-rw-r--r-- | src/com/android/launcher3/widget/WidgetCell.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/widget/WidgetsListAdapter.java | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java index a34e71607..e3eb76c25 100644 --- a/src/com/android/launcher3/widget/WidgetCell.java +++ b/src/com/android/launcher3/widget/WidgetCell.java @@ -118,6 +118,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { if (DEBUG) { Log.d(TAG, "reset called on:" + mWidgetName.getText()); } + mWidgetImage.animate().cancel(); mWidgetImage.setImageDrawable(null); mWidgetName.setText(null); mWidgetDims.setText(null); diff --git a/src/com/android/launcher3/widget/WidgetsListAdapter.java b/src/com/android/launcher3/widget/WidgetsListAdapter.java index b8124d6e3..397d17799 100644 --- a/src/com/android/launcher3/widget/WidgetsListAdapter.java +++ b/src/com/android/launcher3/widget/WidgetsListAdapter.java @@ -186,6 +186,15 @@ public class WidgetsListAdapter extends Adapter<WidgetsRowViewHolder> { } @Override + public boolean onFailedToRecycleView(WidgetsRowViewHolder holder) { + // If child views are animating, then the RecyclerView may choose not to recycle the view, + // causing extraneous onCreateViewHolder() calls. It is safe in this case to continue + // recycling this view, and take care in onViewRecycled() to cancel any existing + // animations. + return true; + } + + @Override public long getItemId(int pos) { return pos; } |