mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user