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

Commit 7e6ca580 authored by Bjorn Bringert's avatar Bjorn Bringert Committed by Android (Google) Code Review
Browse files

Merge "Add RemoteViews.setBundle() method."

parents a09a6e14 d755b068
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -199867,6 +199867,23 @@
<parameter name="value" type="boolean">
</parameter>
</method>
<method name="setBundle"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="viewId" type="int">
</parameter>
<parameter name="methodName" type="java.lang.String">
</parameter>
<parameter name="value" type="android.os.Bundle">
</parameter>
</method>
<method name="setByte"
 return="void"
 abstract="false"
+21 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -37,7 +38,6 @@ import android.view.ViewGroup;
import android.view.LayoutInflater.Filter;
import android.view.View.OnClickListener;

import java.lang.Class;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -283,6 +283,7 @@ public class RemoteViews implements Parcelable, Filter {
        static final int CHAR_SEQUENCE = 10;
        static final int URI = 11;
        static final int BITMAP = 12;
        static final int BUNDLE = 13;

        int viewId;
        String methodName;
@@ -342,6 +343,9 @@ public class RemoteViews implements Parcelable, Filter {
                case BITMAP:
                    this.value = Bitmap.CREATOR.createFromParcel(in);
                    break;
                case BUNDLE:
                    this.value = in.readBundle();
                    break;
                default:
                    break;
            }
@@ -394,6 +398,9 @@ public class RemoteViews implements Parcelable, Filter {
                case BITMAP:
                    ((Bitmap)this.value).writeToParcel(out, flags);
                    break;
                case BUNDLE:
                    out.writeBundle((Bundle) this.value);
                    break;
                default:
                    break;
            }
@@ -425,6 +432,8 @@ public class RemoteViews implements Parcelable, Filter {
                    return Uri.class;
                case BITMAP:
                    return Bitmap.class;
                case BUNDLE:
                    return Bundle.class;
                default:
                    return null;
            }
@@ -885,6 +894,17 @@ public class RemoteViews implements Parcelable, Filter {
        addAction(new ReflectionAction(viewId, methodName, ReflectionAction.BITMAP, value));
    }

    /**
     * Call a method taking one Bundle on a view in the layout for this RemoteViews.
     *
     * @param viewId The id of the view whose text should change
     * @param methodName The name of the method to call.
     * @param value The value to pass to the method.
     */
    public void setBundle(int viewId, String methodName, Bundle value) {
        addAction(new ReflectionAction(viewId, methodName, ReflectionAction.BUNDLE, value));
    }

    /**
     * Inflates the view hierarchy represented by this object and applies
     * all of the actions.