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

Commit fc07f78b authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB] Don't crop Burmese characters in status bar clock.

Previously, we force-set the clock height to the font height in order to
fix font scaling (see I653584d5963b38ce2ef2ba05ca9df63280aac128,
b/298064328, and b/291168760). However, that font height doesn't take
into account characters that might descend below the baseline. That
wasn't a problem for Western arabic numerals, but is a problem for other
locales like Burmese.

It looks like setting a minimum height on the Clock and not
force-setting the height to the font height fixes b/373765578 without
regressing on b/298064328 or b/291168760.

Fixes: 373765578
Flag: EXEMPT bugfix
Test: With Western arabic numeral clock, verify clock is always
centered with notification icons. Increase & decrease font & display
size, verify clock size increases & decreases size at the same rate as
notification icons.
Test: With Burmese numeral clock, verify the same

Change-Id: I96ae59b5f4123d5f7a31189e408320b6d962a704
parent 6948d457
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -94,7 +94,8 @@
                    <com.android.systemui.statusbar.policy.Clock
                        android:id="@+id/clock"
                        android:layout_width="wrap_content"
                        android:layout_height="@dimen/status_bar_system_icons_height"
                        android:layout_height="wrap_content"
                        android:minHeight="@dimen/status_bar_system_icons_height"
                        android:layout_gravity="center_vertical"
                        android:textAppearance="@style/TextAppearance.StatusBar.Default.Clock"
                        android:singleLine="true"
+0 −11
Original line number Diff line number Diff line
@@ -38,11 +38,9 @@ import android.text.format.DateFormat;
import android.text.style.CharacterStyle;
import android.text.style.RelativeSizeSpan;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.android.settingslib.Utils;
@@ -386,15 +384,6 @@ public class Clock extends TextView implements
                mContext.getResources().getDimensionPixelSize(
                        R.dimen.status_bar_clock_end_padding),
                0);

        float fontHeight = getPaint().getFontMetricsInt(null);
        setLineHeight(TypedValue.COMPLEX_UNIT_PX, fontHeight);

        ViewGroup.LayoutParams lp = getLayoutParams();
        if (lp != null) {
            lp.height = (int) Math.ceil(fontHeight);
            setLayoutParams(lp);
        }
    }

    private void updateShowSeconds() {