Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cb74ac6 authored by Raj Yengisetty's avatar Raj Yengisetty Committed by Rajesh Yengisetty
Browse files

WallpaperCropper: if generating a thumbnail fails, remove temp tile

Change-Id: Ic08384f906180d0bbe0a29b1d7a2af8be6bdd43d
parent 9e4c6b22
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.android.photos.BitmapRegionTileSource;

import java.io.File;
@@ -653,13 +654,20 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {

            @Override
            protected void onPostExecute(Bitmap thumb) {
                if (thumb != null) {
                if (thumb == null) {
                    mTempWallpaperTiles.remove(uri);
                    progressBar.setVisibility(View.INVISIBLE);
                    Toast.makeText(WallpaperPickerActivity.this,
                            getResources().getString(R.string.wallpaper_load_fail),
                            Toast.LENGTH_SHORT).show();
                    return;
                }

                ImageView image =
                        (ImageView) pickedImageThumbnail.findViewById(R.id.wallpaper_image);
                image.setImageBitmap(thumb);
                Drawable thumbDrawable = image.getDrawable();
                thumbDrawable.setDither(true);
                }

                mWallpapersView.addView(pickedImageThumbnail, 0);