Merge "Update placement of the hotseat according to the bubble bar location." into main

This commit is contained in:
Mykola Podolian
2024-09-27 15:45:04 +00:00
committed by Android (Google) Code Review
14 changed files with 284 additions and 28 deletions
@@ -834,6 +834,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
: mPersistentTaskbarDp.taskbarBottomMargin;
int firstRecentTaskIndex = -1;
int hotseatNavBarTranslationX = 0;
if (mCurrentBubbleBarLocation != null
&& taskbarDp.shouldAdjustHotseatOnBubblesLocationUpdate(mActivity)) {
boolean isBubblesOnLeft = mCurrentBubbleBarLocation.isOnLeft(
mTaskbarView.isLayoutRtl());
hotseatNavBarTranslationX = taskbarDp
.getHotseatTranslationXForBubbleBar(/* isNavbarOnRight = */ isBubblesOnLeft);
}
for (int i = 0; i < mTaskbarView.getChildCount(); i++) {
View child = mTaskbarView.getChildAt(i);
boolean isAllAppsButton = child == mTaskbarView.getAllAppsButtonContainer();
@@ -869,16 +877,20 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
: Interpolators.clampToProgress(LINEAR, 0.72f, 0.84f));
}
}
if (child == mTaskbarView.getQsb()) {
boolean isRtl = Utilities.isRtl(child.getResources());
float hotseatIconCenter = isRtl
? launcherDp.widthPx - hotseatPadding.right + borderSpacing
+ launcherDp.hotseatQsbWidth / 2f
: hotseatPadding.left - borderSpacing - launcherDp.hotseatQsbWidth / 2f;
if (taskbarDp.isQsbInline) {
hotseatIconCenter += hotseatNavBarTranslationX;
}
float childCenter = (child.getLeft() + child.getRight()) / 2f;
childCenter += ((Reorderable) child).getTranslateDelegate().getTranslationX(
INDEX_TASKBAR_PINNING_ANIM).getValue();
if (child instanceof Reorderable reorderableChild) {
childCenter += reorderableChild.getTranslateDelegate().getTranslationX(
INDEX_TASKBAR_PINNING_ANIM).getValue();
}
float halfQsbIconWidthDiff =
(launcherDp.hotseatQsbWidth - taskbarDp.taskbarIconSize) / 2f;
float scale = ((float) taskbarDp.taskbarIconSize)
@@ -887,8 +899,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
float fromX = isRtl ? -halfQsbIconWidthDiff : halfQsbIconWidthDiff;
float toX = hotseatIconCenter - childCenter;
if (child instanceof Reorderable) {
MultiTranslateDelegate mtd = ((Reorderable) child).getTranslateDelegate();
if (child instanceof Reorderable reorderableChild) {
MultiTranslateDelegate mtd = reorderableChild.getTranslateDelegate();
setter.addFloat(mtd.getTranslationX(INDEX_TASKBAR_ALIGNMENT_ANIM),
MULTI_PROPERTY_VALUE, fromX, toX, interpolator);
@@ -935,6 +947,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
+ (hotseatCellSize + borderSpacing) * positionInHotseat
+ hotseatCellSize / 2f;
}
hotseatIconCenter += hotseatNavBarTranslationX;
float childCenter = (child.getLeft() + child.getRight()) / 2f;
childCenter += ((Reorderable) child).getTranslateDelegate().getTranslationX(
INDEX_TASKBAR_PINNING_ANIM).getValue();