Merge "Remove CtsViewTestCases in TEST_MAPPING file"
diff --git a/api/current.txt b/api/current.txt
index c5cd573..0b3e5c6 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -56691,6 +56691,8 @@
method public int getMaxValue();
method public int getMinValue();
method public int getSelectionDividerHeight();
+ method @ColorInt public int getTextColor();
+ method @FloatRange(from=0.0, fromInclusive=false) public float getTextSize();
method public int getValue();
method public boolean getWrapSelectorWheel();
method public void setDisplayedValues(String[]);
@@ -56701,6 +56703,8 @@
method public void setOnScrollListener(android.widget.NumberPicker.OnScrollListener);
method public void setOnValueChangedListener(android.widget.NumberPicker.OnValueChangeListener);
method public void setSelectionDividerHeight(@IntRange(from=0) @Px int);
+ method public void setTextColor(@ColorInt int);
+ method public void setTextSize(@FloatRange(from=0.0, fromInclusive=false) float);
method public void setValue(int);
method public void setWrapSelectorWheel(boolean);
}
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 89bb273..dad2669 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -17,6 +17,8 @@
package android.widget;
import android.annotation.CallSuper;
+import android.annotation.ColorInt;
+import android.annotation.FloatRange;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.Px;
@@ -340,7 +342,7 @@
/**
* The {@link Paint} for drawing the selector.
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private final Paint mSelectorWheelPaint;
/**
@@ -1718,6 +1720,44 @@
}
/**
+ * Sets the text color for all the states (normal, selected, focused) to be the given color.
+ *
+ * @param color A color value in the form 0xAARRGGBB.
+ */
+ public void setTextColor(@ColorInt int color) {
+ mSelectorWheelPaint.setColor(color);
+ mInputText.setTextColor(color);
+ invalidate();
+ }
+
+ /**
+ * @return the text color.
+ */
+ @ColorInt
+ public int getTextColor() {
+ return mSelectorWheelPaint.getColor();
+ }
+
+ /**
+ * Sets the text size to the given value. This value must be > 0
+ *
+ * @param size The size in pixel units.
+ */
+ public void setTextSize(@FloatRange(from = 0.0, fromInclusive = false) float size) {
+ mSelectorWheelPaint.setTextSize(size);
+ mInputText.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
+ invalidate();
+ }
+
+ /**
+ * @return the size (in pixels) of the text size in this NumberPicker.
+ */
+ @FloatRange(from = 0.0, fromInclusive = false)
+ public float getTextSize() {
+ return mSelectorWheelPaint.getTextSize();
+ }
+
+ /**
* Makes a measure spec that tries greedily to use the max value.
*
* @param measureSpec The measure spec.