am cb20e0bc: Merge "Inform users when "Set wallpaper" fails." into ub-launcher3-burnaby-polish
* commit 'cb20e0bc8eed5fb97ef49eda2c1a1ff514aa9e38':
Inform users when "Set wallpaper" fails.
diff --git a/WallpaperPicker/res/values/strings.xml b/WallpaperPicker/res/values/strings.xml
index 72b1e15..2bfd476 100644
--- a/WallpaperPicker/res/values/strings.xml
+++ b/WallpaperPicker/res/values/strings.xml
@@ -28,6 +28,9 @@
usually see this when using another app and trying to set
an image as the wallpaper -->
<string name="wallpaper_load_fail">Couldn\'t load image as wallpaper</string>
+ <!-- Error message when an image is selected as a wallpaper,
+ but something goes wrong when the user clicks "Set wallpaper" -->
+ <string name="wallpaper_set_fail">Couldn\'t set image as wallpaper</string>
<!-- Shown when wallpapers are selected in Wallpaper picker -->
<!-- String indicating how many media item(s) is(are) selected
eg. 1 selected [CHAR LIMIT=30] -->
diff --git a/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java b/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java
index 47c40eb..212fb84 100644
--- a/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java
+++ b/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java
@@ -31,6 +31,9 @@
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
+import android.widget.Toast;
+
+import com.android.launcher3.R;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
@@ -395,9 +398,12 @@
}
@Override
- protected void onPostExecute(Boolean result) {
+ protected void onPostExecute(Boolean cropSucceeded) {
+ if (!cropSucceeded) {
+ Toast.makeText(mContext, R.string.wallpaper_set_fail, Toast.LENGTH_SHORT).show();
+ }
if (mOnEndCropHandler != null) {
- mOnEndCropHandler.run(result);
+ mOnEndCropHandler.run(cropSucceeded);
}
}
}
\ No newline at end of file