Loading quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +5 −4 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; import static com.android.launcher3.Utilities.isRtl; import static com.android.launcher3.Utilities.mapRange; import static com.android.launcher3.anim.AnimatedFloat.VALUE; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; Loading Loading @@ -938,10 +937,12 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mTaskbarView.isDividerForRecents(), recentTaskIndex); if (positionInHotseat == ERROR_POSITION_IN_HOTSEAT_NOT_FOUND) continue; float hotseatIconCenter; if (launcherDp.shouldAdjustHotseatForBubbleBar(child.getContext(), bubbleBarHasBubbles())) { float hotseatAdjustedBorderSpace = launcherDp.getHotseatAdjustedBorderSpaceForBubbleBar(child.getContext()); float hotseatIconCenter; if (bubbleBarHasBubbles() && hotseatAdjustedBorderSpace != 0) { hotseatIconCenter = hotseatPadding.left + hotseatCellSize + (hotseatCellSize + hotseatAdjustedBorderSpace) * positionInHotseat + hotseatCellSize / 2f; Loading quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +4 −9 Original line number Diff line number Diff line Loading @@ -1106,15 +1106,10 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, translationX += mDeviceProfile .getHotseatTranslationXForBubbleBar(isBubblesOnLeft, isRtl); } if (isBubbleBarEnabled() && hasBubbles()) { // TODO(368379159) : create a class to reuse computation logic float adjustedBorderSpace = mDeviceProfile.getHotseatAdjustedBorderSpaceForBubbleBar(this); if (Float.compare(adjustedBorderSpace, 0f) != 0) { float borderSpaceDelta = adjustedBorderSpace - mDeviceProfile.hotseatBorderSpace; translationX += (int) (mDeviceProfile.iconSizePx + itemInfo.cellX * borderSpaceDelta); } if (isBubbleBarEnabled() && mDeviceProfile.shouldAdjustHotseatForBubbleBar(getContext(), hasBubbles())) { translationX += (int) mDeviceProfile .getHotseatAdjustedTranslation(getContext(), itemInfo.cellX); } return translationX; } Loading src/com/android/launcher3/DeviceProfile.java +32 −10 Original line number Diff line number Diff line Loading @@ -1829,19 +1829,14 @@ public class DeviceProfile { * Returns the new border space that should be used between hotseat icons after adjusting it to * the bubble bar. * * <p>Does not check for visible bubbles persistence, so caller should call * {@link #shouldAdjustHotseatForBubbleBar} first. * * <p>If there's no adjustment needed, this method returns {@code 0}. * @see #shouldAdjustHotseatForBubbleBar(Context, boolean) */ public float getHotseatAdjustedBorderSpaceForBubbleBar(Context context) { // only need to adjust when QSB is on top of the hotseat. if (isQsbInline) { return 0; } // no need to adjust if there's enough space for the bubble bar to the right of the hotseat. if (getHotseatLayoutPadding(context).right > mBubbleBarSpaceThresholdPx) { return 0; } if (!shouldAdjustHotseatForBubbleBar(context)) return 0; // The adjustment is shrinking the hotseat's width by 1 icon on either side. int iconsWidth = iconSizePx * numShownHotseatIcons + hotseatBorderSpace * (numShownHotseatIcons - 1); Loading @@ -1850,6 +1845,33 @@ public class DeviceProfile { return (float) (newWidth - iconSizePx * numShownHotseatIcons) / (numShownHotseatIcons - 1); } /** * Returns the hotseat icon translation X for the cellX index. * * <p>Does not check for visible bubbles persistence, so caller should call * {@link #shouldAdjustHotseatForBubbleBar} first. * * <p>If there's no adjustment needed, this method returns {@code 0}. * @see #shouldAdjustHotseatForBubbleBar(Context, boolean) */ public float getHotseatAdjustedTranslation(Context context, int cellX) { if (!shouldAdjustHotseatForBubbleBar(context)) return 0; float borderSpace = getHotseatAdjustedBorderSpaceForBubbleBar(context); float borderSpaceDelta = borderSpace - hotseatBorderSpace; return iconSizePx + cellX * borderSpaceDelta; } /** Returns whether hotseat should be adjusted for the bubble bar. */ public boolean shouldAdjustHotseatForBubbleBar(Context context, boolean hasBubbles) { return hasBubbles && shouldAdjustHotseatForBubbleBar(context); } private boolean shouldAdjustHotseatForBubbleBar(Context context) { // only need to adjust if bubble bar is enabled, when QSB is on top of the hotseat and // there's not enough space for the bubble bar to the right of the hotseat. return !isQsbInline && getHotseatLayoutPadding(context).right <= mBubbleBarSpaceThresholdPx; } /** * Returns the padding for hotseat view */ Loading src/com/android/launcher3/Hotseat.java +7 −11 Original line number Diff line number Diff line Loading @@ -149,12 +149,9 @@ public class Hotseat extends CellLayout implements Insettable { DeviceProfile dp = mActivity.getDeviceProfile(); if (bubbleBarEnabled) { float adjustedBorderSpace = dp.getHotseatAdjustedBorderSpaceForBubbleBar(getContext()); if (hasBubbles && Float.compare(adjustedBorderSpace, 0f) != 0) { getShortcutsAndWidgets().setTranslationProvider(cellX -> { float borderSpaceDelta = adjustedBorderSpace - dp.hotseatBorderSpace; return dp.iconSizePx + cellX * borderSpaceDelta; }); if (dp.shouldAdjustHotseatForBubbleBar(getContext(), hasBubbles)) { getShortcutsAndWidgets().setTranslationProvider( cellX -> dp.getHotseatAdjustedTranslation(getContext(), cellX)); if (mQsb instanceof HorizontalInsettableView) { HorizontalInsettableView insettableQsb = (HorizontalInsettableView) mQsb; final float insetFraction = (float) dp.iconSizePx / dp.hotseatQsbWidth; Loading Loading @@ -189,25 +186,24 @@ public class Hotseat extends CellLayout implements Insettable { */ public void adjustForBubbleBar(boolean isBubbleBarVisible) { DeviceProfile dp = mActivity.getDeviceProfile(); float adjustedBorderSpace = dp.getHotseatAdjustedBorderSpaceForBubbleBar(getContext()); if (Float.compare(adjustedBorderSpace, 0f) == 0) { if (!dp.shouldAdjustHotseatForBubbleBar(getContext(), isBubbleBarVisible)) { return; } ShortcutAndWidgetContainer icons = getShortcutsAndWidgets(); AnimatorSet animatorSet = new AnimatorSet(); float borderSpaceDelta = adjustedBorderSpace - dp.hotseatBorderSpace; // update the translation provider for future layout passes of hotseat icons. if (isBubbleBarVisible) { icons.setTranslationProvider(cellX -> dp.iconSizePx + cellX * borderSpaceDelta); icons.setTranslationProvider( cellX -> dp.getHotseatAdjustedTranslation(getContext(), cellX)); } else { icons.setTranslationProvider(null); } for (int i = 0; i < icons.getChildCount(); i++) { View child = icons.getChildAt(i); float tx = isBubbleBarVisible ? dp.iconSizePx + i * borderSpaceDelta : 0; float tx = isBubbleBarVisible ? dp.getHotseatAdjustedTranslation(getContext(), i) : 0; if (child instanceof Reorderable) { MultiTranslateDelegate mtd = ((Reorderable) child).getTranslateDelegate(); animatorSet.play( Loading Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +5 −4 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; import static com.android.launcher3.Utilities.isRtl; import static com.android.launcher3.Utilities.mapRange; import static com.android.launcher3.anim.AnimatedFloat.VALUE; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; Loading Loading @@ -938,10 +937,12 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mTaskbarView.isDividerForRecents(), recentTaskIndex); if (positionInHotseat == ERROR_POSITION_IN_HOTSEAT_NOT_FOUND) continue; float hotseatIconCenter; if (launcherDp.shouldAdjustHotseatForBubbleBar(child.getContext(), bubbleBarHasBubbles())) { float hotseatAdjustedBorderSpace = launcherDp.getHotseatAdjustedBorderSpaceForBubbleBar(child.getContext()); float hotseatIconCenter; if (bubbleBarHasBubbles() && hotseatAdjustedBorderSpace != 0) { hotseatIconCenter = hotseatPadding.left + hotseatCellSize + (hotseatCellSize + hotseatAdjustedBorderSpace) * positionInHotseat + hotseatCellSize / 2f; Loading
quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +4 −9 Original line number Diff line number Diff line Loading @@ -1106,15 +1106,10 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, translationX += mDeviceProfile .getHotseatTranslationXForBubbleBar(isBubblesOnLeft, isRtl); } if (isBubbleBarEnabled() && hasBubbles()) { // TODO(368379159) : create a class to reuse computation logic float adjustedBorderSpace = mDeviceProfile.getHotseatAdjustedBorderSpaceForBubbleBar(this); if (Float.compare(adjustedBorderSpace, 0f) != 0) { float borderSpaceDelta = adjustedBorderSpace - mDeviceProfile.hotseatBorderSpace; translationX += (int) (mDeviceProfile.iconSizePx + itemInfo.cellX * borderSpaceDelta); } if (isBubbleBarEnabled() && mDeviceProfile.shouldAdjustHotseatForBubbleBar(getContext(), hasBubbles())) { translationX += (int) mDeviceProfile .getHotseatAdjustedTranslation(getContext(), itemInfo.cellX); } return translationX; } Loading
src/com/android/launcher3/DeviceProfile.java +32 −10 Original line number Diff line number Diff line Loading @@ -1829,19 +1829,14 @@ public class DeviceProfile { * Returns the new border space that should be used between hotseat icons after adjusting it to * the bubble bar. * * <p>Does not check for visible bubbles persistence, so caller should call * {@link #shouldAdjustHotseatForBubbleBar} first. * * <p>If there's no adjustment needed, this method returns {@code 0}. * @see #shouldAdjustHotseatForBubbleBar(Context, boolean) */ public float getHotseatAdjustedBorderSpaceForBubbleBar(Context context) { // only need to adjust when QSB is on top of the hotseat. if (isQsbInline) { return 0; } // no need to adjust if there's enough space for the bubble bar to the right of the hotseat. if (getHotseatLayoutPadding(context).right > mBubbleBarSpaceThresholdPx) { return 0; } if (!shouldAdjustHotseatForBubbleBar(context)) return 0; // The adjustment is shrinking the hotseat's width by 1 icon on either side. int iconsWidth = iconSizePx * numShownHotseatIcons + hotseatBorderSpace * (numShownHotseatIcons - 1); Loading @@ -1850,6 +1845,33 @@ public class DeviceProfile { return (float) (newWidth - iconSizePx * numShownHotseatIcons) / (numShownHotseatIcons - 1); } /** * Returns the hotseat icon translation X for the cellX index. * * <p>Does not check for visible bubbles persistence, so caller should call * {@link #shouldAdjustHotseatForBubbleBar} first. * * <p>If there's no adjustment needed, this method returns {@code 0}. * @see #shouldAdjustHotseatForBubbleBar(Context, boolean) */ public float getHotseatAdjustedTranslation(Context context, int cellX) { if (!shouldAdjustHotseatForBubbleBar(context)) return 0; float borderSpace = getHotseatAdjustedBorderSpaceForBubbleBar(context); float borderSpaceDelta = borderSpace - hotseatBorderSpace; return iconSizePx + cellX * borderSpaceDelta; } /** Returns whether hotseat should be adjusted for the bubble bar. */ public boolean shouldAdjustHotseatForBubbleBar(Context context, boolean hasBubbles) { return hasBubbles && shouldAdjustHotseatForBubbleBar(context); } private boolean shouldAdjustHotseatForBubbleBar(Context context) { // only need to adjust if bubble bar is enabled, when QSB is on top of the hotseat and // there's not enough space for the bubble bar to the right of the hotseat. return !isQsbInline && getHotseatLayoutPadding(context).right <= mBubbleBarSpaceThresholdPx; } /** * Returns the padding for hotseat view */ Loading
src/com/android/launcher3/Hotseat.java +7 −11 Original line number Diff line number Diff line Loading @@ -149,12 +149,9 @@ public class Hotseat extends CellLayout implements Insettable { DeviceProfile dp = mActivity.getDeviceProfile(); if (bubbleBarEnabled) { float adjustedBorderSpace = dp.getHotseatAdjustedBorderSpaceForBubbleBar(getContext()); if (hasBubbles && Float.compare(adjustedBorderSpace, 0f) != 0) { getShortcutsAndWidgets().setTranslationProvider(cellX -> { float borderSpaceDelta = adjustedBorderSpace - dp.hotseatBorderSpace; return dp.iconSizePx + cellX * borderSpaceDelta; }); if (dp.shouldAdjustHotseatForBubbleBar(getContext(), hasBubbles)) { getShortcutsAndWidgets().setTranslationProvider( cellX -> dp.getHotseatAdjustedTranslation(getContext(), cellX)); if (mQsb instanceof HorizontalInsettableView) { HorizontalInsettableView insettableQsb = (HorizontalInsettableView) mQsb; final float insetFraction = (float) dp.iconSizePx / dp.hotseatQsbWidth; Loading Loading @@ -189,25 +186,24 @@ public class Hotseat extends CellLayout implements Insettable { */ public void adjustForBubbleBar(boolean isBubbleBarVisible) { DeviceProfile dp = mActivity.getDeviceProfile(); float adjustedBorderSpace = dp.getHotseatAdjustedBorderSpaceForBubbleBar(getContext()); if (Float.compare(adjustedBorderSpace, 0f) == 0) { if (!dp.shouldAdjustHotseatForBubbleBar(getContext(), isBubbleBarVisible)) { return; } ShortcutAndWidgetContainer icons = getShortcutsAndWidgets(); AnimatorSet animatorSet = new AnimatorSet(); float borderSpaceDelta = adjustedBorderSpace - dp.hotseatBorderSpace; // update the translation provider for future layout passes of hotseat icons. if (isBubbleBarVisible) { icons.setTranslationProvider(cellX -> dp.iconSizePx + cellX * borderSpaceDelta); icons.setTranslationProvider( cellX -> dp.getHotseatAdjustedTranslation(getContext(), cellX)); } else { icons.setTranslationProvider(null); } for (int i = 0; i < icons.getChildCount(); i++) { View child = icons.getChildAt(i); float tx = isBubbleBarVisible ? dp.iconSizePx + i * borderSpaceDelta : 0; float tx = isBubbleBarVisible ? dp.getHotseatAdjustedTranslation(getContext(), i) : 0; if (child instanceof Reorderable) { MultiTranslateDelegate mtd = ((Reorderable) child).getTranslateDelegate(); animatorSet.play( Loading