diff options
| author | Ruben Brunk <rubenbrunk@google.com> | 2013-02-22 17:52:59 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-02-22 17:52:59 +0000 |
| commit | 2c87aafc0e4c5f67fe41c0cac301eabb6d5c716e (patch) | |
| tree | 8515408ee173acf7b2d39ff4a3d94a8c5b9860ac | |
| parent | e5498da0262fc836738aad63ea30286d8afa643c (diff) | |
| parent | a24145829118672e8b9b98e18de78eae71daaa08 (diff) | |
| download | android_packages_apps_Gallery2-2c87aafc0e4c5f67fe41c0cac301eabb6d5c716e.tar.gz android_packages_apps_Gallery2-2c87aafc0e4c5f67fe41c0cac301eabb6d5c716e.tar.bz2 android_packages_apps_Gallery2-2c87aafc0e4c5f67fe41c0cac301eabb6d5c716e.zip | |
Merge "Move setting wallpaper to a background thread." into gb-ub-photos-bryce
| -rw-r--r-- | res/values/filtershow_strings.xml | 2 | ||||
| -rw-r--r-- | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 29 |
2 files changed, 26 insertions, 5 deletions
diff --git a/res/values/filtershow_strings.xml b/res/values/filtershow_strings.xml index a845c3482..3e9e35508 100644 --- a/res/values/filtershow_strings.xml +++ b/res/values/filtershow_strings.xml @@ -23,6 +23,8 @@ <string name="cannot_load_image">Cannot load the image!</string> <!-- String displayed when showing the original image [CHAR LIMIT=NONE] --> <string name="original_picture_text">@string/original</string> + <!-- String displayed when setting the homepage wallpaper in the background [CHAR LIMIT=NONE] --> + <string name="setting_wallpaper">Setting wallpaper</string> <!-- generic strings --> diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index 8da8113de..7e8a3f582 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -71,6 +71,7 @@ import com.android.gallery3d.filtershow.imageshow.ImageZoom; import com.android.gallery3d.filtershow.imageshow.MasterImage; import com.android.gallery3d.filtershow.presets.ImagePreset; import com.android.gallery3d.filtershow.provider.SharedImageProvider; +import com.android.gallery3d.filtershow.tools.BitmapTask; import com.android.gallery3d.filtershow.tools.SaveCopyTask; import com.android.gallery3d.filtershow.ui.FilterIconButton; import com.android.gallery3d.filtershow.ui.FramedTextButton; @@ -1089,11 +1090,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, mCropExtras.getOutputFormat(), this); } if (mSaveAsWallpaper) { - try { - WallpaperManager.getInstance(this).setBitmap(filtered); - } catch (IOException e) { - Log.w(LOGTAG, "fail to set wall paper", e); - } + setWallpaperInBackground(filtered); } if (mReturnAsExtra) { if (filtered != null) { @@ -1116,6 +1113,28 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, } } + void setWallpaperInBackground(final Bitmap bmap) { + Toast.makeText(this, R.string.setting_wallpaper, Toast.LENGTH_LONG).show(); + BitmapTask.Callbacks<FilterShowActivity> cb = new BitmapTask.Callbacks<FilterShowActivity>() { + @Override + public void onComplete(Bitmap result) {} + + @Override + public void onCancel() {} + + @Override + public Bitmap onExecute(FilterShowActivity param) { + try { + WallpaperManager.getInstance(param).setBitmap(bmap); + } catch (IOException e) { + Log.w(LOGTAG, "fail to set wall paper", e); + } + return null; + } + }; + (new BitmapTask<FilterShowActivity>(cb)).execute(this); + } + public void done() { if (mOutputted) { hideSavingProgress(); |
