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

Commit d26a0b7b authored by Pierre Barbier de Reuille's avatar Pierre Barbier de Reuille Committed by Android (Google) Code Review
Browse files

Merge "Replace RemoteViews#setViewId with a constructor" into sc-dev

parents 9576b5a2 2837eab1
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -55492,6 +55492,7 @@ package android.widget {
  public class RemoteViews implements android.view.LayoutInflater.Filter android.os.Parcelable {
  public class RemoteViews implements android.view.LayoutInflater.Filter android.os.Parcelable {
    ctor public RemoteViews(String, int);
    ctor public RemoteViews(String, int);
    ctor public RemoteViews(@NonNull String, @LayoutRes int, @IdRes int);
    ctor public RemoteViews(android.widget.RemoteViews, android.widget.RemoteViews);
    ctor public RemoteViews(android.widget.RemoteViews, android.widget.RemoteViews);
    ctor public RemoteViews(@NonNull java.util.Map<android.util.SizeF,android.widget.RemoteViews>);
    ctor public RemoteViews(@NonNull java.util.Map<android.util.SizeF,android.widget.RemoteViews>);
    ctor public RemoteViews(android.widget.RemoteViews);
    ctor public RemoteViews(android.widget.RemoteViews);
@@ -55565,7 +55566,6 @@ package android.widget {
    method public void setTextViewText(@IdRes int, CharSequence);
    method public void setTextViewText(@IdRes int, CharSequence);
    method public void setTextViewTextSize(@IdRes int, int, float);
    method public void setTextViewTextSize(@IdRes int, int, float);
    method public void setUri(@IdRes int, String, android.net.Uri);
    method public void setUri(@IdRes int, String, android.net.Uri);
    method public void setViewId(@IdRes int);
    method public void setViewLayoutHeight(@IdRes int, float, int);
    method public void setViewLayoutHeight(@IdRes int, float, int);
    method public void setViewLayoutHeightDimen(@IdRes int, @DimenRes int);
    method public void setViewLayoutHeightDimen(@IdRes int, @DimenRes int);
    method public void setViewLayoutMargin(@IdRes int, int, float, int);
    method public void setViewLayoutMargin(@IdRes int, int, float, int);
+9 −27
Original line number Original line Diff line number Diff line
@@ -3263,16 +3263,14 @@ public class RemoteViews implements Parcelable, Filter {


    /**
    /**
     * Create a new RemoteViews object that will display the views contained
     * Create a new RemoteViews object that will display the views contained
     * in the specified layout file.
     * in the specified layout file and change the id of the root view to the specified one.
     *
     * @param packageName Name of the package that contains the layout resource.
     * @param userId The user under which the package is running.
     * @param layoutId The id of the layout resource.
     *
     *
     * @hide
     * @param packageName Name of the package that contains the layout resource
     * @param layoutId The id of the layout resource
     */
     */
    public RemoteViews(String packageName, int userId, @LayoutRes int layoutId) {
    public RemoteViews(@NonNull String packageName, @LayoutRes int layoutId, @IdRes int viewId) {
        this(getApplicationInfo(packageName, userId), layoutId);
        this(packageName, layoutId);
        this.mViewId = viewId;
    }
    }


    /**
    /**
@@ -3727,7 +3725,7 @@ public class RemoteViews implements Parcelable, Filter {
     * The {@code stableId} will be used to identify a potential view to recycled when the remote
     * The {@code stableId} will be used to identify a potential view to recycled when the remote
     * view is inflated. Views can be re-used if inserted in the same order, potentially with
     * view is inflated. Views can be re-used if inserted in the same order, potentially with
     * some views appearing / disappearing. To be recycled the view must not change the layout
     * some views appearing / disappearing. To be recycled the view must not change the layout
     * used to inflate it or its view id (see {@link RemoteViews#setViewId}).
     * used to inflate it or its view id (see {@link RemoteViews#RemoteViews(String, int, int)}).
     *
     *
     * Note: if a view is re-used, all the actions will be re-applied on it. However, its properties
     * Note: if a view is re-used, all the actions will be re-applied on it. However, its properties
     * are not reset, so what was applied in previous round will have an effect. As a view may be
     * are not reset, so what was applied in previous round will have an effect. As a view may be
@@ -6340,25 +6338,9 @@ public class RemoteViews implements Parcelable, Filter {
    }
    }


    /**
    /**
     * Set the ID of the top-level view of the XML layout.
     * Get the ID of the top-level view of the XML layout, if set using
     *
     * {@link RemoteViews#RemoteViews(String, int, int)}.
     * The view's ID is changed right after inflation, before it gets added to its parent. The ID
     * of a given view can never change after the initial inflation.
     *
     * Set to {@link View#NO_ID} to reset and simply keep the id defined in the XML layout.
     *
     * @throws UnsupportedOperationException if the method is called on a RemoteViews defined in
     * term of other RemoteViews (e.g. {@link #RemoteViews(RemoteViews, RemoteViews)}).
     */
     */
    public void setViewId(@IdRes int viewId) {
        if (hasMultipleLayouts()) {
            throw new UnsupportedOperationException(
                    "The viewId can only be set on RemoteViews defined from a XML layout.");
        }
        mViewId = viewId;
    }

    /** Get the ID of the top-level view of the XML layout, as set by {@link #setViewId}. */
    public @IdRes int getViewId() {
    public @IdRes int getViewId() {
        return mViewId;
        return mViewId;
    }
    }