diff options
author | Michael Jurka <mikejurka@google.com> | 2012-06-29 15:17:04 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2012-06-29 15:17:04 -0700 |
commit | ca99383daef92fed673de22126875cb485be494f (patch) | |
tree | 8c2e34a77c6882784cfd2eb849a85e7d29dded3f /src/com/android/launcher2/DragView.java | |
parent | 3e34d58abb6dca58ac1aeb479d41c2c9d3865856 (diff) | |
download | android_packages_apps_Trebuchet-ca99383daef92fed673de22126875cb485be494f.tar.gz android_packages_apps_Trebuchet-ca99383daef92fed673de22126875cb485be494f.tar.bz2 android_packages_apps_Trebuchet-ca99383daef92fed673de22126875cb485be494f.zip |
Disable hardware layers for drag views
Also, avoiding allocating paint object every time we swipe
Diffstat (limited to 'src/com/android/launcher2/DragView.java')
-rw-r--r-- | src/com/android/launcher2/DragView.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java index d7ac97d07..389421d52 100644 --- a/src/com/android/launcher2/DragView.java +++ b/src/com/android/launcher2/DragView.java @@ -244,9 +244,6 @@ public class DragView extends View { public void show(int touchX, int touchY) { mDragLayer.addView(this); - // Enable hw-layers on this view - setLayerType(View.LAYER_TYPE_HARDWARE, null); - // Start the pick-up animation DragLayer.LayoutParams lp = new DragLayer.LayoutParams(0, 0); lp.width = mBitmap.getWidth(); @@ -255,7 +252,12 @@ public class DragView extends View { setLayoutParams(lp); setTranslationX(touchX - mRegistrationX); setTranslationY(touchY - mRegistrationY); - mAnim.start(); + // Post the animation to skip other expensive work happening on the first frame + post(new Runnable() { + public void run() { + mAnim.start(); + } + }); } public void cancelAnimation() { @@ -282,9 +284,6 @@ public class DragView extends View { void remove() { if (getParent() != null) { - // Disable hw-layers on this view - setLayerType(View.LAYER_TYPE_NONE, null); - mDragLayer.removeView(DragView.this); } } |