Loading core/api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -54853,6 +54853,7 @@ package android.widget { method public int describeContents(); method public int getLayoutId(); method public String getPackage(); method @IdRes public int getViewId(); method @Deprecated public boolean onLoadClass(Class); method public void reapply(android.content.Context, android.view.View); method public void removeAllViews(@IdRes int); Loading Loading @@ -54913,6 +54914,7 @@ 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 setViewId(@IdRes int); 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); core/java/android/widget/RemoteViews.java +31 −0 Original line number Diff line number Diff line Loading @@ -358,6 +358,13 @@ public class RemoteViews implements Parcelable, Filter { @ApplyFlags private int mApplyFlags = 0; /** * Id to use to override the ID of the top-level view in this RemoteViews. * * Only used if this RemoteViews is defined from a XML layout value. */ private int mViewId = View.NO_ID; /** Class cookies of the Parcel this instance was read from. */ private Map<Class, Object> mClassCookies; Loading Loading @@ -4768,6 +4775,9 @@ public class RemoteViews implements Parcelable, Filter { inflater = inflater.cloneInContext(inflationContext); inflater.setFilter(shouldUseStaticFilter() ? INFLATER_FILTER : this); View v = inflater.inflate(rv.getLayoutId(), parent, false); if (mViewId != View.NO_ID) { v.setId(mViewId); } v.setTagInternal(R.id.widget_frame, rv.getLayoutId()); return v; } Loading Loading @@ -5715,4 +5725,25 @@ public class RemoteViews implements Parcelable, Filter { } return true; } /** * Set the ID of the top-level view of the XML layout. * * 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() { return mViewId; } } Loading
core/api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -54853,6 +54853,7 @@ package android.widget { method public int describeContents(); method public int getLayoutId(); method public String getPackage(); method @IdRes public int getViewId(); method @Deprecated public boolean onLoadClass(Class); method public void reapply(android.content.Context, android.view.View); method public void removeAllViews(@IdRes int); Loading Loading @@ -54913,6 +54914,7 @@ 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 setViewId(@IdRes int); 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);
core/java/android/widget/RemoteViews.java +31 −0 Original line number Diff line number Diff line Loading @@ -358,6 +358,13 @@ public class RemoteViews implements Parcelable, Filter { @ApplyFlags private int mApplyFlags = 0; /** * Id to use to override the ID of the top-level view in this RemoteViews. * * Only used if this RemoteViews is defined from a XML layout value. */ private int mViewId = View.NO_ID; /** Class cookies of the Parcel this instance was read from. */ private Map<Class, Object> mClassCookies; Loading Loading @@ -4768,6 +4775,9 @@ public class RemoteViews implements Parcelable, Filter { inflater = inflater.cloneInContext(inflationContext); inflater.setFilter(shouldUseStaticFilter() ? INFLATER_FILTER : this); View v = inflater.inflate(rv.getLayoutId(), parent, false); if (mViewId != View.NO_ID) { v.setId(mViewId); } v.setTagInternal(R.id.widget_frame, rv.getLayoutId()); return v; } Loading Loading @@ -5715,4 +5725,25 @@ public class RemoteViews implements Parcelable, Filter { } return true; } /** * Set the ID of the top-level view of the XML layout. * * 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() { return mViewId; } }