summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Lee <llee@cyngn.com>2015-09-30 17:56:15 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-10-01 10:20:36 -0700
commitb1f28ea34e66b59e281ec6b3f60d94485268b19e (patch)
tree73d545b524f0f3ec56296e42522e41c43a63a570
parentb5f1c45c02ef14443c88e50d1b0bffee76a75585 (diff)
downloadandroid_packages_apps_Trebuchet-b1f28ea34e66b59e281ec6b3f60d94485268b19e.tar.gz
android_packages_apps_Trebuchet-b1f28ea34e66b59e281ec6b3f60d94485268b19e.tar.bz2
android_packages_apps_Trebuchet-b1f28ea34e66b59e281ec6b3f60d94485268b19e.zip
Trebuchet: Use hardware layer for fading app drawer
* Apparently this isn't a hardware layer by default, so performance can be really bad on certain devices. REF: CYNGNOS-1169 Change-Id: I0acc9d4f9bfb5defba902edefced08e035377f28
-rw-r--r--src/com/android/launcher3/AppDrawerListAdapter.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/com/android/launcher3/AppDrawerListAdapter.java b/src/com/android/launcher3/AppDrawerListAdapter.java
index 50242c3e3..3639e11f4 100644
--- a/src/com/android/launcher3/AppDrawerListAdapter.java
+++ b/src/com/android/launcher3/AppDrawerListAdapter.java
@@ -257,16 +257,42 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap
.setUpdateListener(new ItemAnimator(holder, mItemAnimatorSet))
.setListener(new AnimatorListenerAdapter() {
@Override
+ public void onAnimationStart(Animator animation) {
+ animateStart(holder, animation);
+ }
+
+ @Override
public void onAnimationEnd(final Animator animation) {
animateEnd(holder, animation);
}
+
+ @Override
+ public void onAnimationCancel(final Animator animation) {
+ animateCancel(holder, animation);
+ }
})
.setDuration(ANIMATION_DURATION)
.start();
}
+ public void animateStart(ViewHolder holder, Animator animation) {
+ setLayerType(holder, View.LAYER_TYPE_HARDWARE);
+ }
+
public void animateEnd(ViewHolder holder, Animator animation) {
animate(holder, animation, 1f);
+ setLayerType(holder, View.LAYER_TYPE_NONE);
+ }
+
+ public void animateCancel(ViewHolder holder, Animator animation) {
+ animate(holder, animation, 1f);
+ setLayerType(holder, View.LAYER_TYPE_NONE);
+
+ }
+
+ private void setLayerType(ViewHolder holder, int layerType) {
+ holder.mFadingBackgroundBackView.setLayerType(layerType, null);
+ holder.mFadingBackgroundFrontView.setLayerType(layerType, null);
}
public void animate(ViewHolder holder, Animator animation) {