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

Commit 0c112eb6 authored by mpodolian's avatar mpodolian
Browse files

Made expanded bubble "Manage" button update on theme change.

Add code to reinflate manage button on device theme changed.

Fixes: 337210665
Test: Manual. Expand bubble, observe manage button text and background
colors. Change the device theme from light to dark or opposite. Observe
manage button is updated text and background colors according to the
new theme.
Flag: NONE

Change-Id: I9732dae1124152078ede61d7076dcedc673aa023
parent 057d218e
Loading
Loading
Loading
Loading
+41 −27
Original line number Original line Diff line number Diff line
@@ -482,11 +482,19 @@ public class BubbleExpandedView extends LinearLayout {
                mPointerWidth, mPointerHeight, true /* pointLeft */));
                mPointerWidth, mPointerHeight, true /* pointLeft */));
        mRightPointer = new ShapeDrawable(TriangleShape.createHorizontal(
        mRightPointer = new ShapeDrawable(TriangleShape.createHorizontal(
                mPointerWidth, mPointerHeight, false /* pointLeft */));
                mPointerWidth, mPointerHeight, false /* pointLeft */));
        if (mPointerView != null) {
        updatePointerViewIfExists();
            updatePointerView();
        updateManageButtonIfExists();
    }
    }


        if (mManageButton != null) {

    /**
     * Reinflate manage button if {@link #mManageButton} is initialized.
     * Does nothing otherwise.
     */
    private void updateManageButtonIfExists() {
        if (mManageButton == null) {
            return;
        }
        int visibility = mManageButton.getVisibility();
        int visibility = mManageButton.getVisibility();
        removeView(mManageButton);
        removeView(mManageButton);
        ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(),
        ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(),
@@ -507,7 +515,6 @@ public class BubbleExpandedView extends LinearLayout {
            setTouchDelegate(new TouchDelegate(r, mManageButton));
            setTouchDelegate(new TouchDelegate(r, mManageButton));
        });
        });
    }
    }
    }


    void updateFontSize() {
    void updateFontSize() {
        final float fontSize = mContext.getResources()
        final float fontSize = mContext.getResources()
@@ -548,11 +555,18 @@ public class BubbleExpandedView extends LinearLayout {
        if (mTaskView != null) {
        if (mTaskView != null) {
            mTaskView.setCornerRadius(mCornerRadius);
            mTaskView.setCornerRadius(mCornerRadius);
        }
        }
        updatePointerView();
        updatePointerViewIfExists();
        updateManageButtonIfExists();
    }
    }


    /** Updates the size and visuals of the pointer. **/
    /**
    private void updatePointerView() {
     * Updates the size and visuals of the pointer if {@link #mPointerView} is initialized.
     * Does nothing otherwise.
     */
    private void updatePointerViewIfExists() {
        if (mPointerView == null) {
            return;
        }
        LayoutParams lp = (LayoutParams) mPointerView.getLayoutParams();
        LayoutParams lp = (LayoutParams) mPointerView.getLayoutParams();
        if (mCurrentPointer == mLeftPointer || mCurrentPointer == mRightPointer) {
        if (mCurrentPointer == mLeftPointer || mCurrentPointer == mRightPointer) {
            lp.width = mPointerHeight;
            lp.width = mPointerHeight;
@@ -1055,7 +1069,7 @@ public class BubbleExpandedView extends LinearLayout {
        // Post because we need the width of the view
        // Post because we need the width of the view
        post(() -> {
        post(() -> {
            mCurrentPointer = showVertically ? onLeft ? mLeftPointer : mRightPointer : mTopPointer;
            mCurrentPointer = showVertically ? onLeft ? mLeftPointer : mRightPointer : mTopPointer;
            updatePointerView();
            updatePointerViewIfExists();
            if (showVertically) {
            if (showVertically) {
                mPointerPos.y = bubbleCenter - (mPointerWidth / 2f);
                mPointerPos.y = bubbleCenter - (mPointerWidth / 2f);
                if (!isRtl) {
                if (!isRtl) {