summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-03-09 15:46:23 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-03-09 15:46:23 -0800
commit97336a1618e7cdc8b11050c28bec8c99f3438dc6 (patch)
tree205df891c89ece5151790d9885fbf2eac2fadf4a /src/com/android
parentbbaa75c8c432c46c00ee2eb836e438b3774d6709 (diff)
parente4b7729b9d6343b4e7e0905e117e5ac469727cbe (diff)
downloadandroid_packages_apps_Trebuchet-97336a1618e7cdc8b11050c28bec8c99f3438dc6.tar.gz
android_packages_apps_Trebuchet-97336a1618e7cdc8b11050c28bec8c99f3438dc6.tar.bz2
android_packages_apps_Trebuchet-97336a1618e7cdc8b11050c28bec8c99f3438dc6.zip
Merge "Small UI tweaks to widget resizing" into honeycomb-mr1
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher2/AppWidgetResizeFrame.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index 5f725b7ba..2b2662f42 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -48,7 +48,8 @@ public class AppWidgetResizeFrame extends FrameLayout {
final int SNAP_DURATION = 150;
final int BACKGROUND_PADDING = 24;
- final float DIMMED_HANDLE_ALPHA = 0.3f;
+ final float DIMMED_HANDLE_ALPHA = 0f;
+ final float RESIZE_THRESHOLD = 0.66f;
public static final int LEFT = 0;
public static final int TOP = 1;
@@ -193,11 +194,21 @@ public class AppWidgetResizeFrame extends FrameLayout {
int xThreshold = mCellLayout.getCellWidth() + mCellLayout.getWidthGap();
int yThreshold = mCellLayout.getCellHeight() + mCellLayout.getHeightGap();
- int hSpanInc = (int) Math.round(1.0f * mDeltaX / xThreshold) - mRunningHInc;
- int vSpanInc = (int) Math.round(1.0f * mDeltaY / yThreshold) - mRunningVInc;
+ float hSpanIncF = 1.0f * mDeltaX / xThreshold - mRunningHInc;
+ float vSpanIncF = 1.0f * mDeltaY / yThreshold - mRunningVInc;
+
+ int hSpanInc = 0;
+ int vSpanInc = 0;
int cellXInc = 0;
int cellYInc = 0;
+ if (Math.abs(hSpanIncF) > RESIZE_THRESHOLD) {
+ hSpanInc = Math.round(hSpanIncF);
+ }
+ if (Math.abs(vSpanIncF) > RESIZE_THRESHOLD) {
+ vSpanInc = Math.round(vSpanIncF);
+ }
+
if (hSpanInc == 0 && vSpanInc == 0) return;
// Before we change the widget, we clear the occupied cells associated with it.