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

Commit 6e653a1b authored by Lyn Han's avatar Lyn Han
Browse files

Recreate icon factory to update default scale

Issue: icons are normalized correctly on first creation, but not on subsequent theme change.

This happens because Launcher manually updates the default adaptive icon scale, but SysUI does not.

This change recreates BubbleIconFactory (a stateless class) after theme change, to update the default adaptive icon scale used by IconNormalizer.

Bug: 129158983
Test: atest SystemUITests
Test: manual - icons normalize to same size after theme change
Change-Id: Ibc0b11b10e2585bbec18d4f8a4aa4acec43b5a6a
parent 660200d0
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ public class BubbleStackView extends FrameLayout {
    private float mVerticalPosPercentBeforeRotation = -1;

    private int mBubbleSize;
    private int mIconBitmapSize;
    private int mBubblePaddingTop;
    private int mExpandedViewPadding;
    private int mExpandedAnimateXDistance;
@@ -357,8 +358,8 @@ public class BubbleStackView extends FrameLayout {
        mBubbleContainer.setClipChildren(false);
        addView(mBubbleContainer, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));

        int iconBitmapSize = getResources().getDimensionPixelSize(R.dimen.bubble_icon_bitmap_size);
        mBubbleIconFactory = new BubbleIconFactory(context, iconBitmapSize);
        mIconBitmapSize = getResources().getDimensionPixelSize(R.dimen.bubble_icon_bitmap_size);
        mBubbleIconFactory = new BubbleIconFactory(context, mIconBitmapSize);

        mExpandedViewContainer = new FrameLayout(context);
        mExpandedViewContainer.setElevation(elevation);
@@ -477,7 +478,10 @@ public class BubbleStackView extends FrameLayout {
     * Handle theme changes.
     */
    public void onThemeChanged() {
        // Recreate icon factory to update default adaptive icon scale.
        mBubbleIconFactory = new BubbleIconFactory(mContext, mIconBitmapSize);
        for (Bubble b: mBubbleData.getBubbles()) {
            b.getIconView().setBubbleIconFactory(mBubbleIconFactory);
            b.getIconView().updateViews();
            b.getExpandedView().applyThemeAttrs();
        }