diff options
author | Jon Miranda <jonmiranda@google.com> | 2017-07-21 13:31:50 -0700 |
---|---|---|
committer | Jon Miranda <jonmiranda@google.com> | 2017-07-24 10:45:36 -0700 |
commit | 1091e538b4622beb8fade0ca0b050f25019c4fd6 (patch) | |
tree | 07e8e12a677a6feb631fc365714c717e35c7311d | |
parent | c08f0c28596058b6e5e568bfaeedd03ba1ad466a (diff) | |
download | android_packages_apps_Trebuchet-1091e538b4622beb8fade0ca0b050f25019c4fd6.tar.gz android_packages_apps_Trebuchet-1091e538b4622beb8fade0ca0b050f25019c4fd6.tar.bz2 android_packages_apps_Trebuchet-1091e538b4622beb8fade0ca0b050f25019c4fd6.zip |
Manually compute all apps cell height in multi-window mode.
The All Apps cell height is set to match the Workspace.
This causes a problem in multi-window mode because only the
Workspace items do not have labels.
Bug: 63933609
Change-Id: I13be6e50c12d50465be0555721f273abfc0d836a
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 38011eaa3..cb4ad55c7 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -266,9 +266,7 @@ public class DeviceProfile { isLandscape); // Hide labels on the workspace. - profile.iconTextSizePx = 0; - profile.cellHeightPx = profile.iconSizePx + profile.iconDrawablePaddingPx - + Utilities.calculateTextHeight(profile.iconTextSizePx); + profile.adjustToHideWorkspaceLabels(); // We use these scales to measure and layout the widgets using their full invariant profile // sizes and then draw them scaled and centered to fit in their multi-window mode cellspans. @@ -292,6 +290,24 @@ public class DeviceProfile { } /** + * Adjusts the profile so that the labels on the Workspace are hidden. + * It is important to call this method after the All Apps variables have been set. + */ + private void adjustToHideWorkspaceLabels() { + iconTextSizePx = 0; + iconDrawablePaddingPx = 0; + cellHeightPx = iconSizePx; + + // In normal cases, All Apps cell height should equal the Workspace cell height. + // Since we are removing labels from the Workspace, we need to manually compute the + // All Apps cell height. + allAppsCellHeightPx = allAppsIconSizePx + allAppsIconDrawablePaddingPx + + Utilities.calculateTextHeight(allAppsIconTextSizePx) + // Top and bottom padding is equal to the drawable padding + + allAppsIconDrawablePaddingPx * 2; + } + + /** * Determine the exact visual footprint of the all apps button, taking into account scaling * and internal padding of the drawable. */ @@ -329,14 +345,7 @@ public class DeviceProfile { if (isVerticalBarLayout()) { // Always hide the Workspace text with vertical bar layout. - iconTextSizePx = 0; - iconDrawablePaddingPx = 0; - - // Manually compute all apps cell height since workspace cells have less content. - allAppsCellHeightPx = allAppsIconSizePx + allAppsIconDrawablePaddingPx - + Utilities.calculateTextHeight(allAppsIconTextSizePx) - // Top and bottom padding is equal to the drawable padding - + allAppsIconDrawablePaddingPx * 2; + adjustToHideWorkspaceLabels(); } cellWidthPx = iconSizePx + iconDrawablePaddingPx; |