diff --git a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index 96a5caf4eac5..3f74f9fee43a 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -70,6 +70,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; +import androidx.core.content.ContextCompat; import androidx.core.content.res.ResourcesCompat; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -1260,9 +1261,11 @@ public AsyncMediaThumbnailDrawable(Resources res, Bitmap bitmap) { } /** - * adapted from https://stackoverflow.com/a/8113368 + * adapted from ... */ private static Bitmap handlePNG(Bitmap source, int newWidth, int newHeight) { + Bitmap softwareBitmap = source.copy(Bitmap.Config.ARGB_8888, false); + int sourceWidth = source.getWidth(); int sourceHeight = source.getHeight(); @@ -1281,8 +1284,9 @@ private static Bitmap handlePNG(Bitmap source, int newWidth, int newHeight) { Bitmap dest = Bitmap.createBitmap(newWidth, newHeight, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(dest); - canvas.drawColor(MainApp.getAppContext().getResources().getColor(R.color.background_color_png)); - canvas.drawBitmap(source, null, targetRect, null); + int color = ContextCompat.getColor(MainApp.getAppContext(),R.color.background_color_png); + canvas.drawColor(color); + canvas.drawBitmap(softwareBitmap, null, targetRect, null); return dest; }