summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/ic_images.pngbin0 -> 1935 bytes
-rw-r--r--res/drawable-mdpi/ic_images.pngbin0 -> 1332 bytes
-rw-r--r--res/drawable-xhdpi/ic_images.pngbin0 -> 2480 bytes
-rw-r--r--res/drawable-xxhdpi/ic_images.pngbin0 -> 2097 bytes
-rw-r--r--res/layout/wallpaper_picker_gallery_item.xml5
-rw-r--r--res/values/strings.xml4
-rw-r--r--src/com/android/launcher3/WallpaperPickerActivity.java33
7 files changed, 33 insertions, 9 deletions
diff --git a/res/drawable-hdpi/ic_images.png b/res/drawable-hdpi/ic_images.png
new file mode 100644
index 000000000..0003c6c65
--- /dev/null
+++ b/res/drawable-hdpi/ic_images.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_images.png b/res/drawable-mdpi/ic_images.png
new file mode 100644
index 000000000..aabc1237a
--- /dev/null
+++ b/res/drawable-mdpi/ic_images.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_images.png b/res/drawable-xhdpi/ic_images.png
new file mode 100644
index 000000000..3f21faf8f
--- /dev/null
+++ b/res/drawable-xhdpi/ic_images.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_images.png b/res/drawable-xxhdpi/ic_images.png
new file mode 100644
index 000000000..d00db9a00
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_images.png
Binary files differ
diff --git a/res/layout/wallpaper_picker_gallery_item.xml b/res/layout/wallpaper_picker_gallery_item.xml
index 7f30f8040..ecfba600e 100644
--- a/res/layout/wallpaper_picker_gallery_item.xml
+++ b/res/layout/wallpaper_picker_gallery_item.xml
@@ -27,11 +27,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
- android:scaleType="fitXY" />
+ android:scaleType="centerCrop" />
<TextView
android:id="@+id/wallpaper_item_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
+ android:text="@string/pick_image"
+ android:drawableTop="@drawable/ic_images"
+ android:drawablePadding="4dp"
android:textColor="#FFFFFFFF"/>
</com.android.launcher3.CheckableFrameLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e04902a16..6b9b07056 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -41,8 +41,8 @@
<!-- Label on button to delete wallpaper(s) -->
<string name="wallpaper_delete">Delete</string>
- <!-- Label on button in Wallpaper Picker that launches Gallery app -->
- <string name="gallery">Gallery</string>
+ <!-- Label on button in Wallpaper Picker to pick an image -->
+ <string name="pick_image">Pick image</string>
<!-- Option in "Select wallpaper from" dialog box -->
<string name="pick_wallpaper">Wallpapers</string>
<!-- Title of activity for cropping wallpapers -->
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);
}