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

Commit 33882b67 authored by Stevie Kideckel's avatar Stevie Kideckel Committed by Android (Google) Code Review
Browse files

Merge "Add RemoteViews.setBlendMode and expose target methods" into sc-dev

parents 6984f885 bc1d288d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -54709,6 +54709,7 @@ package android.widget {
    method public void setAccessibilityTraversalAfter(@IdRes int, @IdRes int);
    method public void setAccessibilityTraversalBefore(@IdRes int, @IdRes int);
    method public void setBitmap(@IdRes int, String, android.graphics.Bitmap);
    method public void setBlendMode(@IdRes int, @NonNull String, @Nullable android.graphics.BlendMode);
    method public void setBoolean(@IdRes int, String, boolean);
    method public void setBundle(@IdRes int, String, android.os.Bundle);
    method public void setByte(@IdRes int, String, byte);
+2 −0
Original line number Diff line number Diff line
@@ -24032,6 +24032,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @see #getBackgroundTintMode()
     * @see Drawable#setTintBlendMode(BlendMode)
     */
    @RemotableViewMethod
    public void setBackgroundTintBlendMode(@Nullable BlendMode blendMode) {
        if (mBackgroundTint == null) {
            mBackgroundTint = new TintInfo();
@@ -24294,6 +24295,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @see #getForegroundTintMode()
     * @see Drawable#setTintBlendMode(BlendMode)
     */
    @RemotableViewMethod
    public void setForegroundTintBlendMode(@Nullable BlendMode blendMode) {
        if (mForegroundInfo == null) {
            mForegroundInfo = new ForegroundInfo();
+1 −0
Original line number Diff line number Diff line
@@ -695,6 +695,7 @@ public class ImageView extends View {
     * @see #getImageTintMode()
     * @see Drawable#setTintBlendMode(BlendMode)
     */
    @RemotableViewMethod
    public void setImageTintBlendMode(@Nullable BlendMode blendMode) {
        mDrawableBlendMode = blendMode;
        mHasDrawableBlendMode = true;
+4 −0
Original line number Diff line number Diff line
@@ -823,6 +823,7 @@ public class ProgressBar extends View {
     * @see #setIndeterminateTintList(ColorStateList)
     * @see Drawable#setTintBlendMode(BlendMode)
     */
    @RemotableViewMethod
    public void setIndeterminateTintBlendMode(@Nullable BlendMode blendMode) {
        if (mProgressTintInfo == null) {
            mProgressTintInfo = new ProgressTintInfo();
@@ -1132,6 +1133,7 @@ public class ProgressBar extends View {
     * @see #getProgressTintMode()
     * @see Drawable#setTintBlendMode(BlendMode)
     */
    @RemotableViewMethod
    public void setProgressTintBlendMode(@Nullable BlendMode blendMode) {
        if (mProgressTintInfo == null) {
            mProgressTintInfo = new ProgressTintInfo();
@@ -1248,6 +1250,7 @@ public class ProgressBar extends View {
     * @see #setProgressBackgroundTintList(ColorStateList)
     * @see Drawable#setTintBlendMode(BlendMode)
     */
    @RemotableViewMethod
    public void setProgressBackgroundTintBlendMode(@Nullable BlendMode blendMode) {
        if (mProgressTintInfo == null) {
            mProgressTintInfo = new ProgressTintInfo();
@@ -1360,6 +1363,7 @@ public class ProgressBar extends View {
     * @see #setSecondaryProgressTintList(ColorStateList)
     * @see Drawable#setTintBlendMode(BlendMode)
     */
    @RemotableViewMethod
    public void setSecondaryProgressTintBlendMode(@Nullable BlendMode blendMode) {
        if (mProgressTintInfo == null) {
            mProgressTintInfo = new ProgressTintInfo();
+23 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BlendMode;
import android.graphics.Outline;
import android.graphics.PointF;
import android.graphics.PorterDuff;
@@ -1054,6 +1055,8 @@ public class RemoteViews implements Parcelable, Filter {
                return ColorStateList.class;
            case BaseReflectionAction.ICON:
                return Icon.class;
            case BaseReflectionAction.BLEND_MODE:
                return BlendMode.class;
            default:
                return null;
        }
@@ -1400,6 +1403,7 @@ public class RemoteViews implements Parcelable, Filter {
        static final int INTENT = 14;
        static final int COLOR_STATE_LIST = 15;
        static final int ICON = 16;
        static final int BLEND_MODE = 17;

        @UnsupportedAppUsage
        String methodName;
@@ -1589,6 +1593,10 @@ public class RemoteViews implements Parcelable, Filter {
                    break;
                case ICON:
                    this.value = in.readTypedObject(Icon.CREATOR);
                    break;
                case BLEND_MODE:
                    this.value = BlendMode.fromValue(in.readInt());
                    break;
                default:
                    break;
            }
@@ -1632,6 +1640,9 @@ public class RemoteViews implements Parcelable, Filter {
                case BUNDLE:
                    out.writeBundle((Bundle) this.value);
                    break;
                case BLEND_MODE:
                    out.writeInt(BlendMode.toValue((BlendMode) this.value));
                    break;
                case URI:
                case BITMAP:
                case INTENT:
@@ -4131,6 +4142,18 @@ public class RemoteViews implements Parcelable, Filter {
        addAction(new BitmapReflectionAction(viewId, methodName, value));
    }

    /**
     * Call a method taking one BlendMode on a view in the layout for this RemoteViews.
     *
     * @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.
     */
    public void setBlendMode(@IdRes int viewId, @NonNull String methodName,
            @Nullable BlendMode value) {
        addAction(new ReflectionAction(viewId, methodName, BaseReflectionAction.BLEND_MODE, value));
    }

    /**
     * Call a method taking one Bundle on a view in the layout for this RemoteViews.
     *