diff options
author | Winson Chung <winsonc@google.com> | 2013-10-08 17:00:19 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2013-10-08 17:00:19 -0700 |
commit | 69737c3e49ff3edc42899609fdbc96e356f8638e (patch) | |
tree | 21c79dde9cfb0ea7e1793e243a7c8d50efb61426 /src/com/android/launcher3/ShortcutAndWidgetContainer.java | |
parent | 82a9bd2c03645494cb0965abc03a9a18823e07e5 (diff) | |
download | android_packages_apps_Trebuchet-69737c3e49ff3edc42899609fdbc96e356f8638e.tar.gz android_packages_apps_Trebuchet-69737c3e49ff3edc42899609fdbc96e356f8638e.tar.bz2 android_packages_apps_Trebuchet-69737c3e49ff3edc42899609fdbc96e356f8638e.zip |
Ensuring that we offset cell items by their destination cell padding. (Bug 10881814)
Change-Id: Idc16ae64b1a0e7f79b8a3ff5da6854fbab7867d2
Diffstat (limited to 'src/com/android/launcher3/ShortcutAndWidgetContainer.java')
-rw-r--r-- | src/com/android/launcher3/ShortcutAndWidgetContainer.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java index fcd6f19ae..1cf4c11b6 100644 --- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java +++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java @@ -123,6 +123,13 @@ public class ShortcutAndWidgetContainer extends ViewGroup { mIsHotseatLayout = isHotseat; } + int getCellContentHeight() { + final LauncherAppState app = LauncherAppState.getInstance(); + final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + return Math.min(getMeasuredHeight(), mIsHotseatLayout ? + grid.hotseatCellHeightPx : grid.cellHeightPx); + } + public void measureChild(View child) { final LauncherAppState app = LauncherAppState.getInstance(); final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); @@ -137,7 +144,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup { // Widgets have their own padding, so skip } else { // Otherwise, center the icon - int cHeight = mIsHotseatLayout ? grid.hotseatCellHeightPx : Math.min(getMeasuredHeight(), grid.cellHeightPx); + int cHeight = getCellContentHeight(); int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f)); int cellPaddingX = (int) (grid.edgeMarginPx / 2f); child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0); |