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

Commit 68a19082 authored by Isaac Katzenelson's avatar Isaac Katzenelson Committed by Android Git Automerger
Browse files

am 4955078b: Fix flickers in numeric pad of time picker

* commit '4955078b':
  Fix flickers in numeric pad of time picker
parents 6b6de0f1 4955078b
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ public class TimerView extends LinearLayout {
    private ZeroTopPaddingTextView mHoursTens, mMinutesTens;
    private TextView mSeconds;
    private final Typeface mAndroidClockMonoThin;
    private Typeface mOriginalHoursTypeface;
    private final int mWhiteColor, mGrayColor;

    public TimerView(Context context) {
@@ -43,7 +42,8 @@ public class TimerView extends LinearLayout {
    public TimerView(Context context, AttributeSet attrs) {
        super(context, attrs);

        mAndroidClockMonoThin = Typeface.createFromAsset(context.getAssets(),"fonts/AndroidClockMono-Thin.ttf");
        mAndroidClockMonoThin =
                Typeface.createFromAsset(context.getAssets(), "fonts/AndroidClockMono-Thin.ttf");
        mWhiteColor = context.getResources().getColor(R.color.clock_white);
        mGrayColor = context.getResources().getColor(R.color.clock_gray);
    }
@@ -57,8 +57,15 @@ public class TimerView extends LinearLayout {
        mHoursOnes = (ZeroTopPaddingTextView)findViewById(R.id.hours_ones);
        mMinutesOnes = (ZeroTopPaddingTextView)findViewById(R.id.minutes_ones);
        mSeconds = (TextView)findViewById(R.id.seconds);
        // If we have hours tens, we are in the alarm time picker, set the hours font to thin
        // to prevent the need to set the top paddings (see b/7407383).
        if (mHoursTens != null) {
            mHoursTens.setTypeface(mAndroidClockMonoThin);
            mHoursTens.updatePadding();
            if (mHoursOnes != null) {
            mOriginalHoursTypeface = mHoursOnes.getTypeface();
                mHoursOnes.setTypeface(mAndroidClockMonoThin);
                mHoursOnes.updatePadding();
            }
        }
        // Set the lowest time unit with thin font (excluding hundredths)
        if (mSeconds != null) {
@@ -84,29 +91,21 @@ public class TimerView extends LinearLayout {
                mHoursTens.setVisibility(View.INVISIBLE);
            } else if (hoursTensDigit == -1) {
                mHoursTens.setText("-");
                mHoursTens.setTypeface(mAndroidClockMonoThin);
                mHoursTens.setTextColor(mGrayColor);
                mHoursTens.updatePadding();
                mHoursTens.setVisibility(View.VISIBLE);
            } else {
                mHoursTens.setText(String.format("%d",hoursTensDigit));
                mHoursTens.setTypeface(mOriginalHoursTypeface);
                mHoursTens.setTextColor(mWhiteColor);
                mHoursTens.updatePadding();
                mHoursTens.setVisibility(View.VISIBLE);
            }
        }
        if (mHoursOnes != null) {
            if (hoursOnesDigit == -1) {
                mHoursOnes.setText("-");
                mHoursOnes.setTypeface(mAndroidClockMonoThin);
                mHoursOnes.setTextColor(mGrayColor);
                mHoursOnes.updatePadding();
            } else {
                mHoursOnes.setText(String.format("%d",hoursOnesDigit));
                mHoursOnes.setTypeface(mOriginalHoursTypeface);
                mHoursOnes.setTextColor(mWhiteColor);
                mHoursOnes.updatePadding();
            }
        }
        if (mMinutesTens != null) {