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

Commit a024ebf3 authored by Andrei Stingaceanu's avatar Andrei Stingaceanu Committed by Android (Google) Code Review
Browse files

Merge "TimePicker - introduce hidden methods for CTS testing"

parents 4689cd95 f87b0e12
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -48404,10 +48404,14 @@ package android.widget {
    ctor public TimePicker(android.content.Context, android.util.AttributeSet);
    ctor public TimePicker(android.content.Context, android.util.AttributeSet, int);
    ctor public TimePicker(android.content.Context, android.util.AttributeSet, int, int);
    method public android.view.View getAmView();
    method public deprecated java.lang.Integer getCurrentHour();
    method public deprecated java.lang.Integer getCurrentMinute();
    method public int getHour();
    method public android.view.View getHourView();
    method public int getMinute();
    method public android.view.View getMinuteView();
    method public android.view.View getPmView();
    method public boolean is24HourView();
    method public deprecated void setCurrentHour(java.lang.Integer);
    method public deprecated void setCurrentMinute(java.lang.Integer);
+37 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.widget;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.annotation.Widget;
import android.content.Context;
import android.content.res.Configuration;
@@ -250,6 +251,30 @@ public class TimePicker extends FrameLayout {
        return mDelegate.dispatchPopulateAccessibilityEvent(event);
    }

    /** @hide */
    @TestApi
    public View getHourView() {
        return mDelegate.getHourView();
    }

    /** @hide */
    @TestApi
    public View getMinuteView() {
        return mDelegate.getMinuteView();
    }

    /** @hide */
    @TestApi
    public View getAmView() {
        return mDelegate.getAmView();
    }

    /** @hide */
    @TestApi
    public View getPmView() {
        return mDelegate.getPmView();
    }

    /**
     * A delegate interface that defined the public API of the TimePicker. Allows different
     * TimePicker implementations. This would need to be implemented by the TimePicker delegates
@@ -277,6 +302,18 @@ public class TimePicker extends FrameLayout {

        boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event);
        void onPopulateAccessibilityEvent(AccessibilityEvent event);

        /** @hide */
        @TestApi View getHourView();

        /** @hide */
        @TestApi View getMinuteView();

        /** @hide */
        @TestApi View getAmView();

        /** @hide */
        @TestApi View getPmView();
    }

    static String[] getAmPmStrings(Context context) {
+29 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.widget;

import android.annotation.Nullable;
import android.annotation.TestApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
@@ -541,6 +542,34 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate {
        event.getText().add(selectedTime + " " + selectionMode);
    }

    /** @hide */
    @Override
    @TestApi
    public View getHourView() {
        return mHourView;
    }

    /** @hide */
    @Override
    @TestApi
    public View getMinuteView() {
        return mMinuteView;
    }

    /** @hide */
    @Override
    @TestApi
    public View getAmView() {
        return mAmLabel;
    }

    /** @hide */
    @Override
    @TestApi
    public View getPmView() {
        return mPmLabel;
    }

    /**
     * @return the index of the current item showing
     */
+29 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.widget;

import android.annotation.TestApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcelable;
@@ -413,6 +414,34 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate {
        event.getText().add(selectedDateUtterance);
    }

    /** @hide */
    @Override
    @TestApi
    public View getHourView() {
        return mHourSpinnerInput;
    }

    /** @hide */
    @Override
    @TestApi
    public View getMinuteView() {
        return mMinuteSpinnerInput;
    }

    /** @hide */
    @Override
    @TestApi
    public View getAmView() {
        return mAmPmSpinnerInput;
    }

    /** @hide */
    @Override
    @TestApi
    public View getPmView() {
        return mAmPmSpinnerInput;
    }

    private void updateInputState() {
        // Make sure that if the user changes the value and the IME is active
        // for one of the inputs if this widget, the IME is closed. If the user