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

Commit f5189839 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Restrict reflection access to NumberPickers's mSelectionWheelPaint"

parents b68e35be 11a57f22
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -56691,6 +56691,8 @@ package android.widget {
    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 @@ package android.widget {
    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);
  }
+41 −1
Original line number Diff line number Diff line
@@ -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 @@ public class NumberPicker extends LinearLayout {
    /**
     * The {@link Paint} for drawing the selector.
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
    private final Paint mSelectorWheelPaint;

    /**
@@ -1717,6 +1719,44 @@ public class NumberPicker extends LinearLayout {
        return mAccessibilityNodeProvider;
    }

    /**
     * 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.
     *