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

Commit 97de0028 authored by Mykola Podolian's avatar Mykola Podolian Committed by Android (Google) Code Review
Browse files

Merge "Changing system language also updates bubbles" into main

parents 19817c18 ce90f818
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -247,6 +248,9 @@ public class BubbleController implements ConfigurationChangeListener,
    /** Saved font scale, used to detect font size changes in {@link #onConfigurationChanged}. */
    private float mFontScale = 0;

    /** Saved locale, used to detect local changes in {@link #onConfigurationChanged}. */
    private Locale mLocale = null;

    /** Saved direction, used to detect layout direction changes @link #onConfigChanged}. */
    private int mLayoutDirection = View.LAYOUT_DIRECTION_UNDEFINED;

@@ -1068,6 +1072,11 @@ public class BubbleController implements ConfigurationChangeListener,
                mLayoutDirection = newConfig.getLayoutDirection();
                mStackView.onLayoutDirectionChanged(mLayoutDirection);
            }
            Locale newLocale = newConfig.locale;
            if (newLocale != null && !newLocale.equals(mLocale)) {
                mLocale = newLocale;
                mStackView.updateLocale();
            }
        }
    }

+9 −0
Original line number Diff line number Diff line
@@ -517,6 +517,15 @@ public class BubbleExpandedView extends LinearLayout {
        }
    }

    void updateLocale() {
        if (mManageButton != null) {
            mManageButton.setText(mContext.getString(R.string.manage_bubbles_text));
        }
        if (mOverflowView != null) {
            mOverflowView.updateLocale();
        }
    }

    void applyThemeAttrs() {
        final TypedArray ta = mContext.obtainStyledAttributes(new int[]{
                android.R.attr.dialogCornerRadius,
+5 −0
Original line number Diff line number Diff line
@@ -242,6 +242,11 @@ public class BubbleOverflowContainerView extends LinearLayout {
        mEmptyStateSubtitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
    }

    public void updateLocale() {
        mEmptyStateTitle.setText(mContext.getString(R.string.bubble_overflow_empty_title));
        mEmptyStateSubtitle.setText(mContext.getString(R.string.bubble_overflow_empty_subtitle));
    }

    private final BubbleData.Listener mDataListener = new BubbleData.Listener() {

        @Override
+6 −0
Original line number Diff line number Diff line
@@ -1452,6 +1452,12 @@ public class BubbleStackView extends FrameLayout
        }
    }

    void updateLocale() {
        if (mBubbleOverflow != null && mBubbleOverflow.getExpandedView() != null) {
            mBubbleOverflow.getExpandedView().updateLocale();
        }
    }

    private void updateOverflow() {
        mBubbleOverflow.update();
        mBubbleContainer.reorderView(mBubbleOverflow.getIconView(),