From e6a895ed6c4caa0ee188e42a39d8a97daf105407 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Wed, 16 Aug 2023 13:06:48 -0700 Subject: [PATCH] Correcting Taskbar Icon Layout bounds when Taskbar Divider is present - Breakout CL part 2 - This is a breakout cl from ag/24272821 to make it more readable and atomic. - This cl consist of change to correct the icon layout bound calculation when taksbar divider line is present in taskbar view. Test: Manual, Visual Bug: 265170176 Flag: ENABLE_TASKBAR_PINNING Change-Id: I259faf2cc0aa302b83337d104c4820885b925a6a --- .../android/launcher3/taskbar/TaskbarView.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 074cbe116e..2488081406 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -382,11 +382,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar int count = getChildCount(); DeviceProfile deviceProfile = mActivityContext.getDeviceProfile(); int spaceNeeded = getIconLayoutWidth(); - // We are removing the margin from taskbar divider item in taskbar, - // so remove it from spacing also. - if (FeatureFlags.ENABLE_TASKBAR_PINNING.get() && count > 1) { - spaceNeeded -= mIconTouchSize; - } int navSpaceNeeded = deviceProfile.hotseatBarEndOffset; boolean layoutRtl = isLayoutRtl(); int centerAlignIconEnd = right - (right - left - spaceNeeded) / 2; @@ -507,7 +502,15 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar if (deviceProfile.isQsbInline) { countExcludingQsb--; } - return countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize); + int iconLayoutBoundsWidth = + countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize); + + if (FeatureFlags.ENABLE_TASKBAR_PINNING.get() && countExcludingQsb > 1) { + // We are removing 4 * mItemMarginLeftRight as there should be no space between + // All Apps icon, divider icon, and first app icon in taskbar + iconLayoutBoundsWidth -= mItemMarginLeftRight * 4; + } + return iconLayoutBoundsWidth; } /**