diff options
author | Patrick Dubroy <dubroy@google.com> | 2010-06-23 14:56:28 -0700 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2010-06-28 16:39:19 -0700 |
commit | d2db2a579440608453994b64eb5b425840f5307a (patch) | |
tree | 1b0ac174cf229a18afa305d6cbe96a4837561b68 | |
parent | ab3593956c9eefc85e07cf6bcc847b696da8dccc (diff) | |
download | frameworks_base-d2db2a579440608453994b64eb5b425840f5307a.zip frameworks_base-d2db2a579440608453994b64eb5b425840f5307a.tar.gz frameworks_base-d2db2a579440608453994b64eb5b425840f5307a.tar.bz2 |
Add a new attribute to allow widgets to specify a preview image.
Change-Id: I0d79c85c6a2fc477af17eda05eabaa3151b0bef5
-rw-r--r-- | api/current.xml | 11 | ||||
-rw-r--r-- | core/java/android/appwidget/AppWidgetProviderInfo.java | 13 | ||||
-rwxr-xr-x | core/res/res/values/attrs.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 1 | ||||
-rw-r--r-- | services/java/com/android/server/AppWidgetService.java | 3 |
5 files changed, 31 insertions, 0 deletions
diff --git a/api/current.xml b/api/current.xml index dc4ba2c..8f07408 100644 --- a/api/current.xml +++ b/api/current.xml @@ -7555,6 +7555,17 @@ visibility="public" > </field> +<field name="previewImage" + type="int" + transient="false" + volatile="false" + value="16843541" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="priority" type="int" transient="false" diff --git a/core/java/android/appwidget/AppWidgetProviderInfo.java b/core/java/android/appwidget/AppWidgetProviderInfo.java index cee2865..396e92d 100644 --- a/core/java/android/appwidget/AppWidgetProviderInfo.java +++ b/core/java/android/appwidget/AppWidgetProviderInfo.java @@ -110,6 +110,17 @@ public class AppWidgetProviderInfo implements Parcelable { * @hide Pending API approval */ public String oldName; + + /** + * A preview of what the AppWidget will look like after it's configured. + * If not supplied, the AppWidget's icon will be used. + * + * <p>This field corresponds to the <code>android:previewImage</code> attribute in + * the <code><receiver></code> element in the AndroidManifest.xml file. + * + * @hide Pending API approval + */ + public int previewImage; public AppWidgetProviderInfo() { } @@ -130,6 +141,7 @@ public class AppWidgetProviderInfo implements Parcelable { } this.label = in.readString(); this.icon = in.readInt(); + this.previewImage = in.readInt(); } @@ -152,6 +164,7 @@ public class AppWidgetProviderInfo implements Parcelable { } out.writeString(this.label); out.writeInt(this.icon); + out.writeInt(this.previewImage); } public int describeContents() { diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 3d31c27..7470eca 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -3585,6 +3585,9 @@ <!-- A class name in the AppWidget's package to be launched to configure. If not supplied, then no activity will be launched. --> <attr name="configure" format="string" /> + <!-- A preview of what the AppWidget will look like after it's configured. + If not supplied, the AppWidget's icon will be used. --> + <attr name="previewImage" format="reference" /> </declare-styleable> <!-- =============================== --> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 3d2db39..e98c8af 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1299,6 +1299,7 @@ <public type="attr" name="actionButtonStyle" /> <public type="attr" name="showAsAction" /> <public type="attr" name="actionButtonPadding" /> + <public type="attr" name="previewImage" /> <public type="id" name="home" /> diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java index 3ed6c12..1674221 100644 --- a/services/java/com/android/server/AppWidgetService.java +++ b/services/java/com/android/server/AppWidgetService.java @@ -741,6 +741,9 @@ class AppWidgetService extends IAppWidgetService.Stub } info.label = activityInfo.loadLabel(mPackageManager).toString(); info.icon = ri.getIconResource(); + info.previewImage = sa.getResourceId( + com.android.internal.R.styleable.AppWidgetProviderInfo_previewImage, 0); + sa.recycle(); } catch (Exception e) { // Ok to catch Exception here, because anything going wrong because |