From 19ab3a55826574a8cd03f41efc630dde2f6fd4f0 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Wed, 15 Dec 2021 01:10:17 +0000 Subject: [PATCH] Include border spacing to align tasbar icons with hotseat. The original calculation was including spacing in the the hotseatCellSize, but that causes us to incorrectly compute the hotseatIconCenter. If we take advantage of DeviceProfile.calculateCellWidth, we get the width without the spacing. Then we can add spacing for every icon to the left of the current one when figuring out the center. Test: Manual on tablet using device types tablet and multi display. Fix: 210123477 Change-Id: Ie182718ad3a229ffa8bae031f3ac7f73f8539f49 --- .../launcher3/taskbar/TaskbarViewController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index a4d899cbcf..e00d1778fb 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -204,9 +204,11 @@ public class TaskbarViewController { PendingAnimation setter = new PendingAnimation(100); Rect hotseatPadding = launcherDp.getHotseatLayoutPadding(mActivity); float scaleUp = ((float) launcherDp.iconSizePx) / mActivity.getDeviceProfile().iconSizePx; - int hotseatCellSize = - (launcherDp.availableWidthPx - hotseatPadding.left - hotseatPadding.right) - / launcherDp.numShownHotseatIcons; + int borderSpacing = launcherDp.cellLayoutBorderSpacePx.x; + int hotseatCellSize = DeviceProfile.calculateCellWidth( + launcherDp.availableWidthPx - hotseatPadding.left - hotseatPadding.right, + borderSpacing, + launcherDp.numShownHotseatIcons); int offsetY = launcherDp.getTaskbarOffsetY(); setter.setFloat(mTaskbarIconTranslationYForHome, VALUE, -offsetY, LINEAR); @@ -225,7 +227,8 @@ public class TaskbarViewController { setter.setFloat(child, SCALE_PROPERTY, scaleUp, LINEAR); float childCenter = (child.getLeft() + child.getRight()) / 2; - float hotseatIconCenter = hotseatPadding.left + hotseatCellSize * info.screenId + float hotseatIconCenter = hotseatPadding.left + + (hotseatCellSize + borderSpacing) * info.screenId + hotseatCellSize / 2; setter.setFloat(child, ICON_TRANSLATE_X, hotseatIconCenter - childCenter, LINEAR); }