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

Commit bc1d288d authored by Stevie Kideckel's avatar Stevie Kideckel
Browse files

Add RemoteViews.setBlendMode and expose target methods

Bug: 180086170
Test: sample app,atest
Change-Id: I2323d297412afb64d142bddb6608978ccc8d292f
parent 09e67dd8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -54632,6 +54632,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
@@ -24028,6 +24028,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();
@@ -24290,6 +24291,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.PorterDuff;
import android.graphics.Rect;
@@ -1031,6 +1032,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;
        }
@@ -1377,6 +1380,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;
@@ -1566,6 +1570,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;
            }
@@ -1609,6 +1617,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:
@@ -3975,6 +3986,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.
     *