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

Commit acd4a2d0 authored by Annie Lin's avatar Annie Lin
Browse files

Set BubbleBarCaptionView to the status bar color in onTaskInfoChanged.

Fallback to task background color if the status bar color is transparent. Also remove BubbleBarHandleView#setHandleInitialColor since the caption view sets the handle view color when initialized and was causing another issue with handle color when switching between bubbles.

Before: http://screencast/cast/NjA4NTM3NjEyODA1NzM0NHwxMWM0MTJmMy04Zg
After: http://screencast/cast/NTIwNzQ2NDcxMzY1MDE3NnxkNzYxZDU5Zi0xZg
Bug: 403612933
Fix: 434098805
Test: wm presubmit
Flag: com.android.wm.shell.enable_create_any_bubble
Change-Id: I0382f1ab51b2ab7d4e7be7989a36221674ca41b2
parent b7237322
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -298,7 +298,6 @@ public class BubbleBarAnimationHelper {
        final float endTx = toBbev.getTranslationX();
        final float startTx = getSwitchAnimationInitialTx(endTx);
        toBbev.getHandleView().setAlpha(0f);
        toBbev.getHandleView().setHandleInitialColor(fromBbev.getHandleView().getHandleColor());

        AnimatorSet switchAnim = new AnimatorSet();
        switchAnim.playTogether(
+6 −2
Original line number Diff line number Diff line
@@ -394,9 +394,13 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView
        if (!isValidToBubble(taskInfo)) {
            Toast.makeText(mContext, R.string.bubble_not_supported_text, Toast.LENGTH_SHORT).show();
        } else if (mCaptionView != null && taskInfo != null && taskInfo.taskDescription != null) {
            final int statusBarColor = taskInfo.taskDescription.getStatusBarColor();
            final int bgColor = taskInfo.taskDescription.getBackgroundColor();
            if (Color.alpha(bgColor) != 0) {
                // Set the caption's color to the color override of the task if not transparent.
            if (Color.alpha(statusBarColor) != 0) {
                // Set the caption's color to the color of the status bar if not transparent.
                mCaptionView.setBackgroundColor(statusBarColor);
            } else if (Color.alpha(bgColor) != 0) {
                // Otherwise, use the background color of the task if it's not transparent.
                mCaptionView.setBackgroundColor(bgColor);
            }
        }
+0 −10
Original line number Diff line number Diff line
@@ -131,16 +131,6 @@ public class BubbleBarHandleView extends View {
        invalidate();
    }

    /**
     * Set initial color for the handle. Takes effect if the
     * {@link #updateHandleColor(boolean, boolean)} has not been called.
     */
    public void setHandleInitialColor(@ColorInt int color) {
        if (color != mHandleColor) {
            setHandleColor(color);
        }
    }

    /**
     * Updates the handle color.
     *
+0 −6
Original line number Diff line number Diff line
@@ -64,10 +64,4 @@ public class BubbleBarHandleViewTest extends ShellTestCase {
        assertEquals(handleColor,
                ContextCompat.getColor(mContext, R.color.bubble_bar_expanded_view_handle_light));
    }

    @Test
    public void testSetHandleInitialColor_beforeUpdateHandleColor_updatesColor() {
        mHandleView.setHandleInitialColor(Color.RED);
        assertThat(mHandleView.getHandleColor()).isEqualTo(Color.RED);
    }
}