From 20e420ca40f2220412a6bc4e247ea419ca933c87 Mon Sep 17 00:00:00 2001 From: Toni Barzic Date: Fri, 25 Oct 2024 17:48:20 +0000 Subject: [PATCH] Match taskbar edge padding to nav button end insets When calculating max number of items to show in a taskbar with overflow, reserve space for taskbar end/start margins that matches inline nav buttons end spacing. Bug: 368119679 Test: None Flag: com.android.launcher3.taskbar_overflow Change-Id: I1205663ed4455ae1e7807f8d4edf5aaf2beba7d4 --- .../src/com/android/launcher3/taskbar/TaskbarView.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index fcb583ab4c..52d6dcaf93 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -197,11 +197,13 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar private int calculateMaxNumIcons() { DeviceProfile deviceProfile = mActivityContext.getDeviceProfile(); int availableWidth = deviceProfile.widthPx; + int defaultEdgeMargin = + (int) getResources().getDimension(deviceProfile.inv.inlineNavButtonsEndSpacing); // Reserve space required for edge margins, or for navbar if shown. If task bar needs to be // center aligned with nav bar shown, reserve space on both sides. - availableWidth -= Math.max(deviceProfile.edgeMarginPx, deviceProfile.hotseatBarEndOffset); - availableWidth -= Math.max(deviceProfile.edgeMarginPx, + availableWidth -= Math.max(defaultEdgeMargin, deviceProfile.hotseatBarEndOffset); + availableWidth -= Math.max(defaultEdgeMargin, mShouldTryStartAlign ? 0 : deviceProfile.hotseatBarEndOffset); // The space taken by an item icon used during layout.