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

Commit 13f56b66 authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Update flyout post fontScale change"

parents 61ec04bb 67486e57
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3547,6 +3547,7 @@
  <java-symbol type="id" name="bubble_button" />
  <java-symbol type="dimen" name="bubble_visible_padding_end" />
  <java-symbol type="dimen" name="bubble_gone_padding_end" />
  <java-symbol type="dimen" name="text_size_body_2_material" />
  <java-symbol type="dimen" name="messaging_avatar_size" />
  <java-symbol type="dimen" name="messaging_group_sending_progress_size" />
  <java-symbol type="dimen" name="messaging_image_rounding" />
+9 −0
Original line number Diff line number Diff line
@@ -231,6 +231,11 @@ public class BubbleController implements Bubbles, ConfigurationController.Config
     */
    private int mDensityDpi = Configuration.DENSITY_DPI_UNDEFINED;

    /**
     * Last known font scale, used to detect font size changes in {@link #onConfigChanged}.
     */
    private float mFontScale = 0;

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

@@ -990,6 +995,10 @@ public class BubbleController implements Bubbles, ConfigurationController.Config
                mBubbleIconFactory = new BubbleIconFactory(mContext);
                mStackView.onDisplaySizeChanged();
            }
            if (newConfig.fontScale != mFontScale) {
                mFontScale = newConfig.fontScale;
                mStackView.updateFlyout(mFontScale);
            }
            if (newConfig.getLayoutDirection() != mLayoutDirection) {
                mLayoutDirection = newConfig.getLayoutDirection();
                mStackView.onLayoutDirectionChanged(mLayoutDirection);
+9 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -212,6 +213,14 @@ public class BubbleFlyoutView extends FrameLayout {
        super.onDraw(canvas);
    }

    void updateFontSize(float fontScale) {
        final float fontSize = mContext.getResources()
                .getDimensionPixelSize(com.android.internal.R.dimen.text_size_body_2_material);
        final float newFontSize = fontSize * fontScale;
        mMessageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, newFontSize);
        mSenderText.setTextSize(TypedValue.COMPLEX_UNIT_PX, newFontSize);
    }

    /** Configures the flyout, collapsed into to dot form. */
    void setupFlyoutStartingAsDot(
            Bubble.FlyoutMessage flyoutMessage,
+4 −0
Original line number Diff line number Diff line
@@ -1156,6 +1156,10 @@ public class BubbleStackView extends FrameLayout
        addView(mFlyout, new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    }

    void updateFlyout(float fontScale) {
        mFlyout.updateFontSize(fontScale);
    }

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