added support for dragging widgets and app icons to mini screens
- gave mini screens a rounded rect background
- mini screens change color when dragged over
- added a way to specify the active region of dragged items, to allow for clipping of whitespace at borders
- fixed: feedback while dragging was often one cell off
- fixed: bug when adding to almost-full screen
- removed unused classes
Change-Id: I2fbd2aaaee6831b288cca8dec75e7b446068e8d1
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index bae592c..41e76f0 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -39,6 +39,11 @@
private int mRegistrationX;
private int mRegistrationY;
+ private int mDragRegionLeft = 0;
+ private int mDragRegionTop = 0;
+ private int mDragRegionWidth;
+ private int mDragRegionHeight;
+
SymmetricalLinearTween mTween;
private float mScale;
private float mAnimationScale = 1.0f;
@@ -71,12 +76,37 @@
scale.setScale(scaleFactor, scaleFactor);
mBitmap = Bitmap.createBitmap(bitmap, left, top, width, height, scale, true);
+ mDragRegionWidth = width;
+ mDragRegionHeight = height;
// The point in our scaled bitmap that the touch events are located
mRegistrationX = registrationX + (DRAG_SCALE / 2);
mRegistrationY = registrationY + (DRAG_SCALE / 2);
}
+ public void setDragRegion(int left, int top, int width, int height) {
+ mDragRegionLeft = left;
+ mDragRegionTop = top;
+ mDragRegionWidth = width;
+ mDragRegionHeight = height;
+ }
+
+ public int getDragRegionLeft() {
+ return mDragRegionLeft;
+ }
+
+ public int getDragRegionTop() {
+ return mDragRegionTop;
+ }
+
+ public int getDragRegionWidth() {
+ return mDragRegionWidth;
+ }
+
+ public int getDragRegionHeight() {
+ return mDragRegionHeight;
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(mBitmap.getWidth(), mBitmap.getHeight());