From 4c3b2364453fb21dc3f3f8a70e1bcc64e500d83d Mon Sep 17 00:00:00 2001 From: Raj Yengisetty Date: Fri, 13 Feb 2015 11:54:58 -0800 Subject: Performance improvement for launch latency Change-Id: I8487f4e0a1a4a57f684454fd0492134602c01057 --- src/com/android/launcher3/BubbleTextView.java | 9 ++++++--- src/com/android/launcher3/FastBitmapDrawable.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index a368796bd..5bc17b674 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -51,6 +51,7 @@ public class BubbleTextView extends TextView { private HolographicOutlineHelper mOutlineHelper; private Bitmap mPressedBackground; + private boolean mUseFullClickAnimation = false; private float mSlop; @@ -109,6 +110,8 @@ public class BubbleTextView extends TextView { if (mCustomShadowsEnabled) { setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR); } + mUseFullClickAnimation = getResources().getBoolean( + R.bool.preferences_interface_general_app_icon_animation); } public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache, @@ -204,7 +207,7 @@ public class BubbleTextView extends TextView { // So that the pressed outline is visible immediately on setStayPressed(), // we pre-create it on ACTION_DOWN (it takes a small but perceptible amount of time // to create it) - if (mPressedBackground == null) { + if (mUseFullClickAnimation && mPressedBackground == null) { mPressedBackground = mOutlineHelper.createMediumDropShadow(this); } @@ -236,7 +239,7 @@ public class BubbleTextView extends TextView { } // Only show the shadow effect when persistent pressed state is set. - if (getParent() instanceof ShortcutAndWidgetContainer) { + if (mUseFullClickAnimation && getParent() instanceof ShortcutAndWidgetContainer) { CellLayout layout = (CellLayout) getParent().getParent(); layout.setPressedIcon(this, mPressedBackground, mOutlineHelper.shadowBitmapPadding); } @@ -253,7 +256,7 @@ public class BubbleTextView extends TextView { public boolean onKeyDown(int keyCode, KeyEvent event) { if (super.onKeyDown(keyCode, event)) { // Pre-create shadow so show immediately on click. - if (mPressedBackground == null) { + if (mUseFullClickAnimation && mPressedBackground == null) { mPressedBackground = mOutlineHelper.createMediumDropShadow(this); } return true; diff --git a/src/com/android/launcher3/FastBitmapDrawable.java b/src/com/android/launcher3/FastBitmapDrawable.java index d13f66a7c..e9c7a045a 100644 --- a/src/com/android/launcher3/FastBitmapDrawable.java +++ b/src/com/android/launcher3/FastBitmapDrawable.java @@ -47,7 +47,7 @@ class FastBitmapDrawable extends Drawable { } } }; - static final long CLICK_FEEDBACK_DURATION = 2000; + static final long CLICK_FEEDBACK_DURATION = 150; private static final int PRESSED_BRIGHTNESS = 100; private static ColorMatrix sGhostModeMatrix; -- cgit v1.2.3