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

Commit 1099d370 authored by Mady Mellor's avatar Mady Mellor Committed by Automerger Merge Worker
Browse files

Merge "Fix some sizes that weren't changing for font scale / display size`"...

Merge "Fix some sizes that weren't changing for font scale / display size`" into sc-dev am: 9f97f893

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14508388

Change-Id: Ifdb49df9bddb903f4ebfbe89c9f1b53865d86029
parents 23d868b8 9f97f893
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
        android:layout_height="wrap_content"
        android:focusable="true"
        android:text="@string/manage_bubbles_text"
        android:textSize="@*android:dimen/text_size_body_2_material"
        android:textColor="?android:attr/textColorPrimary"
    />

+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@
            android:text="@string/bubble_overflow_empty_title"
            android:fontFamily="@*android:string/config_bodyFontFamilyMedium"
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"
            android:textSize="@*android:dimen/text_size_body_2_material"
            android:textColor="?android:attr/textColorSecondary"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
@@ -66,6 +67,7 @@
            android:layout_height="wrap_content"
            android:fontFamily="@*android:string/config_bodyFontFamily"
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"
            android:textSize="@*android:dimen/text_size_body_2_material"
            android:textColor="?android:attr/textColorSecondary"
            android:text="@string/bubble_overflow_empty_subtitle"
            android:paddingBottom="@dimen/bubble_empty_overflow_subtitle_padding"
+1 −1
Original line number Diff line number Diff line
@@ -715,7 +715,7 @@ public class BubbleController {
            }
            if (newConfig.fontScale != mFontScale) {
                mFontScale = newConfig.fontScale;
                mStackView.updateFontScale(mFontScale);
                mStackView.updateFontScale();
            }
            if (newConfig.getLayoutDirection() != mLayoutDirection) {
                mLayoutDirection = newConfig.getLayoutDirection();
+39 −17
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.graphics.drawable.ShapeDrawable;
import android.os.RemoteException;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.SurfaceControl;
import android.view.View;
@@ -250,26 +251,14 @@ public class BubbleExpandedView extends LinearLayout {
    protected void onFinishInflate() {
        super.onFinishInflate();

        Resources res = getResources();
        mSettingsIcon = findViewById(R.id.settings_button);
        mSettingsIconHeight = getContext().getResources().getDimensionPixelSize(
                R.dimen.bubble_manage_button_height);
        mPointerView = findViewById(R.id.pointer_view);
        mPointerWidth = res.getDimensionPixelSize(R.dimen.bubble_pointer_width);
        mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height);

        mTopPointer = new ShapeDrawable(TriangleShape.create(
                mPointerWidth, mPointerHeight, true /* pointUp */));
        mLeftPointer = new ShapeDrawable(TriangleShape.createHorizontal(
                mPointerWidth, mPointerHeight, true /* pointLeft */));
        mRightPointer = new ShapeDrawable(TriangleShape.createHorizontal(
                mPointerWidth, mPointerHeight, false /* pointLeft */));

        mCurrentPointer = mTopPointer;
        mPointerView.setVisibility(INVISIBLE);

        mSettingsIconHeight = getContext().getResources().getDimensionPixelSize(
                R.dimen.bubble_manage_button_height);
        mSettingsIcon = findViewById(R.id.settings_button);

        // Set ActivityView's alpha value as zero, since there is no view content to be shown.
        // Set TaskView's alpha value as zero, since there is no view content to be shown.
        setContentVisibility(false);

        mExpandedViewContainer.setOutlineProvider(new ViewOutlineProvider() {
@@ -293,7 +282,6 @@ public class BubbleExpandedView extends LinearLayout {

        applyThemeAttrs();

        mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);
        setClipToPadding(false);
        setOnTouchListener((view, motionEvent) -> {
            if (mTaskView == null) {
@@ -354,7 +342,41 @@ public class BubbleExpandedView extends LinearLayout {
        Resources res = getResources();
        mMinHeight = res.getDimensionPixelSize(R.dimen.bubble_expanded_default_height);
        mOverflowHeight = res.getDimensionPixelSize(R.dimen.bubble_overflow_height);
        mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);

        mPointerMargin = res.getDimensionPixelSize(R.dimen.bubble_pointer_margin);
        mPointerWidth = res.getDimensionPixelSize(R.dimen.bubble_pointer_width);
        mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height);

        mTopPointer = new ShapeDrawable(TriangleShape.create(
                mPointerWidth, mPointerHeight, true /* pointUp */));
        mLeftPointer = new ShapeDrawable(TriangleShape.createHorizontal(
                mPointerWidth, mPointerHeight, true /* pointLeft */));
        mRightPointer = new ShapeDrawable(TriangleShape.createHorizontal(
                mPointerWidth, mPointerHeight, false /* pointLeft */));

        final float fontSize = mContext.getResources()
                .getDimensionPixelSize(com.android.internal.R.dimen.text_size_body_2_material);
        if (mSettingsIcon != null) {
            mSettingsIcon.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
        }
        if (mOverflowView != null) {
            mOverflowView.updateFontSize();
        }
        if (mPointerView != null) {
            updatePointerView();
        }
    }

    void updateFontSize() {
        final float fontSize = mContext.getResources()
                .getDimensionPixelSize(com.android.internal.R.dimen.text_size_body_2_material);
        if (mSettingsIcon != null) {
            mSettingsIcon.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
        }
        if (mOverflowView != null) {
            mOverflowView.updateFontSize();
        }
    }

    void applyThemeAttrs() {
+3 −4
Original line number Diff line number Diff line
@@ -216,12 +216,11 @@ public class BubbleFlyoutView extends FrameLayout {
        super.onDraw(canvas);
    }

    void updateFontSize(float fontScale) {
    void updateFontSize() {
        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);
        mMessageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
        mSenderText.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
    }

    /*
Loading