diff options
| author | 2009-09-22 22:06:38 -0400 | |
|---|---|---|
| committer | 2009-09-22 22:06:38 -0400 | |
| commit | 520ca7e503498f394ad67faf8caecea25a1930ea (patch) | |
| tree | 7a3bd5ab7673b3220e067cfabb2cd37eaf734520 | |
| parent | c3c6621a2cf2f0d40d062dcad1c9f65485473841 (diff) | |
| parent | 465ccb8a4083f5fdda429336f7f093c818eb78e5 (diff) | |
Merge change 26415 into eclair
* changes:
  Add support for thumbnails to WallpaperInfo.
| -rw-r--r-- | api/current.xml | 11 | ||||
| -rw-r--r-- | core/java/android/app/WallpaperInfo.java | 28 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 3 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 1 | 
4 files changed, 43 insertions, 0 deletions
diff --git a/api/current.xml b/api/current.xml index 68a1c76bb1c4..581d2c493ed1 100644 --- a/api/current.xml +++ b/api/current.xml @@ -8259,6 +8259,17 @@   visibility="public"  >  </field> +<field name="thumbnail" + type="int" + transient="false" + volatile="false" + value="16843429" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field>  <field name="tileMode"   type="int"   transient="false" diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java index 5e44bc78064e..587e8f9bc656 100644 --- a/core/java/android/app/WallpaperInfo.java +++ b/core/java/android/app/WallpaperInfo.java @@ -40,6 +40,11 @@ public final class WallpaperInfo implements Parcelable {      final String mSettingsActivityName;      /** +     * Resource identifier for this wallpaper's thumbnail image. +     */ +    final int mThumbnailResource; + +    /**       * Constructor.       *        * @param context The Context in which we are parsing the wallpaper. @@ -53,6 +58,7 @@ public final class WallpaperInfo implements Parcelable {          PackageManager pm = context.getPackageManager();          String settingsActivityComponent = null; +        int thumbnailRes = -1;          XmlResourceParser parser = null;          try { @@ -79,16 +85,23 @@ public final class WallpaperInfo implements Parcelable {                      com.android.internal.R.styleable.Wallpaper);              settingsActivityComponent = sa.getString(                      com.android.internal.R.styleable.Wallpaper_settingsActivity); +             +            thumbnailRes = sa.getResourceId( +                    com.android.internal.R.styleable.Wallpaper_thumbnail, +                    -1); +              sa.recycle();          } finally {              if (parser != null) parser.close();          }          mSettingsActivityName = settingsActivityComponent; +        mThumbnailResource = thumbnailRes;      }      WallpaperInfo(Parcel source) {          mSettingsActivityName = source.readString(); +        mThumbnailResource = source.readInt();          mService = ResolveInfo.CREATOR.createFromParcel(source);      } @@ -144,6 +157,20 @@ public final class WallpaperInfo implements Parcelable {      }      /** +     * Load the thumbnail image for this wallpaper. +     *  +     * @param pm Supply a PackageManager used to load the wallpaper's +     * resources. +     */ +    public Drawable loadThumbnail(PackageManager pm) { +        if (mThumbnailResource < 0) return null; + +        return pm.getDrawable(mService.serviceInfo.packageName, +                              mThumbnailResource, +                              null); +    } +     +    /**       * Return the class name of an activity that provides a settings UI for       * the wallpaper.  You can launch this activity be starting it with       * an {@link android.content.Intent} whose action is MAIN and with an @@ -178,6 +205,7 @@ public final class WallpaperInfo implements Parcelable {       */      public void writeToParcel(Parcel dest, int flags) {          dest.writeString(mSettingsActivityName); +        dest.writeInt(mThumbnailResource);          mService.writeToParcel(dest, flags);      } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index a0d046f6748c..193fdb2bbe38 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -3451,6 +3451,9 @@          <!-- Component name of an activity that allows the user to modify               the current settings for this wallpaper. -->          <attr name="settingsActivity" /> + +        <!-- Reference to a the wallpaper's thumbnail bitmap. --> +        <attr name="thumbnail" format="reference" />      </declare-styleable>      <!-- =============================== --> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index b08a58aa3ee8..4d23ef4ef6ac 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1169,6 +1169,7 @@    <public type="attr" name="summaryColumn" />    <public type="attr" name="detailColumn" />    <public type="attr" name="detailSocialSummary" /> +  <public type="attr" name="thumbnail" />    <public type="style" name="Theme.Wallpaper" />    <public type="style" name="Theme.Wallpaper.NoTitleBar" />  |