diff options
author | Winson Chung <winsonc@google.com> | 2013-09-27 07:16:23 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-09-27 07:16:23 -0700 |
commit | e7fe339af86194b2b872ba9a1ba39bae06e3db29 (patch) | |
tree | 96028993896d9f5bc3b338bb1cd068ae60c2786c | |
parent | 146fd3f8ee90cddf2f9e6a0c34ff052aa88ba87b (diff) | |
parent | c6b2499e4e9054a0ccf964f3dc22374e78e580ae (diff) | |
download | android_packages_apps_Trebuchet-e7fe339af86194b2b872ba9a1ba39bae06e3db29.tar.gz android_packages_apps_Trebuchet-e7fe339af86194b2b872ba9a1ba39bae06e3db29.tar.bz2 android_packages_apps_Trebuchet-e7fe339af86194b2b872ba9a1ba39bae06e3db29.zip |
am c6b2499e: am 672b5ea1: Merge "Fixing issue where incorrect min/max widths/heights were being reported to widgets. (Bug 10940505)" into jb-ub-now-indigo-rose
* commit 'c6b2499e4e9054a0ccf964f3dc22374e78e580ae':
Fixing issue where incorrect min/max widths/heights were being reported to widgets. (Bug 10940505)
-rw-r--r-- | src/com/android/launcher3/CellLayout.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/DynamicGrid.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 22 |
3 files changed, 18 insertions, 9 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 22492ac31..a114ec383 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -927,6 +927,8 @@ public class CellLayout extends ViewGroup { return r; } + /** Return a rect that has the cellWidth/cellHeight (left, top), and + * widthGap/heightGap (right, bottom) */ static void getMetrics(Rect metrics, int paddedMeasureWidth, int paddedMeasureHeight, int countX, int countY) { LauncherAppState app = LauncherAppState.getInstance(); diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java index 495e930f9..0756c88b7 100644 --- a/src/com/android/launcher3/DynamicGrid.java +++ b/src/com/android/launcher3/DynamicGrid.java @@ -290,7 +290,8 @@ class DeviceProfile { Rect getWorkspacePadding(int orientation) { Rect padding = new Rect(); - if (isVerticalBarLayout()) { + if (orientation == CellLayout.LANDSCAPE && + transposeLayoutWithOrientation) { // Pad the left and right of the workspace with search/hotseat bar sizes padding.set(searchBarSpaceHeightPx, edgeMarginPx, hotseatBarHeightPx, edgeMarginPx); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 1425f7ff5..0eca3af8b 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2747,6 +2747,8 @@ public class Workspace extends SmoothPagedView } } + /** Return a rect that has the cellWidth/cellHeight (left, top), and + * widthGap/heightGap (right, bottom) */ static Rect getCellLayoutMetrics(Launcher launcher, int orientation) { LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); @@ -2758,24 +2760,28 @@ public class Workspace extends SmoothPagedView display.getCurrentSizeRange(smallestSize, largestSize); int countX = (int) grid.numColumns; int countY = (int) grid.numRows; + int constrainedLongEdge = largestSize.y; + int constrainedShortEdge = smallestSize.y; if (orientation == CellLayout.LANDSCAPE) { if (mLandscapeCellLayoutMetrics == null) { Rect padding = grid.getWorkspacePadding(CellLayout.LANDSCAPE); - int width = largestSize.x - padding.left - padding.right; - int height = smallestSize.y - padding.top - padding.bottom; + int width = constrainedLongEdge - padding.left - padding.right; + int height = constrainedShortEdge - padding.top - padding.bottom; mLandscapeCellLayoutMetrics = new Rect(); - CellLayout.getMetrics(mLandscapeCellLayoutMetrics, width, height, - countX, countY); + mLandscapeCellLayoutMetrics.set( + grid.calculateCellWidth(width, countX), + grid.calculateCellHeight(height, countY), 0, 0); } return mLandscapeCellLayoutMetrics; } else if (orientation == CellLayout.PORTRAIT) { if (mPortraitCellLayoutMetrics == null) { Rect padding = grid.getWorkspacePadding(CellLayout.PORTRAIT); - int width = smallestSize.x - padding.left - padding.right; - int height = largestSize.y - padding.top - padding.bottom; + int width = constrainedShortEdge - padding.left - padding.right; + int height = constrainedLongEdge - padding.top - padding.bottom; mPortraitCellLayoutMetrics = new Rect(); - CellLayout.getMetrics(mPortraitCellLayoutMetrics, width, height, - countX, countY); + mPortraitCellLayoutMetrics.set( + grid.calculateCellWidth(width, countX), + grid.calculateCellHeight(height, countY), 0, 0); } return mPortraitCellLayoutMetrics; } |