diff options
| author | Winson Chung <winsonc@google.com> | 2010-07-16 11:18:17 -0700 |
|---|---|---|
| committer | Winson Chung <winsonc@google.com> | 2010-07-19 14:48:31 -0700 |
| commit | 499cb9f516062b654952d282f211bee44c31a3c2 (patch) | |
| tree | 3c9bac8b31275e886bfbd07805c38839c185eab2 /core/java/android/widget/RemoteViews.java | |
| parent | b5b37f3bcc3065959c27e588f065dfb33a061e1d (diff) | |
Initial changes to allow collections in widgets.
Change-Id: I3cfa899bae88cd252912cecebc12e93c27a3b7c9
Diffstat (limited to 'core/java/android/widget/RemoteViews.java')
| -rw-r--r-- | core/java/android/widget/RemoteViews.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index fc02acf18254..bbc75b9165d9 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -285,6 +285,7 @@ public class RemoteViews implements Parcelable, Filter { static final int URI = 11; static final int BITMAP = 12; static final int BUNDLE = 13; + static final int INTENT = 14; int viewId; String methodName; @@ -347,6 +348,9 @@ public class RemoteViews implements Parcelable, Filter { case BUNDLE: this.value = in.readBundle(); break; + case INTENT: + this.value = Intent.CREATOR.createFromParcel(in); + break; default: break; } @@ -402,6 +406,9 @@ public class RemoteViews implements Parcelable, Filter { case BUNDLE: out.writeBundle((Bundle) this.value); break; + case INTENT: + ((Intent)this.value).writeToParcel(out, flags); + break; default: break; } @@ -435,6 +442,8 @@ public class RemoteViews implements Parcelable, Filter { return Bitmap.class; case BUNDLE: return Bundle.class; + case INTENT: + return Intent.class; default: return null; } @@ -770,6 +779,37 @@ public class RemoteViews implements Parcelable, Filter { } /** + * Equivalent to calling {@link android.widget.AbsListView#setRemoteViewsAdapter(Intent)}. + * + * @param viewId The id of the view whose text should change + * @param intent The intent of the service which will be + * providing data to the RemoteViewsAdapter + */ + public void setRemoteAdapter(int viewId, Intent intent) { + setIntent(viewId, "setRemoteViewsAdapter", intent); + } + + /** + * Equivalent to calling {@link android.widget.AbsListView#smoothScrollToPosition(int, int)}. + * + * @param viewId The id of the view whose text should change + * @param position Scroll to this adapter position + */ + public void setScrollPosition(int viewId, int position) { + setInt(viewId, "smoothScrollToPosition", position); + } + + /** + * Equivalent to calling {@link android.widget.AbsListView#smoothScrollToPosition(int, int)}. + * + * @param viewId The id of the view whose text should change + * @param position Scroll by this adapter position offset + */ + public void setRelativeScrollPosition(int viewId, int offset) { + setInt(viewId, "smoothScrollByOffset", offset); + } + + /** * Call a method taking one boolean on a view in the layout for this RemoteViews. * * @param viewId The id of the view whose text should change @@ -916,6 +956,16 @@ public class RemoteViews implements Parcelable, Filter { } /** + * + * @param viewId + * @param methodName + * @param value + */ + public void setIntent(int viewId, String methodName, Intent value) { + addAction(new ReflectionAction(viewId, methodName, ReflectionAction.INTENT, value)); + } + + /** * Inflates the view hierarchy represented by this object and applies * all of the actions. * |
