OSDN Git Service

TimePicker - introduce hidden methods for CTS testing
authorAndrei Stingaceanu <stg@google.com>
Mon, 4 Jul 2016 16:40:14 +0000 (17:40 +0100)
committerAndrei Stingaceanu <stg@google.com>
Thu, 7 Jul 2016 15:05:57 +0000 (15:05 +0000)
For assisting the TimePickerTest keyboard traversal and
keyboard entries CTS tests.

Bug: 26187903
Change-Id: Ie30a006d07b7e5f75b11645e84c5df8b470cb52b

api/test-current.txt
core/java/android/widget/TimePicker.java
core/java/android/widget/TimePickerClockDelegate.java
core/java/android/widget/TimePickerSpinnerDelegate.java

index 1e01020..d6618b2 100644 (file)
@@ -48417,10 +48417,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);
index 84165cb..1bbe041 100644 (file)
@@ -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) {
index a70f2c7..59cde5b 100644 (file)
@@ -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
      */
index 513e8c3..26e1564 100644 (file)
@@ -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