Merge "Update placement of the nav bar in persistent taskbar for 3 button nav" into main
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index a979d58..e9bd30a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -91,6 +91,7 @@
import com.android.launcher3.anim.AlphaUpdateListener;
import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.taskbar.TaskbarNavButtonController.TaskbarButton;
+import com.android.launcher3.taskbar.bubbles.BubbleBarController;
import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory;
import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonLayoutter;
import com.android.launcher3.taskbar.navbutton.NearestTouchFrame;
@@ -106,6 +107,7 @@
import com.android.systemui.shared.statusbar.phone.BarTransitions;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
+import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -115,7 +117,8 @@
/**
* Controller for managing nav bar buttons in taskbar
*/
-public class NavbarButtonsViewController implements TaskbarControllers.LoggableTaskbarController {
+public class NavbarButtonsViewController implements TaskbarControllers.LoggableTaskbarController,
+ BubbleBarController.BubbleBarLocationListener {
private final Rect mTempRect = new Rect();
@@ -397,6 +400,12 @@
}
};
mSeparateWindowParent.recreateControllers();
+ if (com.android.wm.shell.Flags.enableBubbleBarInPersistentTaskBar()
+ && mControllers.bubbleControllers.isPresent()) {
+ BubbleBarLocation bubblesLocation = mControllers.bubbleControllers.get()
+ .bubbleBarViewController.getBubbleBarLocation();
+ onBubbleBarLocationUpdated(bubblesLocation);
+ }
}
private void initButtons(ViewGroup navContainer, ViewGroup endContainer,
@@ -1168,6 +1177,52 @@
mHitboxExtender.onAnimationProgressToOverview(alignment);
}
+ /** Adjusts navigation buttons layout accordingly to the bubble bar position. */
+ @Override
+ public void onBubbleBarLocationUpdated(BubbleBarLocation location) {
+ mNavButtonContainer.setTranslationX(getNavBarTranslationX(location));
+ }
+
+ /** Animates navigation buttons accordingly to the bubble bar position. */
+ @Override
+ public void onBubbleBarLocationAnimated(BubbleBarLocation location) {
+ // TODO(b/346381754) add the teleport animation similarly to the bubble bar
+ mNavButtonContainer.setTranslationX(getNavBarTranslationX(location));
+ }
+
+ private int getNavBarTranslationX(BubbleBarLocation location) {
+ boolean isNavbarOnRight = location.isOnLeft(mNavButtonsView.isLayoutRtl());
+ DeviceProfile dp = mContext.getDeviceProfile();
+ float navBarTargetStartX;
+ if (mContext.shouldStartAlignTaskbar()) {
+ int navBarSpacing = dp.inlineNavButtonsEndSpacingPx;
+ // If the taskbar is start aligned the navigation bar is aligned to the start or end of
+ // the container, depending on the bubble bar location
+ if (isNavbarOnRight) {
+ navBarTargetStartX = dp.widthPx - navBarSpacing - mNavButtonContainer.getWidth();
+ } else {
+ navBarTargetStartX = navBarSpacing;
+ }
+ } else {
+ // If the task bar is not start aligned, the navigation bar is located in the center
+ // between the taskbar and screen edges, depending on the bubble bar location.
+ float navbarWidth = mNavButtonContainer.getWidth();
+ Rect taskbarBounds = mControllers.taskbarViewController.getIconLayoutBounds();
+ if (isNavbarOnRight) {
+ if (mNavButtonsView.isLayoutRtl()) {
+ float taskBarEnd = taskbarBounds.right;
+ navBarTargetStartX = (dp.widthPx + taskBarEnd - navbarWidth) / 2;
+ } else {
+ navBarTargetStartX = mNavButtonContainer.getLeft();
+ }
+ } else {
+ float taskBarStart = taskbarBounds.left;
+ navBarTargetStartX = (taskBarStart - navbarWidth) / 2;
+ }
+ }
+ return (int) navBarTargetStartX - mNavButtonContainer.getLeft();
+ }
+
private class RotationButtonListener implements RotationButton.RotationButtonUpdatesCallback {
@Override
public void onVisibilityChanged(boolean isVisible) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index a1cd7f7..c14b267 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -688,6 +688,11 @@
return mNavMode == NavigationMode.THREE_BUTTONS;
}
+ /** Returns whether taskbar should start align. */
+ public boolean shouldStartAlignTaskbar() {
+ return isThreeButtonNav() && mDeviceProfile.startAlignTaskbar;
+ }
+
public boolean isGestureNav() {
return mNavMode == NavigationMode.NO_BUTTON;
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index 32d6561..0389a11 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -87,6 +87,7 @@
private final boolean mIsRtl;
private final TaskbarActivityContext mActivityContext;
+ @Nullable private BubbleBarLocation mBubbleBarLocation = null;
// Initialized in init.
private TaskbarViewCallbacks mControllerCallbacks;
@@ -197,7 +198,7 @@
@Override
public void onDeviceProfileChanged(DeviceProfile dp) {
- mShouldTryStartAlign = mActivityContext.isThreeButtonNav() && dp.startAlignTaskbar;
+ mShouldTryStartAlign = mActivityContext.shouldStartAlignTaskbar();
}
@Override
@@ -494,39 +495,60 @@
icon.setOnHoverListener(mControllerCallbacks.getIconOnHoverListener(icon));
}
+ /** Updates taskbar icons accordingly to the new bubble bar location. */
+ public void onBubbleBarLocationUpdated(BubbleBarLocation location) {
+ if (mBubbleBarLocation == location) return;
+ mBubbleBarLocation = location;
+ requestLayout();
+ }
+
+ /**
+ * Returns translation X for the taskbar icons for provided {@link BubbleBarLocation}. If the
+ * bubble bar is not enabled, or location of the bubble bar is the same, or taskbar is not start
+ * aligned - returns 0.
+ */
+ public float getTranslationXForBubbleBarPosition(BubbleBarLocation location) {
+ if (!mControllerCallbacks.isBubbleBarEnabledInPersistentTaskbar()
+ || location == mBubbleBarLocation
+ || !mActivityContext.shouldStartAlignTaskbar()
+ ) {
+ return 0;
+ }
+ Rect iconsBounds = getIconLayoutBounds();
+ return getTaskBarIconsEndForBubbleBarLocation(location) - iconsBounds.right;
+ }
+
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- int count = getChildCount();
- DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
int spaceNeeded = getIconLayoutWidth();
- int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
boolean layoutRtl = isLayoutRtl();
- int centerAlignIconEnd = right - (right - left - spaceNeeded) / 2;
- int iconEnd;
-
+ DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
+ int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
+ int centerAlignIconEnd = (right + left + spaceNeeded) / 2;
+ int iconEnd = centerAlignIconEnd;
if (mShouldTryStartAlign) {
- // Taskbar is aligned to the start
int startSpacingPx = deviceProfile.inlineNavButtonsEndSpacingPx;
-
- if (layoutRtl) {
- iconEnd = right - startSpacingPx;
+ if (mControllerCallbacks.isBubbleBarEnabledInPersistentTaskbar()
+ && mBubbleBarLocation != null
+ && mActivityContext.shouldStartAlignTaskbar()) {
+ iconEnd = (int) getTaskBarIconsEndForBubbleBarLocation(mBubbleBarLocation);
} else {
- iconEnd = startSpacingPx + spaceNeeded;
+ if (layoutRtl) {
+ iconEnd = right - startSpacingPx;
+ } else {
+ iconEnd = startSpacingPx + spaceNeeded;
+ }
+ boolean needMoreSpaceForNav = layoutRtl
+ ? navSpaceNeeded > (iconEnd - spaceNeeded)
+ : iconEnd > (right - navSpaceNeeded);
+ if (needMoreSpaceForNav) {
+ // Add offset to account for nav bar when taskbar is centered
+ int offset = layoutRtl
+ ? navSpaceNeeded - (centerAlignIconEnd - spaceNeeded)
+ : (right - navSpaceNeeded) - centerAlignIconEnd;
+ iconEnd = centerAlignIconEnd + offset;
+ }
}
- } else {
- iconEnd = centerAlignIconEnd;
- }
-
- boolean needMoreSpaceForNav = layoutRtl
- ? navSpaceNeeded > (iconEnd - spaceNeeded)
- : iconEnd > (right - navSpaceNeeded);
- if (needMoreSpaceForNav) {
- // Add offset to account for nav bar when taskbar is centered
- int offset = layoutRtl
- ? navSpaceNeeded - (centerAlignIconEnd - spaceNeeded)
- : (right - navSpaceNeeded) - centerAlignIconEnd;
-
- iconEnd = centerAlignIconEnd + offset;
}
// Currently, we support only one device with display cutout and we only are concern about
@@ -558,6 +580,7 @@
mIconLayoutBounds.right = iconEnd;
mIconLayoutBounds.top = (bottom - top - mIconTouchSize) / 2;
mIconLayoutBounds.bottom = mIconLayoutBounds.top + mIconTouchSize;
+ int count = getChildCount();
for (int i = count; i > 0; i--) {
View child = getChildAt(i - 1);
if (child == mQsb) {
@@ -770,4 +793,19 @@
}
return mAllAppsButtonContainer;
}
+
+ /**
+ * This method only works for bubble bar enabled in persistent task bar and the taskbar is start
+ * aligned.
+ */
+ private float getTaskBarIconsEndForBubbleBarLocation(BubbleBarLocation location) {
+ DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
+ boolean navbarOnRight = location.isOnLeft(isLayoutRtl());
+ int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
+ if (navbarOnRight) {
+ return getWidth() - navSpaceNeeded;
+ } else {
+ return navSpaceNeeded + getIconLayoutWidth();
+ }
+ }
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java
index 5ec00ac..5c8d439 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewCallbacks.java
@@ -28,6 +28,7 @@
import com.android.internal.jank.Cuj;
import com.android.launcher3.taskbar.bubbles.BubbleBarViewController;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
+import com.android.wm.shell.Flags;
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
/**
@@ -127,4 +128,10 @@
}
return null;
}
+
+ /** Returns true if bubble bar controllers present and enabled in persistent taskbar. */
+ public boolean isBubbleBarEnabledInPersistentTaskbar() {
+ return Flags.enableBubbleBarInPersistentTaskBar()
+ && mControllers.bubbleControllers.isPresent();
+ }
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index 292b9ed..0d65c7b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -29,7 +29,10 @@
import static com.android.launcher3.config.FeatureFlags.enableTaskbarPinning;
import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_PERSISTENT;
import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_TRANSIENT;
+import static com.android.launcher3.taskbar.bubbles.BubbleBarView.FADE_IN_ANIM_ALPHA_DURATION_MS;
+import static com.android.launcher3.taskbar.bubbles.BubbleBarView.FADE_OUT_ANIM_POSITION_DURATION_MS;
import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE;
+import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_NAV_BAR_ANIM;
import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_TASKBAR_ALIGNMENT_ANIM;
import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_TASKBAR_PINNING_ANIM;
import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_TASKBAR_REVEAL_ANIM;
@@ -66,6 +69,7 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.TaskItemInfo;
+import com.android.launcher3.taskbar.bubbles.BubbleBarController;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.LauncherBindableItemsContainer;
@@ -74,6 +78,8 @@
import com.android.launcher3.util.MultiValueAlpha;
import com.android.quickstep.util.GroupTask;
import com.android.systemui.shared.recents.model.Task;
+import com.android.wm.shell.Flags;
+import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
import java.io.PrintWriter;
import java.util.Set;
@@ -82,7 +88,8 @@
/**
* Handles properties/data collection, then passes the results to TaskbarView to render.
*/
-public class TaskbarViewController implements TaskbarControllers.LoggableTaskbarController {
+public class TaskbarViewController implements TaskbarControllers.LoggableTaskbarController,
+ BubbleBarController.BubbleBarLocationListener {
private static final String TAG = "TaskbarViewController";
@@ -122,6 +129,14 @@
private final AnimatedFloat mTaskbarIconTranslationXForPinning = new AnimatedFloat(
this::updateTaskbarIconTranslationXForPinning);
+ private final AnimatedFloat mIconsTranslationXForNavbar = new AnimatedFloat(
+ this::updateTranslationXForNavBar);
+
+ @Nullable
+ private Animator mTaskbarShiftXAnim;
+ @Nullable
+ private BubbleBarLocation mCurrentBubbleBarLocation;
+
private final AnimatedFloat mTaskbarIconTranslationYForPinning = new AnimatedFloat(
this::updateTranslationY);
@@ -227,6 +242,54 @@
}
}
+ /** Adjusts start aligned taskbar layout accordingly to the bubble bar position. */
+ @Override
+ public void onBubbleBarLocationUpdated(BubbleBarLocation location) {
+ updateCurrentBubbleBarLocation(location);
+ if (!shouldMoveTaskbarOnBubbleBarLocationUpdate()) return;
+ cancelTaskbarShiftAnimation();
+ // reset translation x, taskbar will position icons with the updated location
+ mIconsTranslationXForNavbar.updateValue(0);
+ mTaskbarView.onBubbleBarLocationUpdated(location);
+ }
+
+ /** Animates start aligned taskbar accordingly to the bubble bar position. */
+ @Override
+ public void onBubbleBarLocationAnimated(BubbleBarLocation location) {
+ if (!updateCurrentBubbleBarLocation(location)
+ || !shouldMoveTaskbarOnBubbleBarLocationUpdate()) {
+ return;
+ }
+ cancelTaskbarShiftAnimation();
+ float translationX = mTaskbarView.getTranslationXForBubbleBarPosition(location);
+ mTaskbarShiftXAnim = createTaskbarIconsShiftAnimator(translationX);
+ mTaskbarShiftXAnim.start();
+ }
+
+ /** Updates the mCurrentBubbleBarLocation, returns {@code} true if location is updated. */
+ private boolean updateCurrentBubbleBarLocation(BubbleBarLocation location) {
+ if (mCurrentBubbleBarLocation == location || location == null) {
+ return false;
+ } else {
+ mCurrentBubbleBarLocation = location;
+ return true;
+ }
+ }
+
+ /** Returns whether taskbar should be moved on the bubble bar location update. */
+ private boolean shouldMoveTaskbarOnBubbleBarLocationUpdate() {
+ return Flags.enableBubbleBarInPersistentTaskBar()
+ && mControllers.bubbleControllers.isPresent()
+ && mActivity.shouldStartAlignTaskbar()
+ && mActivity.isThreeButtonNav();
+ }
+
+ private void cancelTaskbarShiftAnimation() {
+ if (mTaskbarShiftXAnim != null) {
+ mTaskbarShiftXAnim.cancel();
+ }
+ }
+
/**
* Announcement for Accessibility when Taskbar stashes/unstashes.
*/
@@ -460,6 +523,17 @@
+ mTaskbarIconTranslationYForSpringOnStash);
}
+ private void updateTranslationXForNavBar() {
+ View[] iconViews = mTaskbarView.getIconViews();
+ float translationX = mIconsTranslationXForNavbar.value;
+ for (int iconIndex = 0; iconIndex < iconViews.length; iconIndex++) {
+ View iconView = iconViews[iconIndex];
+ MultiTranslateDelegate translateDelegate =
+ ((Reorderable) iconView).getTranslateDelegate();
+ translateDelegate.getTranslationX(INDEX_NAV_BAR_ANIM).setValue(translationX);
+ }
+ }
+
/**
* Computes translation y for taskbar pinning.
*/
@@ -1018,4 +1092,12 @@
public static void enableModelLoadingForTests(boolean enable) {
sEnableModelLoadingForTests = enable;
}
+
+ private ObjectAnimator createTaskbarIconsShiftAnimator(float translationX) {
+ ObjectAnimator animator = mIconsTranslationXForNavbar.animateToValue(translationX);
+ animator.setStartDelay(FADE_OUT_ANIM_POSITION_DURATION_MS);
+ animator.setDuration(FADE_IN_ANIM_ALPHA_DURATION_MS);
+ animator.setInterpolator(Interpolators.EMPHASIZED);
+ return animator;
+ }
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
index d70a317..6860004 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
@@ -118,6 +118,7 @@
private Optional<BubbleStashedHandleViewController> mBubbleStashedHandleViewController;
private BubblePinController mBubblePinController;
private BubbleCreator mBubbleCreator;
+ private BubbleBarLocationListener mBubbleBarLocationListener;
// Cache last sent top coordinate to avoid sending duplicate updates to shell
private int mLastSentBubbleBarTop;
@@ -176,6 +177,7 @@
/** Initializes controllers. */
public void init(BubbleControllers bubbleControllers,
+ BubbleBarLocationListener bubbleBarLocationListener,
ImeVisibilityChecker imeVisibilityChecker) {
mImeVisibilityChecker = imeVisibilityChecker;
mBubbleBarViewController = bubbleControllers.bubbleBarViewController;
@@ -183,6 +185,7 @@
mBubbleStashedHandleViewController = bubbleControllers.bubbleStashedHandleViewController;
mBubblePinController = bubbleControllers.bubblePinController;
mBubbleCreator = bubbleControllers.bubbleCreator;
+ mBubbleBarLocationListener = bubbleBarLocationListener;
bubbleControllers.runAfterInit(() -> {
mBubbleBarViewController.setHiddenForBubbles(
@@ -488,12 +491,16 @@
private void updateBubbleBarLocationInternal(BubbleBarLocation location) {
mBubbleBarViewController.setBubbleBarLocation(location);
mBubbleStashController.setBubbleBarLocation(location);
+ mBubbleBarLocationListener.onBubbleBarLocationUpdated(location);
}
@Override
public void animateBubbleBarLocation(BubbleBarLocation bubbleBarLocation) {
MAIN_EXECUTOR.execute(
- () -> mBubbleBarViewController.animateBubbleBarLocation(bubbleBarLocation));
+ () -> {
+ mBubbleBarViewController.animateBubbleBarLocation(bubbleBarLocation);
+ mBubbleBarLocationListener.onBubbleBarLocationAnimated(bubbleBarLocation);
+ });
}
/** Notifies WMShell to show the expanded view. */
@@ -518,4 +525,14 @@
/** Whether the IME is visible. */
boolean isImeVisible();
}
+
+ /** Listener of {@link BubbleBarLocation} updates. */
+ public interface BubbleBarLocationListener {
+
+ /** Called when {@link BubbleBarLocation} is animated, but change is not yet final. */
+ void onBubbleBarLocationAnimated(BubbleBarLocation location);
+
+ /** Called when {@link BubbleBarLocation} is updated permanently. */
+ void onBubbleBarLocationUpdated(BubbleBarLocation location);
+ }
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarLocationCompositeListener.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarLocationCompositeListener.kt
new file mode 100644
index 0000000..8e176ac
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarLocationCompositeListener.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.taskbar.bubbles
+
+import com.android.launcher3.taskbar.bubbles.BubbleBarController.BubbleBarLocationListener
+import com.android.wm.shell.shared.bubbles.BubbleBarLocation
+
+/** Composite implementation of [BubbleBarLocationListener] interface */
+class BubbleBarLocationCompositeListener(private val listeners: List<BubbleBarLocationListener>) :
+ BubbleBarLocationListener {
+
+ constructor(vararg listeners: BubbleBarLocationListener) : this(listOf(*listeners))
+
+ override fun onBubbleBarLocationAnimated(location: BubbleBarLocation?) {
+ listeners.forEach { it.onBubbleBarLocationAnimated(location) }
+ }
+
+ override fun onBubbleBarLocationUpdated(location: BubbleBarLocation?) {
+ listeners.forEach { it.onBubbleBarLocationUpdated(location) }
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarPinController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarPinController.kt
index 9c34307..a34fab2 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarPinController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarPinController.kt
@@ -27,6 +27,7 @@
import android.widget.FrameLayout
import androidx.core.view.updateLayoutParams
import com.android.launcher3.R
+import com.android.launcher3.taskbar.bubbles.BubbleBarController.BubbleBarLocationListener
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController
import com.android.wm.shell.shared.bubbles.BaseBubblePinController
import com.android.wm.shell.shared.bubbles.BubbleBarLocation
@@ -42,12 +43,17 @@
private lateinit var bubbleBarViewController: BubbleBarViewController
private lateinit var bubbleStashController: BubbleStashController
+ private lateinit var bubbleBarLocationListener: BubbleBarLocationListener
private var exclRectWidth: Float = 0f
private var exclRectHeight: Float = 0f
private var dropTargetView: View? = null
- fun init(bubbleControllers: BubbleControllers) {
+ fun init(
+ bubbleControllers: BubbleControllers,
+ bubbleBarLocationListener: BubbleBarLocationListener
+ ) {
+ this.bubbleBarLocationListener = bubbleBarLocationListener
bubbleBarViewController = bubbleControllers.bubbleBarViewController
bubbleStashController = bubbleControllers.bubbleStashController
exclRectWidth = context.resources.getDimension(R.dimen.bubblebar_dismiss_zone_width)
@@ -86,6 +92,7 @@
val bounds = bubbleBarViewController.bubbleBarBounds
val horizontalMargin = bubbleBarViewController.horizontalMargin
+ bubbleBarLocationListener.onBubbleBarLocationAnimated(location)
dropTargetView?.updateLayoutParams<FrameLayout.LayoutParams> {
width = bounds.width()
height = bounds.height()
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java
index c005640..8eb6265 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java
@@ -95,11 +95,11 @@
private static final long FADE_OUT_ANIM_ALPHA_DURATION_MS = 50L;
private static final long FADE_OUT_ANIM_ALPHA_DELAY_MS = 50L;
- private static final long FADE_OUT_ANIM_POSITION_DURATION_MS = 100L;
+ public static final long FADE_OUT_ANIM_POSITION_DURATION_MS = 100L;
// During fade out animation we shift the bubble bar 1/80th of the screen width
private static final float FADE_OUT_ANIM_POSITION_SHIFT = 1 / 80f;
- private static final long FADE_IN_ANIM_ALPHA_DURATION_MS = 100L;
+ public static final long FADE_IN_ANIM_ALPHA_DURATION_MS = 100L;
// Use STIFFNESS_MEDIUMLOW which is not defined in the API constants
private static final float FADE_IN_ANIM_POSITION_SPRING_STIFFNESS = 400f;
// During fade in animation we shift the bubble bar 1/60th of the screen width
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java
index e00916a..12df6f0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java
@@ -76,7 +76,14 @@
* in constructors for now, as some controllers may still be waiting for init().
*/
public void init(TaskbarControllers taskbarControllers) {
+ // TODO(b/346381754) add TaskbarLauncherStateController implementation to adjust the hotseat
+ BubbleBarLocationCompositeListener bubbleBarLocationListeners =
+ new BubbleBarLocationCompositeListener(
+ taskbarControllers.navbarButtonsViewController,
+ taskbarControllers.taskbarViewController
+ );
bubbleBarController.init(this,
+ bubbleBarLocationListeners,
taskbarControllers.navbarButtonsViewController::isImeVisible);
bubbleStashedHandleViewController.ifPresent(
controller -> controller.init(/* bubbleControllers = */ this));
@@ -102,7 +109,7 @@
});
bubbleDragController.init(/* bubbleControllers = */ this);
bubbleDismissController.init(/* bubbleControllers = */ this);
- bubbleBarPinController.init(this);
+ bubbleBarPinController.init(this, bubbleBarLocationListeners);
bubblePinController.init(this);
mPostInitRunnables.executeAllAndDestroy();
diff --git a/src/com/android/launcher3/util/MultiTranslateDelegate.java b/src/com/android/launcher3/util/MultiTranslateDelegate.java
index 84ef445..38c87c8 100644
--- a/src/com/android/launcher3/util/MultiTranslateDelegate.java
+++ b/src/com/android/launcher3/util/MultiTranslateDelegate.java
@@ -37,6 +37,7 @@
public static final int INDEX_TASKBAR_ALIGNMENT_ANIM = 3;
public static final int INDEX_TASKBAR_REVEAL_ANIM = 4;
public static final int INDEX_TASKBAR_PINNING_ANIM = 5;
+ public static final int INDEX_NAV_BAR_ANIM = 6;
// Affect all items inside of a MultipageCellLayout
public static final int INDEX_CELLAYOUT_MULTIPAGE_SPACING = 3;
@@ -47,7 +48,7 @@
// Specific for hotseat items when adjusting for bubbles
public static final int INDEX_BUBBLE_ADJUSTMENT_ANIM = 3;
- public static final int COUNT = 6;
+ public static final int COUNT = 7;
private final MultiPropertyFactory<View> mTranslationX;
private final MultiPropertyFactory<View> mTranslationY;