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

Commit d0f57d36 authored by Josh Tsuji's avatar Josh Tsuji Committed by Android (Google) Code Review
Browse files

Merge "Fix start position issues and related flyout flickering." into qt-dev

parents 16641365 19e22e42
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -785,6 +785,10 @@ public class BubbleStackView extends FrameLayout {
                StatsLog.BUBBLE_UICHANGED__ACTION__STACK_MOVED);
    }

    void onDragFinishAsDismiss() {
        mIsDragging = false;
    }

    /**
     * Calculates how large the expanded view of the bubble can be. This takes into account the
     * y position when the bubbles are expanded as well as the bounds of the dismiss target.
@@ -824,9 +828,12 @@ public class BubbleStackView extends FrameLayout {
        if (updateMessage != null && !isExpanded() && !mIsExpansionAnimating && !mIsDragging) {
            final PointF stackPos = mStackAnimationController.getStackPosition();

            mFlyout.setAlpha(0f);
            mFlyout.setVisibility(VISIBLE);

            mFlyoutText.setText(updateMessage);
            mFlyout.measure(WRAP_CONTENT, WRAP_CONTENT);
            mFlyout.post(() -> {
            post(() -> {
                final boolean onLeft = mStackAnimationController.isStackOnLeftSide();
                final float destinationX = onLeft
                        ? stackPos.x + mBubbleSize + mBubblePadding
@@ -835,9 +842,6 @@ public class BubbleStackView extends FrameLayout {
                // Translate towards the stack slightly, then spring out from the stack.
                mFlyout.setTranslationX(destinationX + (onLeft ? -mBubblePadding : mBubblePadding));
                mFlyout.setTranslationY(stackPos.y);
                mFlyout.setAlpha(0f);

                mFlyout.setVisibility(VISIBLE);

                mFlyout.animate().alpha(1f);
                mFlyoutSpring.animateToFinalPosition(destinationX);
+1 −0
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ class BubbleTouchHandler implements View.OnTouchListener {
                trackMovement(event);
                if (mInDismissTarget && isStack) {
                    mController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
                    mStack.onDragFinishAsDismiss();
                } else if (isFlyout) {
                    // TODO(b/129768381): Expand if tapped, dismiss if swiped away.
                    if (!mStack.isExpanded() && !mMovedEnough) {
+1 −0
Original line number Diff line number Diff line
@@ -535,6 +535,7 @@ public class StackAnimationController extends
        Log.d(TAG, String.format("Setting position to (%f, %f).", pos.x, pos.y));
        mStackPosition.set(pos.x, pos.y);

        mLayout.cancelAllAnimations();
        cancelStackPositionAnimations();

        // Since we're not using the chained animations, apply the offsets manually.
+1 −13
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static org.mockito.Mockito.when;

import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.view.View;
import android.widget.TextView;

import androidx.test.filters.SmallTest;
@@ -53,22 +52,11 @@ public class BubbleStackViewTest extends SysuiTestCase {
    }

    @Test
    public void testAnimateInFlyoutForBubble() throws InterruptedException {
    public void testAnimateInFlyoutForBubble() {
        when(mNotifEntry.getUpdateMessage(any())).thenReturn("Test Flyout Message.");
        mStackView.animateInFlyoutForBubble(mBubble);

        // Wait for the fade in.
        Thread.sleep(200);

        // Flyout should be visible and showing our text.
        assertEquals(1f, mStackView.findViewById(R.id.bubble_flyout).getAlpha(), .01f);
        assertEquals("Test Flyout Message.",
                ((TextView) mStackView.findViewById(R.id.bubble_flyout_text)).getText());

        // Wait until it should have gone away.
        Thread.sleep(BubbleStackView.FLYOUT_HIDE_AFTER + 200);

        // Flyout should be gone.
        assertEquals(View.GONE, mStackView.findViewById(R.id.bubble_flyout).getVisibility());
    }
}