Handle taps on bubble bar flyout

Expand the bubble bar when the user taps on the flyout view.

Flag: com.android.wm.shell.enable_bubble_bar
Bug: 277815200
Test: atest BubbleBarViewAnimatorTest
Test: atest BubbleBarFlyoutControllerTest
Change-Id: I156acfa663d6a00bc70dd7bbfc35642643902d83
This commit is contained in:
Liran Binyamin committed 2024-10-23 19:46:14 -04:00
1 parent d6f39e3f45
commit aa3f772622
8 files changed
+125 -50

No files matched your search

@@ -45,6 +45,7 @@ import com.android.launcher3.taskbar.TaskbarStashController;
import com.android.launcher3.taskbar.bubbles.animation.BubbleBarViewAnimator;
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutController;
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutPositioner;
import com.android.launcher3.taskbar.bubbles.flyout.FlyoutCallbacks;
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
import com.android.launcher3.util.MultiPropertyFactory;
import com.android.launcher3.util.MultiValueAlpha;
@@ -146,7 +147,7 @@ public class BubbleBarViewController {
mTaskbarStashController = controllers.taskbarStashController;
mTaskbarInsetsController = controllers.taskbarInsetsController;
mBubbleBarFlyoutController = new BubbleBarFlyoutController(
mBubbleBarContainer, createFlyoutPositioner(), createFlyoutTopBoundaryListener());
mBubbleBarContainer, createFlyoutPositioner(), createFlyoutCallbacks());
mBubbleBarViewAnimator = new BubbleBarViewAnimator(
mBarView, mBubbleStashController, mBubbleBarFlyoutController,
mBubbleBarController::showExpandedView);
@@ -175,7 +176,9 @@ public class BubbleBarViewController {
@Override
public void onBubbleBarTouched() {
BubbleBarViewController.this.onBubbleBarTouched();
if (isAnimatingNewBubble()) {
interruptAnimationForTouch();
}
}
@Override
@@ -273,8 +276,8 @@ public class BubbleBarViewController {
};
}
private BubbleBarFlyoutController.TopBoundaryListener createFlyoutTopBoundaryListener() {
return new BubbleBarFlyoutController.TopBoundaryListener() {
private FlyoutCallbacks createFlyoutCallbacks() {
return new FlyoutCallbacks() {
@Override
public void extendTopBoundary(int space) {
int defaultSize = mActivity.getDefaultTaskbarWindowSize();
@@ -285,6 +288,12 @@ public class BubbleBarViewController {
public void resetTopBoundary() {
mActivity.setTaskbarWindowSize(mActivity.getDefaultTaskbarWindowSize());
}
@Override
public void flyoutClicked() {
interruptAnimationForTouch();
expandBubbleBar();
}
};
}
@@ -304,12 +313,10 @@ public class BubbleBarViewController {
}
}
private void onBubbleBarTouched() {
if (isAnimatingNewBubble()) {
mBubbleBarViewAnimator.onBubbleBarTouchedWhileAnimating();
mBubbleStashController.onNewBubbleAnimationInterrupted(false,
mBarView.getTranslationY());
}
/** Interrupts the running animation for a touch event on the bubble bar or flyout. */
private void interruptAnimationForTouch() {
mBubbleBarViewAnimator.interruptForTouch();
mBubbleStashController.onNewBubbleAnimationInterrupted(false, mBarView.getTranslationY());
}
private void expandBubbleBar() {
@@ -463,6 +470,12 @@ public class BubbleBarViewController {
return mBarView.getBubbleBarBounds();
}
/** Returns the bounds of the flyout view if it exists, or {@code null} otherwise. */
@Nullable
public Rect getFlyoutBounds() {
return mBubbleBarFlyoutController.getFlyoutBounds();
}
/** Checks that bubble bar is visible and that the motion event is within bounds. */
public boolean isEventOverBubbleBar(MotionEvent event) {
if (!isBubbleBarVisible()) return false;