diff options
author | Linus Lee <llee@cyngn.com> | 2015-09-30 17:56:15 -0700 |
---|---|---|
committer | Ethan Chen <intervigil@gmail.com> | 2015-10-01 10:34:15 -0700 |
commit | cdc30217d3732ad42d4a2167a8d8255967e35f99 (patch) | |
tree | f3a9fa5d34b395ed4edb5d542a536ce9f32c7194 | |
parent | bbd12132cb567e06dfbe8639ad66f9ffeec3e54d (diff) | |
download | android_packages_apps_Trebuchet-cdc30217d3732ad42d4a2167a8d8255967e35f99.tar.gz android_packages_apps_Trebuchet-cdc30217d3732ad42d4a2167a8d8255967e35f99.tar.bz2 android_packages_apps_Trebuchet-cdc30217d3732ad42d4a2167a8d8255967e35f99.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
(cherry picked from commit b1f28ea34e66b59e281ec6b3f60d94485268b19e)
-rw-r--r-- | src/com/android/launcher3/AppDrawerListAdapter.java | 26 |
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) { |