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

Commit bd74e73b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix user education placement" into sc-v2-dev

parents 91ce4753 dbb136d2
Loading
Loading
Loading
Loading
+30 −9
Original line number Diff line number Diff line
@@ -530,9 +530,10 @@ public class BubbleStackView extends FrameLayout
                // Otherwise, we either tapped the stack (which means we're collapsed
                // and should expand) or the currently selected bubble (we're expanded
                // and should collapse).
                if (!maybeShowStackEdu()) {
                if (!maybeShowStackEdu() && !mShowedUserEducationInTouchListenerActive) {
                    mBubbleData.setExpanded(!mBubbleData.isExpanded());
                }
                mShowedUserEducationInTouchListenerActive = false;
            }
        }
    };
@@ -550,6 +551,14 @@ public class BubbleStackView extends FrameLayout
                return true;
            }

            mShowedUserEducationInTouchListenerActive = false;
            if (maybeShowStackEdu()) {
                mShowedUserEducationInTouchListenerActive = true;
                return true;
            } else if (isStackEduShowing()) {
                mStackEduView.hide(false /* fromExpansion */);
            }

            // If the manage menu is visible, just hide it.
            if (mShowingManage) {
                showManageMenu(false /* show */);
@@ -608,7 +617,8 @@ public class BubbleStackView extends FrameLayout
            // If we're expanding or collapsing, ignore all touch events.
            if (mIsExpansionAnimating
                    // Also ignore events if we shouldn't be draggable.
                    || (mPositioner.showingInTaskbar() && !mIsExpanded)) {
                    || (mPositioner.showingInTaskbar() && !mIsExpanded)
                    || mShowedUserEducationInTouchListenerActive) {
                return;
            }

@@ -629,7 +639,7 @@ public class BubbleStackView extends FrameLayout
                    mExpandedAnimationController.dragBubbleOut(
                            v, viewInitialX + dx, viewInitialY + dy);
                } else {
                    if (mStackEduView != null) {
                    if (isStackEduShowing()) {
                        mStackEduView.hide(false /* fromExpansion */);
                    }
                    mStackAnimationController.moveStackFromTouch(
@@ -647,6 +657,10 @@ public class BubbleStackView extends FrameLayout
                    || (mPositioner.showingInTaskbar() && !mIsExpanded)) {
                return;
            }
            if (mShowedUserEducationInTouchListenerActive) {
                mShowedUserEducationInTouchListenerActive = false;
                return;
            }

            // First, see if the magnetized object consumes the event - if so, the bubble was
            // released in the target or flung out of it, and we should ignore the event.
@@ -739,6 +753,7 @@ public class BubbleStackView extends FrameLayout
    private ImageView mManageSettingsIcon;
    private TextView mManageSettingsText;
    private boolean mShowingManage = false;
    private boolean mShowedUserEducationInTouchListenerActive = false;
    private PhysicsAnimator.SpringConfig mManageSpringConfig = new PhysicsAnimator.SpringConfig(
            SpringForce.STIFFNESS_MEDIUM, SpringForce.DAMPING_RATIO_LOW_BOUNCY);
    private BubblePositioner mPositioner;
@@ -930,10 +945,12 @@ public class BubbleStackView extends FrameLayout
                showManageMenu(false /* show */);
            } else if (mManageEduView != null && mManageEduView.getVisibility() == VISIBLE) {
                mManageEduView.hide();
            } else if (mStackEduView != null && mStackEduView.getVisibility() == VISIBLE) {
            } else if (isStackEduShowing()) {
                mStackEduView.hide(false /* isExpanding */);
            } else if (mBubbleData.isExpanded()) {
                mBubbleData.setExpanded(false);
            } else {
                maybeShowStackEdu();
            }
        });

@@ -1164,7 +1181,7 @@ public class BubbleStackView extends FrameLayout
     * @return true if education view for collapsed stack should show and was not showing before.
     */
    private boolean maybeShowStackEdu() {
        if (!shouldShowStackEdu()) {
        if (!shouldShowStackEdu() || isExpanded()) {
            return false;
        }
        if (mStackEduView == null) {
@@ -1175,9 +1192,13 @@ public class BubbleStackView extends FrameLayout
        return mStackEduView.show(mPositioner.getDefaultStartPosition());
    }

    private boolean isStackEduShowing() {
        return mStackEduView != null && mStackEduView.getVisibility() == VISIBLE;
    }

    // Recreates & shows the education views. Call when a theme/config change happens.
    private void updateUserEdu() {
        if (mStackEduView != null && mStackEduView.getVisibility() == VISIBLE) {
        if (isStackEduShowing()) {
            removeView(mStackEduView);
            mStackEduView = new StackEducationView(mContext, mPositioner, mBubbleController);
            addView(mStackEduView);
@@ -1859,7 +1880,7 @@ public class BubbleStackView extends FrameLayout
        cancelDelayedExpandCollapseSwitchAnimations();
        final boolean showVertically = mPositioner.showBubblesVertically();
        mIsExpanded = true;
        if (mStackEduView != null) {
        if (isStackEduShowing()) {
            mStackEduView.hide(true /* fromExpansion */);
        }
        beforeExpandedViewAnimation();
@@ -2397,7 +2418,7 @@ public class BubbleStackView extends FrameLayout
        if (flyoutMessage == null
                || flyoutMessage.message == null
                || !bubble.showFlyout()
                || (mStackEduView != null && mStackEduView.getVisibility() == VISIBLE)
                || isStackEduShowing()
                || isExpanded()
                || mIsExpansionAnimating
                || mIsGestureInProgress
@@ -2519,7 +2540,7 @@ public class BubbleStackView extends FrameLayout
     * them.
     */
    public void getTouchableRegion(Rect outRect) {
        if (mStackEduView != null && mStackEduView.getVisibility() == VISIBLE) {
        if (isStackEduShowing()) {
            // When user education shows then capture all touches
            outRect.set(0, 0, getWidth(), getHeight());
            return;
+2 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ class StackEducationView constructor(
     * @return true if user education was shown, false otherwise.
     */
    fun show(stackPosition: PointF): Boolean {
        isHiding = false
        if (visibility == VISIBLE) return false

        controller.updateWindowFlagsForBackpress(true /* interceptBack */)
@@ -164,6 +165,7 @@ class StackEducationView constructor(
     */
    fun hide(isExpanding: Boolean) {
        if (visibility != VISIBLE || isHiding) return
        isHiding = true

        controller.updateWindowFlagsForBackpress(false /* interceptBack */)
        animate()