summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2012-07-16 18:05:26 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-07-16 18:05:26 -0700
commit39fb76e0ec285834a07c28ed313284cc6b4a79ad (patch)
tree8971b2f2f0accfd38b2b3e20cf7d7cdd7812fb34 /src
parente158b77a67e5d09c721746bd95653b2049f72bcb (diff)
parent4459d6b4db75c49f25ac6a43925a8ea212113218 (diff)
downloadandroid_packages_apps_Trebuchet-39fb76e0ec285834a07c28ed313284cc6b4a79ad.tar.gz
android_packages_apps_Trebuchet-39fb76e0ec285834a07c28ed313284cc6b4a79ad.tar.bz2
android_packages_apps_Trebuchet-39fb76e0ec285834a07c28ed313284cc6b4a79ad.zip
Merge "Fix issue where widget resize frame overlaps widget (issue 6493388)"
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/AppWidgetResizeFrame.java24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index e8b1dc056..2070eb638 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -53,6 +53,9 @@ public class AppWidgetResizeFrame extends FrameLayout {
private int mBackgroundPadding;
private int mTouchTargetWidth;
+ private int mTopTouchRegionAdjustment = 0;
+ private int mBottomTouchRegionAdjustment = 0;
+
int[] mDirectionVector = new int[2];
final int SNAP_DURATION = 150;
@@ -139,10 +142,12 @@ public class AppWidgetResizeFrame extends FrameLayout {
public boolean beginResizeIfPointInRegion(int x, int y) {
boolean horizontalActive = (mResizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0;
boolean verticalActive = (mResizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0;
+
mLeftBorderActive = (x < mTouchTargetWidth) && horizontalActive;
mRightBorderActive = (x > getWidth() - mTouchTargetWidth) && horizontalActive;
- mTopBorderActive = (y < mTouchTargetWidth) && verticalActive;
- mBottomBorderActive = (y > getHeight() - mTouchTargetWidth) && verticalActive;
+ mTopBorderActive = (y < mTouchTargetWidth + mTopTouchRegionAdjustment) && verticalActive;
+ mBottomBorderActive = (y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment)
+ && verticalActive;
boolean anyBordersActive = mLeftBorderActive || mRightBorderActive
|| mTopBorderActive || mBottomBorderActive;
@@ -378,13 +383,20 @@ public class AppWidgetResizeFrame extends FrameLayout {
int newX = mWidgetView.getLeft() - mBackgroundPadding + xOffset + mWidgetPaddingLeft;
int newY = mWidgetView.getTop() - mBackgroundPadding + yOffset + mWidgetPaddingTop;
- // We need to make sure the frame stays within the bounds of the CellLayout
+ // We need to make sure the frame's touchable regions lie fully within the bounds of the
+ // DragLayer. We allow the actual handles to be clipped, but we shift the touch regions
+ // down accordingly to provide a proper touch target.
if (newY < 0) {
- newHeight -= -newY;
- newY = 0;
+ // In this case we shift the touch region down to start at the top of the DragLayer
+ mTopTouchRegionAdjustment = -newY;
+ } else {
+ mTopTouchRegionAdjustment = 0;
}
if (newY + newHeight > mDragLayer.getHeight()) {
- newHeight -= newY + newHeight - mDragLayer.getHeight();
+ // In this case we shift the touch region up to end at the bottom of the DragLayer
+ mBottomTouchRegionAdjustment = -(newY + newHeight - mDragLayer.getHeight());
+ } else {
+ mBottomTouchRegionAdjustment = 0;
}
if (!animate) {