diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2014-07-16 16:04:08 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2014-07-16 16:19:23 -0700 |
commit | cdc4dbd878a1f45d21c2881127cd5194e4e48ced (patch) | |
tree | 508c73e56380e64cfa7a7430bb5bdcfdf08bf10d /WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java | |
parent | 3484638cad97e255a412b0489a63873fb3ca4218 (diff) | |
download | android_packages_apps_Trebuchet-cdc4dbd878a1f45d21c2881127cd5194e4e48ced.tar.gz android_packages_apps_Trebuchet-cdc4dbd878a1f45d21c2881127cd5194e4e48ced.tar.bz2 android_packages_apps_Trebuchet-cdc4dbd878a1f45d21c2881127cd5194e4e48ced.zip |
Adding options in the partner apk to disable the default wallpaper and
provide a folder containing additional wallpapers
issue: 16045459
Change-Id: Id411121ff552d0d270258a5b371d1fd756bd7884
Diffstat (limited to 'WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java')
-rw-r--r-- | WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java b/WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java index 44bfdf1f9..2bdf8f1cd 100644 --- a/WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java +++ b/WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java @@ -34,8 +34,6 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListAdapter; -import com.android.photos.BitmapRegionTileSource; - import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -49,39 +47,17 @@ public class SavedWallpaperImages extends BaseAdapter implements ListAdapter { Context mContext; LayoutInflater mLayoutInflater; - public static class SavedWallpaperTile extends WallpaperPickerActivity.WallpaperTileInfo { + public static class SavedWallpaperTile extends WallpaperPickerActivity.FileWallpaperInfo { private int mDbId; - private Drawable mThumb; - public SavedWallpaperTile(int dbId, Drawable thumb) { + public SavedWallpaperTile(int dbId, File target, Drawable thumb) { + super(target, thumb); mDbId = dbId; - mThumb = thumb; - } - @Override - public void onClick(WallpaperPickerActivity a) { - String imageFilename = a.getSavedImages().getImageFilename(mDbId); - File file = new File(a.getFilesDir(), imageFilename); - BitmapRegionTileSource.FilePathBitmapSource bitmapSource = - new BitmapRegionTileSource.FilePathBitmapSource(file.getAbsolutePath(), 1024); - a.setCropViewTileSource(bitmapSource, false, true, null); - } - @Override - public void onSave(WallpaperPickerActivity a) { - boolean finishActivityWhenDone = true; - String imageFilename = a.getSavedImages().getImageFilename(mDbId); - a.setWallpaper(imageFilename, finishActivityWhenDone); } + @Override public void onDelete(WallpaperPickerActivity a) { a.getSavedImages().deleteImage(mDbId); } - @Override - public boolean isSelectable() { - return true; - } - @Override - public boolean isNamelessWallpaper() { - return true; - } } public SavedWallpaperImages(Activity context) { @@ -98,7 +74,8 @@ public class SavedWallpaperImages extends BaseAdapter implements ListAdapter { SQLiteDatabase db = mDb.getReadableDatabase(); Cursor result = db.query(ImageDb.TABLE_NAME, new String[] { ImageDb.COLUMN_ID, - ImageDb.COLUMN_IMAGE_THUMBNAIL_FILENAME }, // cols to return + ImageDb.COLUMN_IMAGE_THUMBNAIL_FILENAME, + ImageDb.COLUMN_IMAGE_FILENAME}, // cols to return null, // select query null, // args to select query null, @@ -112,7 +89,9 @@ public class SavedWallpaperImages extends BaseAdapter implements ListAdapter { Bitmap thumb = BitmapFactory.decodeFile(file.getAbsolutePath()); if (thumb != null) { - mImages.add(new SavedWallpaperTile(result.getInt(0), new BitmapDrawable(thumb))); + mImages.add(new SavedWallpaperTile(result.getInt(0), + new File(mContext.getFilesDir(), result.getString(2)), + new BitmapDrawable(thumb))); } } result.close(); @@ -136,15 +115,7 @@ public class SavedWallpaperImages extends BaseAdapter implements ListAdapter { Log.e(TAG, "Error decoding thumbnail for wallpaper #" + position); } return WallpaperPickerActivity.createImageTileView( - mLayoutInflater, position, convertView, parent, thumbDrawable); - } - - public String getImageFilename(int id) { - Pair<String, String> filenames = getImageFilenames(id); - if (filenames != null) { - return filenames.second; - } - return null; + mLayoutInflater, convertView, parent, thumbDrawable); } private Pair<String, String> getImageFilenames(int id) { |