Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed249f04 authored by Liran Binyamin's avatar Liran Binyamin Committed by Android (Google) Code Review
Browse files

Merge "Show the bubble bar edu view" into main

parents 721d6c96 16a604fe
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -1634,15 +1634,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        mControllers.taskbarEduTooltipController.hide();
    }

    /**
     * Called when we want to open bubblebar when user performs swipes up gesture.
     */
    public void onSwipeToOpenBubblebar() {
        mControllers.bubbleControllers.ifPresent(controllers -> {
            controllers.bubbleStashController.showBubbleBar(/* expandBubbles= */ true);
        });
    }

    /** Returns {@code true} if Taskbar All Apps is open. */
    public boolean isTaskbarAllAppsOpen() {
        return mControllers.taskbarAllAppsController.isOpen();
+2 −2
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ class BubbleBarSwipeController {
        when {
            canUnstash() && swipeState.passedUnstash -> {
                swipeState.currentState = COLLAPSED
                bubbleStashController.showBubbleBar(expandBubbles = false)
                bubbleStashController.showBubbleBar(expandBubbles = false, bubbleBarGesture = true)
            }
            canStash() && !swipeState.passedUnstash -> {
                swipeState.currentState = STASHED
@@ -103,7 +103,7 @@ class BubbleBarSwipeController {
    /** Finish tracking swipe gesture. Animate views back to resting state */
    fun finish() {
        if (swipeState.passedUnstash && swipeState.startState in setOf(STASHED, COLLAPSED)) {
            bubbleStashController.showBubbleBar(expandBubbles = true)
            bubbleStashController.showBubbleBar(expandBubbles = true, bubbleBarGesture = true)
        }
        if (animatedSwipeTranslation.value == 0f) {
            reset()
+4 −5
Original line number Diff line number Diff line
@@ -381,6 +381,7 @@ public class BubbleBarView extends FrameLayout {
        super.onInitializeAccessibilityNodeInfoInternal(info);
        // Always show only expand action as the menu is only for collapsed bubble bar
        info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_EXPAND);
        info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK);
        info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.action_dismiss_all,
                getResources().getString(R.string.bubble_bar_action_dismiss_all)));
        if (mBubbleBarLocation.isOnLeft(isLayoutRtl())) {
@@ -395,10 +396,8 @@ public class BubbleBarView extends FrameLayout {
    @Override
    public boolean performAccessibilityActionInternal(int action,
            @androidx.annotation.Nullable Bundle arguments) {
        if (super.performAccessibilityActionInternal(action, arguments)) {
            return true;
        }
        if (action == AccessibilityNodeInfo.ACTION_EXPAND) {
        if (action == AccessibilityNodeInfo.ACTION_EXPAND
                || action == AccessibilityNodeInfo.ACTION_CLICK) {
            mController.expandBubbleBar();
            return true;
        }
@@ -416,7 +415,7 @@ public class BubbleBarView extends FrameLayout {
                    BubbleBarLocation.UpdateSource.A11Y_ACTION_BAR);
            return true;
        }
        return false;
        return super.performAccessibilityActionInternal(action, arguments);
    }

    @SuppressLint("RtlHardcoded")
+37 −26
Original line number Diff line number Diff line
@@ -95,7 +95,6 @@ public class BubbleBarViewController {
    private TaskbarInsetsController mTaskbarInsetsController;
    private TaskbarViewPropertiesProvider mTaskbarViewPropertiesProvider;
    private View.OnClickListener mBubbleClickListener;
    private View.OnClickListener mBubbleBarClickListener;
    private BubbleView.Controller mBubbleViewController;
    private BubbleBarOverflow mOverflowBubble;

@@ -178,13 +177,11 @@ public class BubbleBarViewController {
                dp -> onBubbleBarConfigurationChanged(/* animate= */ true));
        mBubbleBarScaleY.updateValue(1f);
        mBubbleClickListener = v -> onBubbleClicked((BubbleView) v);
        mBubbleBarClickListener = v -> expandBubbleBar();
        mBubbleDragController.setupBubbleBarView(mBarView);
        mOverflowBubble = bubbleControllers.bubbleCreator.createOverflow(mBarView);
        if (!Flags.enableOptionalBubbleOverflow()) {
            showOverflow(true);
        }
        mBarView.setOnClickListener(mBubbleBarClickListener);
        mBarView.addOnLayoutChangeListener(
                (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
                    mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged();
@@ -211,7 +208,8 @@ public class BubbleBarViewController {

            @Override
            public void expandBubbleBar() {
                BubbleBarViewController.this.expandBubbleBar();
                BubbleBarViewController.this.setExpanded(
                        /* isExpanded= */ true, /* maybeShowEdu*/ true);
            }

            @Override
@@ -332,7 +330,7 @@ public class BubbleBarViewController {
            @Override
            public void flyoutClicked() {
                interruptAnimationForTouch();
                expandBubbleBar();
                setExpanded(/* isExpanded= */ true, /* maybeShowEdu*/ true);
            }
        };
    }
@@ -360,25 +358,6 @@ public class BubbleBarViewController {
        mBubbleStashController.onNewBubbleAnimationInterrupted(false, mBarView.getTranslationY());
    }

    private void expandBubbleBar() {
        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 {
            // ensure that the bubble bar has the correct translation. we may have just interrupted
            // the animation by touching the bubble bar.
            mBubbleBarTranslationY.animateToValue(mBubbleStashController.getBubbleBarTranslationY())
                    .start();
            setExpanded(true);
        }
    }

    private void collapseBubbleBar() {
        setExpanded(false);
        mBubbleStashController.stashBubbleBar();
@@ -391,6 +370,22 @@ public class BubbleBarViewController {
        }
    }

    /** Shows the education view if it was previously requested. */
    private boolean maybeShowEduView() {
        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);
            return true;
        }
        return false;
    }

    /** Notifies that the IME became visible. */
    public void onImeVisible() {
        if (isAnimatingNewBubble()) {
@@ -946,13 +941,25 @@ public class BubbleBarViewController {
        mBarView.setSelectedBubble(newlySelected.getView());
    }

    /** @see #setExpanded(boolean, boolean) */
    public void setExpanded(boolean isExpanded) {
        setExpanded(isExpanded, /* maybeShowEdu= */ false);
    }

    /**
     * Sets whether the bubble bar should be expanded (not unstashed, but have the contents
     * within it expanded). This method notifies SystemUI that the bubble bar is expanded and
     * showing a selected bubble. This method should ONLY be called from UI events originating
     * from Launcher.
     *
     * @param isExpanded whether the bar should be expanded
     * @param maybeShowEdu whether we should show the edu view before expanding
     */
    public void setExpanded(boolean isExpanded) {
    public void setExpanded(boolean isExpanded, boolean maybeShowEdu) {
        // if we're trying to expand try showing the edu view instead
        if (maybeShowEdu && isExpanded && !mBarView.isExpanded() && maybeShowEduView()) {
            return;
        }
        if (!mBubbleBarPinning.isAnimating() && isExpanded != mBarView.isExpanded()) {
            mBarView.setExpanded(isExpanded);
            adjustTaskbarAndHotseatToBubbleBarState(isExpanded);
@@ -1012,7 +1019,11 @@ public class BubbleBarViewController {
        }
    }

    /** Marks as should show education. */
    /**
     * Stores a request to show the education view for later processing when appropriate.
     *
     * @see #maybeShowEduView()
     */
    public void prepareToShowEducation() {
        mShouldShowEducation = true;
    }
+11 −1
Original line number Diff line number Diff line
@@ -131,7 +131,17 @@ interface BubbleStashController {
    fun stashBubbleBar()

    /** Shows the bubble bar, and expands bubbles depending on [expandBubbles]. */
    fun showBubbleBar(expandBubbles: Boolean)
    fun showBubbleBar(expandBubbles: Boolean) {
        showBubbleBar(expandBubbles = expandBubbles, bubbleBarGesture = false)
    }

    /**
     * Shows the bubble bar, and expands bubbles depending on [expandBubbles].
     *
     * Set [bubbleBarGesture] to true if this request originates from a touch gesture on the bubble
     * bar.
     */
    fun showBubbleBar(expandBubbles: Boolean, bubbleBarGesture: Boolean)

    // TODO(b/354218264): Move to BubbleBarViewAnimator
    /**
Loading