Bubble bar user education

Launcher support for the user education logic described in ag/24587530.

Bug: 275077944
Test: TBD
Flag: WM_BUBBLE_BAR
Change-Id: I2b9a6ecde332de6305ad574c41d8322d8bb5d7ad
This commit is contained in:
Ivan Tkachenko
2023-08-30 15:45:31 +00:00
parent a40adc925f
commit 72597e32cb
3 changed files with 42 additions and 2 deletions
@@ -18,6 +18,7 @@ package com.android.launcher3.taskbar.bubbles;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import android.graphics.Point;
import android.graphics.Rect;
import android.util.Log;
import android.view.MotionEvent;
@@ -75,6 +76,7 @@ public class BubbleBarViewController {
private boolean mHiddenForSysui;
// Whether the bar is hidden because there are no bubbles.
private boolean mHiddenForNoBubbles;
private boolean mShouldShowEducation;
public BubbleBarViewController(TaskbarActivityContext activity, BubbleBarView barView) {
mActivity = activity;
@@ -98,7 +100,7 @@ public class BubbleBarViewController {
mBarView.getLayoutParams().height = mActivity.getDeviceProfile().taskbarHeight;
mBubbleBarScale.updateValue(1f);
mBubbleClickListener = v -> onBubbleClicked(v);
mBubbleBarClickListener = v -> setExpanded(true);
mBubbleBarClickListener = v -> onBubbleBarClicked();
mBubbleDragController.setupBubbleBarView(mBarView);
mBarView.setOnClickListener(mBubbleBarClickListener);
mBarView.addOnLayoutChangeListener((view, i, i1, i2, i3, i4, i5, i6, i7) ->
@@ -121,6 +123,21 @@ public class BubbleBarViewController {
}
}
private void onBubbleBarClicked() {
if (mShouldShowEducation) {
mShouldShowEducation = false;
// Get the bubble bar bounds on screen
Rect bounds = new Rect();
mBarView.getBoundsOnScreen(bounds);
// Calculate user education reference position in Screen coordinates
Point position = new Point(bounds.centerX(), bounds.top);
// Show user education relative to the reference point
mSystemUiProxy.showUserEducation(position);
} else {
setExpanded(true);
}
}
//
// The below animators are exposed to BubbleStashController so it can manage the stashing
// animation.
@@ -326,6 +343,12 @@ public class BubbleBarViewController {
}
}
/** Marks as should show education and shows the bubble bar in a collapsed state */
public void prepareToShowEducation() {
mShouldShowEducation = true;
mBubbleStashController.showBubbleBar(false /* expand the bubbles */);
}
/**
* Updates the dragged bubble view in the bubble bar view, and notifies SystemUI
* that a bubble is being dragged to dismiss.