diff options
author | Michael Jurka <mikejurka@google.com> | 2013-09-17 22:54:22 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-17 22:54:22 +0000 |
commit | f82f344a672077da64a2d36797a24fdb737dd104 (patch) | |
tree | 8c133e4586e8408d6cc777a62d026b1d281a28fc /src/com | |
parent | ab2d9d72ae0a37553a82fa845c412167c727a258 (diff) | |
parent | 42a7174255b2d2e8f5896ab02f3b0611dabcc4a1 (diff) | |
download | android_packages_apps_Trebuchet-f82f344a672077da64a2d36797a24fdb737dd104.tar.gz android_packages_apps_Trebuchet-f82f344a672077da64a2d36797a24fdb737dd104.tar.bz2 android_packages_apps_Trebuchet-f82f344a672077da64a2d36797a24fdb737dd104.zip |
Merge "Update styling of tile to pick image as wallpaper" into jb-ub-now-indigo-rose
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher3/WallpaperPickerActivity.java | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/com/android/launcher3/WallpaperPickerActivity.java b/src/com/android/launcher3/WallpaperPickerActivity.java index fe7525a00..d980967e6 100644 --- a/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/src/com/android/launcher3/WallpaperPickerActivity.java @@ -26,6 +26,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Resources; +import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Point; import android.graphics.Rect; @@ -34,6 +35,7 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.LevelListDrawable; import android.net.Uri; import android.os.Bundle; +import android.provider.MediaStore; import android.util.Log; import android.util.Pair; import android.view.ActionMode; @@ -52,7 +54,6 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.SpinnerAdapter; -import android.widget.TextView; import com.android.photos.BitmapRegionTileSource; @@ -214,12 +215,16 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { FrameLayout galleryThumbnail = (FrameLayout) getLayoutInflater(). inflate(R.layout.wallpaper_picker_gallery_item, mWallpapersView, false); setWallpaperItemPaddingToZero(galleryThumbnail); - - TextView galleryLabel = - (TextView) galleryThumbnail.findViewById(R.id.wallpaper_item_label); - galleryLabel.setText(R.string.gallery); mWallpapersView.addView(galleryThumbnail, 0); + // Make its background the last photo taken on external storage + Bitmap lastPhoto = getThumbnailOfLastPhoto(); + if (lastPhoto != null) { + ImageView galleryThumbnailBg = + (ImageView) galleryThumbnail.findViewById(R.id.wallpaper_image); + galleryThumbnailBg.setImageBitmap(getThumbnailOfLastPhoto()); + } + ThumbnailMetaData meta = new ThumbnailMetaData(); meta.mLaunchesGallery = true; galleryThumbnail.setTag(meta); @@ -322,7 +327,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { for (View v : viewsToRemove) { mWallpapersView.removeView(v); } - ///xxxxx DESTROYING mode.finish(); // Action picked, so close the CAB return true; } else { @@ -343,6 +347,23 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } }; } + + protected Bitmap getThumbnailOfLastPhoto() { + Cursor cursor = MediaStore.Images.Media.query(getContentResolver(), + MediaStore.Images.Media.EXTERNAL_CONTENT_URI, + new String[] { MediaStore.Images.ImageColumns._ID, + MediaStore.Images.ImageColumns.DATE_TAKEN}, + null, null, MediaStore.Images.ImageColumns.DATE_TAKEN + " DESC LIMIT 1"); + Bitmap thumb = null; + if (cursor.moveToNext()) { + int id = cursor.getInt(0); + thumb = MediaStore.Images.Thumbnails.getThumbnail(getContentResolver(), + id, MediaStore.Images.Thumbnails.MINI_KIND, null); + } + cursor.close(); + return thumb; + } + protected void onSaveInstanceState(Bundle outState) { outState.putParcelableArrayList(TEMP_WALLPAPER_TILES, mTempWallpaperTiles); } |