From c1b08c5b7f0701a4e984e184b8318e9b3e4d64f7 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 15 Nov 2016 14:37:56 -0800 Subject: [PATCH] Add bottom padding to hotseat in multi-window mode. In multi-window mode, the navigation bar is black which makes the hotseat's top padding -- and lack of symmetric botom padding -- super apparent. We add bottom padding to the hotseat so that the hotseat icons remain visually centered. Bug: 32176631 Change-Id: I3eebf5ab98898c8ee092bda6ec48c6afdcd353b9 --- src/com/android/launcher3/DeviceProfile.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 483c5a9ce4..59ec56ab32 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -112,6 +112,7 @@ public class DeviceProfile { public int hotseatIconSizePx; public int hotseatBarHeightPx; private int hotseatBarTopPaddingPx; + private int hotseatBarBottomPaddingPx; private int hotseatLandGutterPx; // All apps @@ -185,6 +186,7 @@ public class DeviceProfile { hotseatBarHeightPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_height); hotseatBarTopPaddingPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding); + hotseatBarBottomPaddingPx = 0; hotseatLandGutterPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_gutter_width); // Determine sizes. @@ -215,6 +217,9 @@ public class DeviceProfile { profile.cellHeightPx = profile.iconSizePx + profile.iconDrawablePaddingPx + Utilities.calculateTextHeight(profile.iconTextSizePx); + // The nav bar is black so we add bottom padding to visually center hotseat icons. + profile.hotseatBarBottomPaddingPx = profile.hotseatBarTopPaddingPx; + return profile; } @@ -404,7 +409,8 @@ public class DeviceProfile { availablePaddingX = (int) Math.min(availablePaddingX, width * MAX_HORIZONTAL_PADDING_PERCENT); int availablePaddingY = Math.max(0, height - topWorkspacePadding - paddingBottom - - (int) (2 * inv.numRows * cellHeightPx)); + - (2 * inv.numRows * cellHeightPx) - hotseatBarTopPaddingPx + - hotseatBarBottomPaddingPx); padding.set(availablePaddingX / 2, topWorkspacePadding + availablePaddingY / 2, availablePaddingX / 2, paddingBottom + availablePaddingY / 2); } else { @@ -537,7 +543,7 @@ public class DeviceProfile { lp.height = hotseatBarHeightPx + mInsets.bottom; hotseat.getLayout().setPadding(hotseatAdjustment + workspacePadding.left, hotseatBarTopPaddingPx, hotseatAdjustment + workspacePadding.right, - mInsets.bottom); + hotseatBarBottomPaddingPx + mInsets.bottom); } else { // For phones, layout the hotseat without any bottom margin // to ensure that we have space for the folders @@ -546,7 +552,7 @@ public class DeviceProfile { lp.height = hotseatBarHeightPx + mInsets.bottom; hotseat.getLayout().setPadding(hotseatAdjustment + workspacePadding.left, hotseatBarTopPaddingPx, hotseatAdjustment + workspacePadding.right, - mInsets.bottom); + hotseatBarBottomPaddingPx + mInsets.bottom); } hotseat.setLayoutParams(lp);