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

Commit 95547130 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Update time picker to match latest Material spec"

parents 10a58c8a adbc95f0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -886,6 +886,7 @@ package android {
    field public static final int numColumns = 16843032; // 0x1010118
    field public static final int numStars = 16843076; // 0x1010144
    field public static final int numbersBackgroundColor = 16843938; // 0x10104a2
    field public static final int numbersInnerTextColor = 16843999; // 0x10104df
    field public static final int numbersSelectorColor = 16843939; // 0x10104a3
    field public static final int numbersTextColor = 16843937; // 0x10104a1
    field public static final deprecated int numeric = 16843109; // 0x1010165
+1 −0
Original line number Diff line number Diff line
@@ -958,6 +958,7 @@ package android {
    field public static final int numColumns = 16843032; // 0x1010118
    field public static final int numStars = 16843076; // 0x1010144
    field public static final int numbersBackgroundColor = 16843938; // 0x10104a2
    field public static final int numbersInnerTextColor = 16843999; // 0x10104df
    field public static final int numbersSelectorColor = 16843939; // 0x10104a3
    field public static final int numbersTextColor = 16843937; // 0x10104a1
    field public static final deprecated int numeric = 16843109; // 0x1010165
+100 −196

File changed.

Preview size limit exceeded, changes collapsed.

+7 −5
Original line number Diff line number Diff line
@@ -617,17 +617,19 @@ public class RelativeLayout extends ViewGroup {
            }
        }

        // Use the bottom-most view as the baseline.
        // Use the bottom-most laid out view as the baseline.
        View baselineView = null;
        int baseline = 0;
        for (int i = 0; i < count; i++) {
            final View child = getChildAt(i);
            if (child.getVisibility() != GONE) {
                final int childBaseline = child.getBaseline();
                if (childBaseline >= baseline) {
                    baselineView = child;
                    baseline = childBaseline;
                }
            }
        }
        mBaselineView = baselineView;

        setMeasuredDimension(width, height);
+22 −8
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
    private int mInitialHourOfDay;
    private int mInitialMinute;
    private boolean mIs24HourView;
    private boolean mIsAmPmAtStart;

    // For hardware IME input.
    private char mPlaceholderText;
@@ -284,24 +285,37 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl
    }

    private void updateHeaderAmPm() {

        if (mIs24HourView) {
            mAmPmLayout.setVisibility(View.GONE);
        } else {
            // Ensure that AM/PM layout is in the correct position.
            final String dateTimePattern = DateFormat.getBestDateTimePattern(mCurrentLocale, "hm");
            final boolean amPmAtStart = dateTimePattern.startsWith("a");
            final ViewGroup parent = (ViewGroup) mAmPmLayout.getParent();
            final int targetIndex = amPmAtStart ? 0 : parent.getChildCount() - 1;
            final int currentIndex = parent.indexOfChild(mAmPmLayout);
            if (targetIndex != currentIndex) {
                parent.removeView(mAmPmLayout);
                parent.addView(mAmPmLayout, targetIndex);
            }
            final boolean isAmPmAtStart = dateTimePattern.startsWith("a");
            setAmPmAtStart(isAmPmAtStart);

            updateAmPmLabelStates(mInitialHourOfDay < 12 ? AM : PM);
        }
    }

    private void setAmPmAtStart(boolean isAmPmAtStart) {
        if (mIsAmPmAtStart != isAmPmAtStart) {
            mIsAmPmAtStart = isAmPmAtStart;

            final RelativeLayout.LayoutParams params =
                    (RelativeLayout.LayoutParams) mAmPmLayout.getLayoutParams();
            if (isAmPmAtStart) {
                params.removeRule(RelativeLayout.RIGHT_OF);
                params.addRule(RelativeLayout.LEFT_OF, mHourView.getId());
            } else {
                params.removeRule(RelativeLayout.LEFT_OF);
                params.addRule(RelativeLayout.RIGHT_OF, mMinuteView.getId());
            }

            mAmPmLayout.setLayoutParams(params);
        }
    }

    /**
     * Set the current hour.
     */
Loading