diff options
author | Nebojsa Cvetkovic <nebkat@gmail.com> | 2013-11-27 15:32:56 +0000 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-01-24 16:24:24 -0800 |
commit | 4333f716f04d3340af1a421c9a0c46a9e6ce36a0 (patch) | |
tree | 46445d6f0c2269aa9f14e2b0191cab62e5adb3f1 /src | |
parent | 52d5f749553cbf973d7956f71a205ef3b2d4181e (diff) | |
download | android_packages_apps_Trebuchet-4333f716f04d3340af1a421c9a0c46a9e6ce36a0.tar.gz android_packages_apps_Trebuchet-4333f716f04d3340af1a421c9a0c46a9e6ce36a0.tar.bz2 android_packages_apps_Trebuchet-4333f716f04d3340af1a421c9a0c46a9e6ce36a0.zip |
Workspace: Allow resizing any widget
Change-Id: I3a16b33955ccc7a17292e2d0887d473fed7b757c
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/AppWidgetResizeFrame.java | 29 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 3 |
2 files changed, 6 insertions, 26 deletions
diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java index fcb04ea08..ba31621f1 100644 --- a/src/com/android/launcher3/AppWidgetResizeFrame.java +++ b/src/com/android/launcher3/AppWidgetResizeFrame.java @@ -38,7 +38,6 @@ public class AppWidgetResizeFrame extends FrameLayout { private int mBaselineHeight; private int mBaselineX; private int mBaselineY; - private int mResizeMode; private int mRunningHInc; private int mRunningVInc; @@ -80,7 +79,6 @@ public class AppWidgetResizeFrame extends FrameLayout { mLauncher = (Launcher) context; mCellLayout = cellLayout; mWidgetView = widgetView; - mResizeMode = widgetView.getAppWidgetInfo().resizeMode; mDragLayer = dragLayer; final AppWidgetProviderInfo info = widgetView.getAppWidgetInfo(); @@ -123,14 +121,6 @@ public class AppWidgetResizeFrame extends FrameLayout { mWidgetPaddingRight = p.right; mWidgetPaddingBottom = p.bottom; - if (mResizeMode == AppWidgetProviderInfo.RESIZE_HORIZONTAL) { - mTopHandle.setVisibility(GONE); - mBottomHandle.setVisibility(GONE); - } else if (mResizeMode == AppWidgetProviderInfo.RESIZE_VERTICAL) { - mLeftHandle.setVisibility(GONE); - mRightHandle.setVisibility(GONE); - } - final float density = mLauncher.getResources().getDisplayMetrics().density; mBackgroundPadding = (int) Math.ceil(density * BACKGROUND_PADDING); mTouchTargetWidth = 2 * mBackgroundPadding; @@ -142,14 +132,11 @@ 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 + mTopTouchRegionAdjustment) && verticalActive; - mBottomBorderActive = (y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment) - && verticalActive; + mLeftBorderActive = x < mTouchTargetWidth; + mRightBorderActive = x > getWidth() - mTouchTargetWidth; + mTopBorderActive = y < mTouchTargetWidth + mTopTouchRegionAdjustment; + mBottomBorderActive = y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment; boolean anyBordersActive = mLeftBorderActive || mRightBorderActive || mTopBorderActive || mBottomBorderActive; @@ -454,13 +441,7 @@ public class AppWidgetResizeFrame extends FrameLayout { } }); AnimatorSet set = LauncherAnimUtils.createAnimatorSet(); - if (mResizeMode == AppWidgetProviderInfo.RESIZE_VERTICAL) { - set.playTogether(oa, topOa, bottomOa); - } else if (mResizeMode == AppWidgetProviderInfo.RESIZE_HORIZONTAL) { - set.playTogether(oa, leftOa, rightOa); - } else { - set.playTogether(oa, leftOa, rightOa, topOa, bottomOa); - } + set.playTogether(oa, leftOa, rightOa, topOa, bottomOa); set.setDuration(SNAP_DURATION); set.start(); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 3bd28861a..a5e2c10a1 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2870,8 +2870,7 @@ public class Workspace extends SmoothPagedView final LauncherAppWidgetHostView hostView = (LauncherAppWidgetHostView) cell; AppWidgetProviderInfo pinfo = hostView.getAppWidgetInfo(); - if (pinfo != null && - pinfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE) { + if (pinfo != null) { final Runnable addResizeFrame = new Runnable() { public void run() { DragLayer dragLayer = mLauncher.getDragLayer(); |