summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/DragView.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-04-15 12:07:39 -0700
committerAdam Cohen <adamcohen@google.com>2011-04-15 13:29:26 -0700
commite3e27a854f3eca363d3c5ce353d19de475272d87 (patch)
tree5a627c3aa3869bd2c97e7945b0b19be9966b6fb3 /src/com/android/launcher2/DragView.java
parentdf0353815c629fc678824b07a234b89a1ff94208 (diff)
downloadandroid_packages_apps_Trebuchet-e3e27a854f3eca363d3c5ce353d19de475272d87.tar.gz
android_packages_apps_Trebuchet-e3e27a854f3eca363d3c5ce353d19de475272d87.tar.bz2
android_packages_apps_Trebuchet-e3e27a854f3eca363d3c5ce353d19de475272d87.zip
Cleaning up drag and drop visulization and drop location determination
-Visualization and drop location always match now -Improved the location determination/visualization for widgets in spring loaded mode -Simplified and fixed some other discrepencies Change-Id: I4b46f415a547e4df778c70a8b87f341a909d10c1
Diffstat (limited to 'src/com/android/launcher2/DragView.java')
-rw-r--r--src/com/android/launcher2/DragView.java31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index ab997446d..b02e22b16 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -26,6 +26,7 @@ import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PixelFormat;
+import android.graphics.Rect;
import android.os.IBinder;
import android.view.Gravity;
import android.view.View;
@@ -42,10 +43,7 @@ public class DragView extends View {
private int mRegistrationX;
private int mRegistrationY;
- private int mDragRegionLeft = 0;
- private int mDragRegionTop = 0;
- private int mDragRegionWidth;
- private int mDragRegionHeight;
+ private Rect mDragRegion = null;
ValueAnimator mAnim;
private float mOffsetX = 0.0f;
@@ -117,7 +115,7 @@ public class DragView extends View {
});
mBitmap = Bitmap.createBitmap(bitmap, left, top, width, height, scale, true);
- setDragRegion(0, 0, width, height);
+ setDragRegion(new Rect(0, 0, width, height));
// The point in our scaled bitmap that the touch events are located
mRegistrationX = registrationX;
@@ -132,31 +130,32 @@ public class DragView extends View {
return mOffsetY;
}
- public void setDragRegion(int left, int top, int width, int height) {
- mDragRegionLeft = left;
- mDragRegionTop = top;
- mDragRegionWidth = width;
- mDragRegionHeight = height;
- }
-
public void setOnDrawRunnable(Runnable r) {
mOnDrawRunnable = r;
}
public int getDragRegionLeft() {
- return mDragRegionLeft;
+ return mDragRegion.left;
}
public int getDragRegionTop() {
- return mDragRegionTop;
+ return mDragRegion.top;
}
public int getDragRegionWidth() {
- return mDragRegionWidth;
+ return mDragRegion.width();
}
public int getDragRegionHeight() {
- return mDragRegionHeight;
+ return mDragRegion.height();
+ }
+
+ public void setDragRegion(Rect r) {
+ mDragRegion = r;
+ }
+
+ public Rect getDragRegion() {
+ return mDragRegion;
}
@Override