diff options
author | Adam Cohen <adamcohen@google.com> | 2010-12-08 11:05:37 -0800 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2010-12-08 22:49:08 -0800 |
commit | 120980bd00f5eecec5717f49a3d7db96571025a9 (patch) | |
tree | 5d1e2972323600cdcfe63b9abe83d0334bad4246 /src/com/android/launcher2/DragLayer.java | |
parent | b5a2b2fff353a68e3f8f7e57a830a0f27724fc5f (diff) | |
download | android_packages_apps_Trebuchet-120980bd00f5eecec5717f49a3d7db96571025a9.tar.gz android_packages_apps_Trebuchet-120980bd00f5eecec5717f49a3d7db96571025a9.tar.bz2 android_packages_apps_Trebuchet-120980bd00f5eecec5717f49a3d7db96571025a9.zip |
Adding animations to Customize drawer
-When you tap to add in customize drawer the widgets
/ app shortcuts now animate to the mini screens
Change-Id: I0a5b5ae561fda3fbbf902003273477a5ed7ca5cc
Diffstat (limited to 'src/com/android/launcher2/DragLayer.java')
-rw-r--r-- | src/com/android/launcher2/DragLayer.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java index ab71670a2..b418a793f 100644 --- a/src/com/android/launcher2/DragLayer.java +++ b/src/com/android/launcher2/DragLayer.java @@ -17,17 +17,20 @@ package com.android.launcher2; import android.content.Context; +import android.graphics.Bitmap; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; +import android.widget.ImageView; /** * A ViewGroup that coordinates dragging across its descendants */ public class DragLayer extends FrameLayout { - DragController mDragController; + private DragController mDragController; + private int[] mTmpXY = new int[2]; /** * Used to create a new DragLayer from XML. @@ -62,4 +65,19 @@ public class DragLayer extends FrameLayout { public boolean dispatchUnhandledMove(View focused, int direction) { return mDragController.dispatchUnhandledMove(focused, direction); } + + public View createDragView(Bitmap b, int xPos, int yPos) { + ImageView imageView = new ImageView(mContext); + imageView.setImageBitmap(b); + imageView.setX(xPos); + imageView.setY(yPos); + addView(imageView, b.getWidth(), b.getHeight()); + + return imageView; + } + + public View createDragView(View v) { + v.getLocationOnScreen(mTmpXY); + return createDragView(mDragController.getViewBitmap(v), mTmpXY[0], mTmpXY[1]); + } } |