Loading quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +1 −1 Original line number Diff line number Diff line Loading @@ -418,7 +418,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { /** Called when the visibility of the bubble bar changed. */ public void bubbleBarVisibilityChanged(boolean isVisible) { mControllers.uiController.adjustHotseatForBubbleBar(isVisible); mControllers.taskbarViewController.resetIconAlignmentController(); mControllers.taskbarViewController.adjustTaskbarForBubbleBar(); } public void init(@NonNull TaskbarSharedState sharedState) { Loading quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +30 −7 Original line number Diff line number Diff line Loading @@ -120,7 +120,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar private boolean mShouldTryStartAlign; private final int mMaxNumIcons; private int mMaxNumIcons = 0; private int mIdealNumIcons = 0; private final int mAllAppsButtonTranslationOffset; Loading Loading @@ -188,8 +189,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // TODO: Disable touch events on QSB otherwise it can crash. mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false); mMaxNumIcons = calculateMaxNumIcons(); } /** Loading @@ -200,11 +199,15 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar int availableWidth = deviceProfile.widthPx; int defaultEdgeMargin = (int) getResources().getDimension(deviceProfile.inv.inlineNavButtonsEndSpacing); int spaceForBubbleBar = Math.round(mControllerCallbacks.getBubbleBarMaxCollapsedWidthIfVisible()); // 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(defaultEdgeMargin, deviceProfile.hotseatBarEndOffset); availableWidth -= Math.max(defaultEdgeMargin, availableWidth -= Math.max(defaultEdgeMargin + spaceForBubbleBar, deviceProfile.hotseatBarEndOffset); availableWidth -= Math.max( defaultEdgeMargin + (mShouldTryStartAlign ? 0 : spaceForBubbleBar), mShouldTryStartAlign ? 0 : deviceProfile.hotseatBarEndOffset); // The space taken by an item icon used during layout. Loading @@ -231,6 +234,21 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar return Math.floorDiv(availableWidth, iconSize) + additionalIcons; } /** * Recalculates the max number of icons the taskbar view can show without entering overflow. * Returns whether the max number of icons changed and the change affects the number of icons * that should be shown in the taskbar. */ boolean updateMaxNumIcons() { if (!Flags.taskbarOverflow()) { return false; } int oldMaxNumIcons = mMaxNumIcons; mMaxNumIcons = calculateMaxNumIcons(); return oldMaxNumIcons != mMaxNumIcons && (mIdealNumIcons > oldMaxNumIcons || mIdealNumIcons > mMaxNumIcons); } @Override public void setVisibility(int visibility) { boolean changed = getVisibility() != visibility; Loading Loading @@ -328,6 +346,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar && mActivityContext.getTaskbarFeatureEvaluator().getSupportsPinningPopup()) { setOnTouchListener(mControllerCallbacks.getTaskbarTouchListener()); } if (Flags.taskbarOverflow()) { mMaxNumIcons = calculateMaxNumIcons(); } } private void removeAndRecycle(View view) { Loading Loading @@ -460,8 +482,9 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } } overflowSize = nextViewIndex + numberOfSupportedRecents + nonTaskIconsToBeAdded - mMaxNumIcons; mIdealNumIcons = nextViewIndex + numberOfSupportedRecents + nonTaskIconsToBeAdded; overflowSize = mIdealNumIcons - mMaxNumIcons; if (overflowSize > 0 && mTaskbarOverflowView != null) { addView(mTaskbarOverflowView, nextViewIndex++); } else if (mTaskbarOverflowView != null) { Loading quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java +11 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,17 @@ public class TaskbarViewCallbacks { return null; } /** * Get the max bubble bar collapsed width for the current bubble bar visibility state. Used to * reserve space for the bubble bar when transitioning taskbar view into overflow. */ public float getBubbleBarMaxCollapsedWidthIfVisible() { return mControllers.bubbleControllers .filter(c -> !c.bubbleBarViewController.isHiddenForNoBubbles()) .map(c -> c.bubbleBarViewController.getCollapsedWidthWithMaxVisibleBubbles()) .orElse(0f); } /** Returns true if bubble bar controllers present and enabled in persistent taskbar. */ public boolean isBubbleBarEnabledInPersistentTaskbar() { return Flags.enableBubbleBarInPersistentTaskBar() Loading quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +9 −2 Original line number Diff line number Diff line Loading @@ -779,9 +779,16 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } } /** Resets the icon alignment controller so that it can be recreated again later. */ void resetIconAlignmentController() { /** * Resets the icon alignment controller so that it can be recreated again later, and updates * the list of icons shown in the taskbar if the bubble bar visibility changes the taskbar * overflow state. */ void adjustTaskbarForBubbleBar() { mIconAlignControllerLazy = null; if (mTaskbarView.updateMaxNumIcons()) { commitRunningAppsToUI(); } } /** Loading quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +5 −1 Original line number Diff line number Diff line Loading @@ -1290,10 +1290,14 @@ public class BubbleBarView extends FrameLayout { // If there are more than 2 bubbles, the first 2 should be visible when collapsed, // excluding the overflow. return bubbleChildCount >= MAX_VISIBLE_BUBBLES_COLLAPSED ? getScaledIconSize() + mIconOverlapAmount + horizontalPadding ? getCollapsedWidthWithMaxVisibleBubbles() : getScaledIconSize() + horizontalPadding; } float getCollapsedWidthWithMaxVisibleBubbles() { return getScaledIconSize() + mIconOverlapAmount + 2 * mBubbleBarPadding; } /** Returns the child count excluding the overflow if it's present. */ int getBubbleChildCount() { return hasOverflow() ? getChildCount() - 1 : getChildCount(); Loading Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +1 −1 Original line number Diff line number Diff line Loading @@ -418,7 +418,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { /** Called when the visibility of the bubble bar changed. */ public void bubbleBarVisibilityChanged(boolean isVisible) { mControllers.uiController.adjustHotseatForBubbleBar(isVisible); mControllers.taskbarViewController.resetIconAlignmentController(); mControllers.taskbarViewController.adjustTaskbarForBubbleBar(); } public void init(@NonNull TaskbarSharedState sharedState) { Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +30 −7 Original line number Diff line number Diff line Loading @@ -120,7 +120,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar private boolean mShouldTryStartAlign; private final int mMaxNumIcons; private int mMaxNumIcons = 0; private int mIdealNumIcons = 0; private final int mAllAppsButtonTranslationOffset; Loading Loading @@ -188,8 +189,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // TODO: Disable touch events on QSB otherwise it can crash. mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false); mMaxNumIcons = calculateMaxNumIcons(); } /** Loading @@ -200,11 +199,15 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar int availableWidth = deviceProfile.widthPx; int defaultEdgeMargin = (int) getResources().getDimension(deviceProfile.inv.inlineNavButtonsEndSpacing); int spaceForBubbleBar = Math.round(mControllerCallbacks.getBubbleBarMaxCollapsedWidthIfVisible()); // 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(defaultEdgeMargin, deviceProfile.hotseatBarEndOffset); availableWidth -= Math.max(defaultEdgeMargin, availableWidth -= Math.max(defaultEdgeMargin + spaceForBubbleBar, deviceProfile.hotseatBarEndOffset); availableWidth -= Math.max( defaultEdgeMargin + (mShouldTryStartAlign ? 0 : spaceForBubbleBar), mShouldTryStartAlign ? 0 : deviceProfile.hotseatBarEndOffset); // The space taken by an item icon used during layout. Loading @@ -231,6 +234,21 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar return Math.floorDiv(availableWidth, iconSize) + additionalIcons; } /** * Recalculates the max number of icons the taskbar view can show without entering overflow. * Returns whether the max number of icons changed and the change affects the number of icons * that should be shown in the taskbar. */ boolean updateMaxNumIcons() { if (!Flags.taskbarOverflow()) { return false; } int oldMaxNumIcons = mMaxNumIcons; mMaxNumIcons = calculateMaxNumIcons(); return oldMaxNumIcons != mMaxNumIcons && (mIdealNumIcons > oldMaxNumIcons || mIdealNumIcons > mMaxNumIcons); } @Override public void setVisibility(int visibility) { boolean changed = getVisibility() != visibility; Loading Loading @@ -328,6 +346,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar && mActivityContext.getTaskbarFeatureEvaluator().getSupportsPinningPopup()) { setOnTouchListener(mControllerCallbacks.getTaskbarTouchListener()); } if (Flags.taskbarOverflow()) { mMaxNumIcons = calculateMaxNumIcons(); } } private void removeAndRecycle(View view) { Loading Loading @@ -460,8 +482,9 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } } overflowSize = nextViewIndex + numberOfSupportedRecents + nonTaskIconsToBeAdded - mMaxNumIcons; mIdealNumIcons = nextViewIndex + numberOfSupportedRecents + nonTaskIconsToBeAdded; overflowSize = mIdealNumIcons - mMaxNumIcons; if (overflowSize > 0 && mTaskbarOverflowView != null) { addView(mTaskbarOverflowView, nextViewIndex++); } else if (mTaskbarOverflowView != null) { Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java +11 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,17 @@ public class TaskbarViewCallbacks { return null; } /** * Get the max bubble bar collapsed width for the current bubble bar visibility state. Used to * reserve space for the bubble bar when transitioning taskbar view into overflow. */ public float getBubbleBarMaxCollapsedWidthIfVisible() { return mControllers.bubbleControllers .filter(c -> !c.bubbleBarViewController.isHiddenForNoBubbles()) .map(c -> c.bubbleBarViewController.getCollapsedWidthWithMaxVisibleBubbles()) .orElse(0f); } /** Returns true if bubble bar controllers present and enabled in persistent taskbar. */ public boolean isBubbleBarEnabledInPersistentTaskbar() { return Flags.enableBubbleBarInPersistentTaskBar() Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +9 −2 Original line number Diff line number Diff line Loading @@ -779,9 +779,16 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } } /** Resets the icon alignment controller so that it can be recreated again later. */ void resetIconAlignmentController() { /** * Resets the icon alignment controller so that it can be recreated again later, and updates * the list of icons shown in the taskbar if the bubble bar visibility changes the taskbar * overflow state. */ void adjustTaskbarForBubbleBar() { mIconAlignControllerLazy = null; if (mTaskbarView.updateMaxNumIcons()) { commitRunningAppsToUI(); } } /** Loading
quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +5 −1 Original line number Diff line number Diff line Loading @@ -1290,10 +1290,14 @@ public class BubbleBarView extends FrameLayout { // If there are more than 2 bubbles, the first 2 should be visible when collapsed, // excluding the overflow. return bubbleChildCount >= MAX_VISIBLE_BUBBLES_COLLAPSED ? getScaledIconSize() + mIconOverlapAmount + horizontalPadding ? getCollapsedWidthWithMaxVisibleBubbles() : getScaledIconSize() + horizontalPadding; } float getCollapsedWidthWithMaxVisibleBubbles() { return getScaledIconSize() + mIconOverlapAmount + 2 * mBubbleBarPadding; } /** Returns the child count excluding the overflow if it's present. */ int getBubbleChildCount() { return hasOverflow() ? getChildCount() - 1 : getChildCount(); Loading