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

Commit 8bfe5413 authored by Mady Mellor's avatar Mady Mellor
Browse files

Theme changes for flyout

Flyout radius / background wasn't being updated on theme change. This
CL fixes that.

Test: manual - 1) post a bubble, note the flyout, toggle dark mode, post a
                  bubble, note the flyout background & text colour is
                  accurate
               2) post a bubble, note the flyout, change theme to something
                  with different radius (e.g. circle -> square icons),
                  post a bubble, note the flyout radius matches the theme
Bug: 138749133
Change-Id: I74d9dedc5099f6b24eaf9a90ff4fb1a22db9d7d8
parent 8d82eb6c
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -370,13 +370,7 @@ public class BubbleStackView extends FrameLayout {
        mExpandedViewContainer.setClipChildren(false);
        addView(mExpandedViewContainer);

        mFlyout = new BubbleFlyoutView(context);
        mFlyout.setVisibility(GONE);
        mFlyout.animate()
                .setDuration(FLYOUT_ALPHA_ANIMATION_DURATION)
                .setInterpolator(new AccelerateDecelerateInterpolator());
        addView(mFlyout, new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));

        setUpFlyout();
        mFlyoutTransitionSpring.setSpring(new SpringForce()
                .setStiffness(SpringForce.STIFFNESS_LOW)
                .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY));
@@ -474,12 +468,25 @@ public class BubbleStackView extends FrameLayout {
        });
    }

    private void setUpFlyout() {
        if (mFlyout != null) {
            removeView(mFlyout);
        }
        mFlyout = new BubbleFlyoutView(getContext());
        mFlyout.setVisibility(GONE);
        mFlyout.animate()
                .setDuration(FLYOUT_ALPHA_ANIMATION_DURATION)
                .setInterpolator(new AccelerateDecelerateInterpolator());
        addView(mFlyout, new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    }

    /**
     * Handle theme changes.
     */
    public void onThemeChanged() {
        // Recreate icon factory to update default adaptive icon scale.
        mBubbleIconFactory = new BubbleIconFactory(mContext, mIconBitmapSize);
        setUpFlyout();
        for (Bubble b: mBubbleData.getBubbles()) {
            b.getIconView().setBubbleIconFactory(mBubbleIconFactory);
            b.getIconView().updateViews();