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
This commit is contained in:
Michael Jurka
2010-08-19 13:52:27 -07:00
parent 01f0ed4126
commit a63c452f5b
12 changed files with 333 additions and 314 deletions

View File

@@ -39,6 +39,11 @@ public class DragView extends View implements TweenCallback {
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 @@ public class DragView extends View implements TweenCallback {
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());