From 08ef66789b7108694b075df43496042003fdfabe Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 10 May 2018 11:32:00 -0700 Subject: [PATCH] Using dragHandle for workspace padding calculation instead of pageIndicator > PageIndicator is a 1dp indicator which does not contribute in any padding calculations Bug: 79111591 Change-Id: I4d8be0149da2b3f14593ae71ca037ffe3885d9be --- .../android/quickstep/util/LayoutUtils.java | 3 +-- res/values-land/dimens.xml | 1 - res/values-sw720dp/dimens.xml | 3 --- res/values/dimens.xml | 1 - src/com/android/launcher3/DeviceProfile.java | 20 +++++++++---------- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java index 2ff70dde49..574efffb73 100644 --- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java +++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java @@ -42,8 +42,7 @@ public class LayoutUtils { if (dp.isVerticalBarLayout()) { extraSpace = 0; } else { - Resources res = context.getResources(); - extraSpace = dp.hotseatBarSizePx + res.getDimension(R.dimen.vertical_drag_handle_size); + extraSpace = dp.hotseatBarSizePx + dp.verticalDragHandleSizePx; } calculateTaskSize(context, dp, extraSpace, MULTI_WINDOW_STRATEGY_HALF_SCREEN, outRect); } diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index 7b5252949a..f0021956a1 100644 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -25,7 +25,6 @@ 24dp - 48dp 4dp 0dp diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml index 1497b5a694..b211207587 100644 --- a/res/values-sw720dp/dimens.xml +++ b/res/values-sw720dp/dimens.xml @@ -15,9 +15,6 @@ --> - - 24dp - 8dp 64dp diff --git a/res/values/dimens.xml b/res/values/dimens.xml index cd050e88a2..07e0b04ddd 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -20,7 +20,6 @@ 8dp - 24dp 1dp 8dp 8dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 4f9920c5b0..2f4772806c 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -70,8 +70,8 @@ public class DeviceProfile { public float workspaceSpringLoadShrinkFactor; public final int workspaceSpringLoadedBottomSpace; - // Page indicator - public final int pageIndicatorSizePx; + // Drag handle + public final int verticalDragHandleSizePx; // Workspace icons public int iconSizePx; @@ -160,8 +160,8 @@ public class DeviceProfile { res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_padding); cellLayoutBottomPaddingPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_bottom_padding); - pageIndicatorSizePx = res.getDimensionPixelSize( - R.dimen.dynamic_grid_min_page_indicator_size); + verticalDragHandleSizePx = res.getDimensionPixelSize( + R.dimen.vertical_drag_handle_size); defaultPageSpacingPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing); topWorkspacePadding = @@ -208,7 +208,7 @@ public class DeviceProfile { // in portrait mode closer together by adding more height to the hotseat. // Note: This calculation was created after noticing a pattern in the design spec. int extraSpace = getCellSize().y - iconSizePx - iconDrawablePaddingPx; - hotseatBarSizePx += extraSpace - pageIndicatorSizePx; + hotseatBarSizePx += extraSpace - verticalDragHandleSizePx; // Recalculate the available dimensions using the new hotseat size. updateAvailableDimensions(dm, res); @@ -332,7 +332,7 @@ public class DeviceProfile { if (!isVerticalLayout) { int expectedWorkspaceHeight = availableHeightPx - hotseatBarSizePx - - pageIndicatorSizePx - topWorkspacePadding; + - verticalDragHandleSizePx - topWorkspacePadding; float minRequiredHeight = dropTargetBarSizePx + workspaceSpringLoadedBottomSpace; workspaceSpringLoadShrinkFactor = Math.min( res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f, @@ -429,13 +429,13 @@ public class DeviceProfile { padding.right = hotseatBarSidePaddingPx; if (isSeascape()) { padding.left += hotseatBarSizePx; - padding.right += pageIndicatorSizePx; + padding.right += verticalDragHandleSizePx; } else { - padding.left += pageIndicatorSizePx; + padding.left += verticalDragHandleSizePx; padding.right += hotseatBarSizePx; } } else { - int paddingBottom = hotseatBarSizePx + pageIndicatorSizePx; + int paddingBottom = hotseatBarSizePx + verticalDragHandleSizePx; if (isTablet) { // Pad the left and right of the workspace to ensure consistent spacing // between all icons @@ -502,7 +502,7 @@ public class DeviceProfile { mInsets.top + dropTargetBarSizePx + edgeMarginPx, mInsets.left + availableWidthPx - edgeMarginPx, mInsets.top + availableHeightPx - hotseatBarSizePx - - pageIndicatorSizePx - edgeMarginPx); + - verticalDragHandleSizePx - edgeMarginPx); } }