am cb20e0bc: Merge "Inform users when "Set wallpaper" fails." into ub-launcher3-burnaby-polish

* commit 'cb20e0bc8eed5fb97ef49eda2c1a1ff514aa9e38':
  Inform users when "Set wallpaper" fails.
This commit is contained in:
Tony Wickham
2015-09-25 21:27:56 +00:00
committed by Android Git Automerger
2 changed files with 11 additions and 2 deletions

View File

@@ -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] -->

View File

@@ -31,6 +31,9 @@ import android.graphics.RectF;
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 @@ public class BitmapCropTask extends AsyncTask<Void, Void, Boolean> {
}
@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);
}
}
}