diff options
| author | Ruben Brunk <rubenbrunk@google.com> | 2013-02-21 20:13:20 -0800 |
|---|---|---|
| committer | Ruben Brunk <rubenbrunk@google.com> | 2013-02-22 09:50:33 -0800 |
| commit | a24145829118672e8b9b98e18de78eae71daaa08 (patch) | |
| tree | 43bcb0d5af6045ea1d4591e15e03df8c33484098 /src | |
| parent | aa4c34606a697172987e5ac379e82ce41b7cbaa5 (diff) | |
| download | android_packages_apps_Gallery2-a24145829118672e8b9b98e18de78eae71daaa08.tar.gz android_packages_apps_Gallery2-a24145829118672e8b9b98e18de78eae71daaa08.tar.bz2 android_packages_apps_Gallery2-a24145829118672e8b9b98e18de78eae71daaa08.zip | |
Move setting wallpaper to a background thread.
Bug: 8088767
Change-Id: I168032418a15f766ac09e18cd12707c7270b07f3
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index f7147eac1..70e800958 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; @@ -1090,11 +1091,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) { @@ -1117,6 +1114,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(); |
