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

Commit 41c60e0c authored by Stevie Kideckel's avatar Stevie Kideckel
Browse files

Expose tint lists and other runtime functionality to RemoteViews

Bug: 180086170
Test: sample app using new methods, atest
Change-Id: I5aa5476d95d6c9fb992c4548d97f577234d747a7
parent ce4baef6
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -55074,6 +55074,7 @@ package android.widget {
    method public void setChronometerCountDown(@IdRes int, boolean);
    method public void setColor(@IdRes int, @NonNull String, @ColorRes int);
    method public void setColorInt(@IdRes int, @NonNull String, @ColorInt int, @ColorInt int);
    method public void setColorStateList(@IdRes int, @NonNull String, @Nullable android.content.res.ColorStateList);
    method public void setColorStateList(@IdRes int, @NonNull String, @Nullable android.content.res.ColorStateList, @Nullable android.content.res.ColorStateList);
    method public void setColorStateList(@IdRes int, @NonNull String, @ColorRes int);
    method public void setCompoundButtonChecked(@IdRes int, boolean);
@@ -55116,6 +55117,12 @@ package android.widget {
    method public void setTextViewText(@IdRes int, CharSequence);
    method public void setTextViewTextSize(@IdRes int, int, float);
    method public void setUri(@IdRes int, String, android.net.Uri);
    method public void setViewLayoutHeight(@IdRes int, float, int);
    method public void setViewLayoutHeightDimen(@IdRes int, @DimenRes int);
    method public void setViewLayoutMargin(@IdRes int, int, float, int);
    method public void setViewLayoutMarginDimen(@IdRes int, int, @DimenRes int);
    method public void setViewLayoutWidth(@IdRes int, float, int);
    method public void setViewLayoutWidthDimen(@IdRes int, @DimenRes int);
    method public void setViewOutlinePreferredRadius(@IdRes int, float, int);
    method public void setViewOutlinePreferredRadiusDimen(@IdRes int, @DimenRes int);
    method public void setViewPadding(@IdRes int, @Px int, @Px int, @Px int, @Px int);
@@ -55126,6 +55133,12 @@ package android.widget {
    field @NonNull public static final android.os.Parcelable.Creator<android.widget.RemoteViews> CREATOR;
    field public static final String EXTRA_CHECKED = "android.widget.extra.CHECKED";
    field public static final String EXTRA_SHARED_ELEMENT_BOUNDS = "android.widget.extra.SHARED_ELEMENT_BOUNDS";
    field public static final int MARGIN_BOTTOM = 3; // 0x3
    field public static final int MARGIN_END = 5; // 0x5
    field public static final int MARGIN_LEFT = 0; // 0x0
    field public static final int MARGIN_RIGHT = 2; // 0x2
    field public static final int MARGIN_START = 4; // 0x4
    field public static final int MARGIN_TOP = 1; // 0x1
  }
  public static class RemoteViews.ActionException extends java.lang.RuntimeException {
+19 −0
Original line number Diff line number Diff line
@@ -6996,6 +6996,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @see #getScrollIndicators()
     * @attr ref android.R.styleable#View_scrollIndicators
     */
    @RemotableViewMethod
    public void setScrollIndicators(@ScrollIndicators int indicators) {
        setScrollIndicators(indicators,
                SCROLL_INDICATORS_PFLAG3_MASK >>> SCROLL_INDICATORS_TO_PFLAGS3_LSHIFT);
@@ -11881,6 +11882,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @see #setFocusable(int)
     * @attr ref android.R.styleable#View_focusable
     */
    @RemotableViewMethod
    public void setFocusable(boolean focusable) {
        setFocusable(focusable ? FOCUSABLE : NOT_FOCUSABLE);
    }
@@ -11899,6 +11901,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @see #setFocusableInTouchMode(boolean)
     * @attr ref android.R.styleable#View_focusable
     */
    @RemotableViewMethod
    public void setFocusable(@Focusable int focusable) {
        if ((focusable & (FOCUSABLE_AUTO | FOCUSABLE)) == 0) {
            setFlags(0, FOCUSABLE_IN_TOUCH_MODE);
@@ -11917,6 +11920,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @see #setFocusable(boolean)
     * @attr ref android.R.styleable#View_focusableInTouchMode
     */
    @RemotableViewMethod
    public void setFocusableInTouchMode(boolean focusableInTouchMode) {
        // Focusable in touch mode should always be set before the focusable flag
        // otherwise, setting the focusable flag will trigger a focusableViewAvailable()
@@ -12871,6 +12875,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_focusedByDefault
     */
    @RemotableViewMethod
    public void setFocusedByDefault(boolean isFocusedByDefault) {
        if (isFocusedByDefault == ((mPrivateFlags3 & PFLAG3_FOCUSED_BY_DEFAULT) != 0)) {
            return;
@@ -16850,6 +16855,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_rotation
     */
    @RemotableViewMethod
    public void setRotation(float rotation) {
        if (rotation != getRotation()) {
            // Double-invalidation is necessary to capture view's old and new areas
@@ -16896,6 +16902,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_rotationY
     */
    @RemotableViewMethod
    public void setRotationY(float rotationY) {
        if (rotationY != getRotationY()) {
            invalidateViewProperty(true, false);
@@ -16941,6 +16948,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_rotationX
     */
    @RemotableViewMethod
    public void setRotationX(float rotationX) {
        if (rotationX != getRotationX()) {
            invalidateViewProperty(true, false);
@@ -16978,6 +16986,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_scaleX
     */
    @RemotableViewMethod
    public void setScaleX(float scaleX) {
        if (scaleX != getScaleX()) {
            scaleX = sanitizeFloatPropertyValue(scaleX, "scaleX");
@@ -17016,6 +17025,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_scaleY
     */
    @RemotableViewMethod
    public void setScaleY(float scaleY) {
        if (scaleY != getScaleY()) {
            scaleY = sanitizeFloatPropertyValue(scaleY, "scaleY");
@@ -17061,6 +17071,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_transformPivotX
     */
    @RemotableViewMethod
    public void setPivotX(float pivotX) {
        if (!mRenderNode.isPivotExplicitlySet() || pivotX != getPivotX()) {
            invalidateViewProperty(true, false);
@@ -17103,6 +17114,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_transformPivotY
     */
    @RemotableViewMethod
    public void setPivotY(float pivotY) {
        if (!mRenderNode.isPivotExplicitlySet() || pivotY != getPivotY()) {
            invalidateViewProperty(true, false);
@@ -17243,6 +17255,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_alpha
     */
    @RemotableViewMethod
    public void setAlpha(@FloatRange(from=0.0, to=1.0) float alpha) {
        ensureTransformationInfo();
        if (mTransformationInfo.mAlpha != alpha) {
@@ -17732,6 +17745,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_elevation
     */
    @RemotableViewMethod
    public void setElevation(float elevation) {
        if (elevation != getElevation()) {
            elevation = sanitizeFloatPropertyValue(elevation, "elevation");
@@ -17766,6 +17780,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_translationX
     */
    @RemotableViewMethod
    public void setTranslationX(float translationX) {
        if (translationX != getTranslationX()) {
            invalidateViewProperty(true, false);
@@ -17801,6 +17816,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_translationY
     */
    @RemotableViewMethod
    public void setTranslationY(float translationY) {
        if (translationY != getTranslationY()) {
            invalidateViewProperty(true, false);
@@ -17828,6 +17844,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @attr ref android.R.styleable#View_translationZ
     */
    @RemotableViewMethod
    public void setTranslationZ(float translationZ) {
        if (translationZ != getTranslationZ()) {
            translationZ = sanitizeFloatPropertyValue(translationZ, "translationZ");
@@ -23989,6 +24006,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @see #getBackgroundTintList()
     * @see Drawable#setTintList(ColorStateList)
     */
    @RemotableViewMethod
    public void setBackgroundTintList(@Nullable ColorStateList tint) {
        if (mBackgroundTint == null) {
            mBackgroundTint = new TintInfo();
@@ -24248,6 +24266,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @see #getForegroundTintList()
     * @see Drawable#setTintList(ColorStateList)
     */
    @RemotableViewMethod
    public void setForegroundTintList(@Nullable ColorStateList tint) {
        if (mForegroundInfo == null) {
            mForegroundInfo = new ForegroundInfo();
+1 −0
Original line number Diff line number Diff line
@@ -648,6 +648,7 @@ public class ImageView extends View {
     * @see #getImageTintList()
     * @see Drawable#setTintList(ColorStateList)
     */
    @android.view.RemotableViewMethod
    public void setImageTintList(@Nullable ColorStateList tint) {
        mDrawableTintList = tint;
        mHasDrawableTint = true;
+2 −0
Original line number Diff line number Diff line
@@ -1308,6 +1308,7 @@ public class ProgressBar extends View {
     * @see #getSecondaryProgressTintList()
     * @see Drawable#setTintList(ColorStateList)
     */
    @RemotableViewMethod
    public void setSecondaryProgressTintList(@Nullable ColorStateList tint) {
        if (mProgressTintInfo == null) {
            mProgressTintInfo = new ProgressTintInfo();
@@ -1619,6 +1620,7 @@ public class ProgressBar extends View {
     * @param stateDescription The state description.
     */
    @Override
    @RemotableViewMethod
    public void setStateDescription(@Nullable CharSequence stateDescription) {
        mCustomStateDescription = stateDescription;
        if (stateDescription == null) {
+8 −33
Original line number Diff line number Diff line
@@ -224,35 +224,17 @@ public class RemoteViews implements Parcelable, Filter {
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface MarginType {}
    /**
     * The value will apply to the marginLeft.
     * @hide
     */
    /** The value will apply to the marginLeft. */
    public static final int MARGIN_LEFT = 0;
    /**
     * The value will apply to the marginTop.
     * @hide
     */
    /** The value will apply to the marginTop. */
    public static final int MARGIN_TOP = 1;
    /**
     * The value will apply to the marginRight.
     * @hide
     */
    /** The value will apply to the marginRight. */
    public static final int MARGIN_RIGHT = 2;
    /**
     * The value will apply to the marginBottom.
     * @hide
     */
    /** The value will apply to the marginBottom. */
    public static final int MARGIN_BOTTOM = 3;
    /**
     * The value will apply to the marginStart.
     * @hide
     */
    /** The value will apply to the marginStart. */
    public static final int MARGIN_START = 4;
    /**
     * The value will apply to the marginEnd.
     * @hide
     */
    /** The value will apply to the marginEnd. */
    public static final int MARGIN_END = 5;

    /** @hide **/
@@ -4002,7 +3984,6 @@ public class RemoteViews implements Parcelable, Filter {
     * @param viewId The id of the view to change
     * @param type The margin being set e.g. {@link #MARGIN_END}
     * @param dimen a dimension resource to apply to the margin, or 0 to clear the margin.
     * @hide
     */
    public void setViewLayoutMarginDimen(@IdRes int viewId, @MarginType int type,
            @DimenRes int dimen) {
@@ -4021,7 +4002,6 @@ public class RemoteViews implements Parcelable, Filter {
     * @param type The margin being set e.g. {@link #MARGIN_END}
     * @param value a value for the margin the given units.
     * @param units The unit type of the value e.g. {@link TypedValue#COMPLEX_UNIT_DIP}
     * @hide
     */
    public void setViewLayoutMargin(@IdRes int viewId, @MarginType int type, float value,
            @ComplexDimensionUnit int units) {
@@ -4039,7 +4019,6 @@ public class RemoteViews implements Parcelable, Filter {
     *
     * @param width Width of the view in the given units
     * @param units The unit type of the value e.g. {@link TypedValue#COMPLEX_UNIT_DIP}
     * @hide
     */
    public void setViewLayoutWidth(@IdRes int viewId, float width,
            @ComplexDimensionUnit int units) {
@@ -4051,7 +4030,6 @@ public class RemoteViews implements Parcelable, Filter {
     * the result of {@link Resources#getDimensionPixelSize(int)}.
     *
     * @param widthDimen the dimension resource for the view's width
     * @hide
     */
    public void setViewLayoutWidthDimen(@IdRes int viewId, @DimenRes int widthDimen) {
        addAction(new LayoutParamAction(viewId, LayoutParamAction.LAYOUT_WIDTH, widthDimen));
@@ -4068,7 +4046,6 @@ public class RemoteViews implements Parcelable, Filter {
     *
     * @param height height of the view in the given units
     * @param units The unit type of the value e.g. {@link TypedValue#COMPLEX_UNIT_DIP}
     * @hide
     */
    public void setViewLayoutHeight(@IdRes int viewId, float height,
            @ComplexDimensionUnit int units) {
@@ -4080,7 +4057,6 @@ public class RemoteViews implements Parcelable, Filter {
     * the result of {@link Resources#getDimensionPixelSize(int)}.
     *
     * @param heightDimen a dimen resource to read the height from.
     * @hide
     */
    public void setViewLayoutHeightDimen(@IdRes int viewId, @DimenRes int heightDimen) {
        addAction(new LayoutParamAction(viewId, LayoutParamAction.LAYOUT_HEIGHT, heightDimen));
@@ -4231,10 +4207,9 @@ public class RemoteViews implements Parcelable, Filter {
     * @param viewId The id of the view on which to call the method.
     * @param methodName The name of the method to call.
     * @param value The value to pass to the method.
     *
     * @hide
     */
    public void setColorStateList(@IdRes int viewId, String methodName, ColorStateList value) {
    public void setColorStateList(@IdRes int viewId, @NonNull String methodName,
            @Nullable ColorStateList value) {
        addAction(new ReflectionAction(viewId, methodName, BaseReflectionAction.COLOR_STATE_LIST,
                value));
    }
Loading