Merge pull request #1562 from deltachat/fiximagerotationcrash

#1544 image rotation not working sometimes, situation improved (crash averted)
This commit is contained in:
Angelo Fuchs
2020-08-18 12:53:07 +02:00
committed by GitHub
@@ -112,9 +112,11 @@ public class ScaleStableImageView
large = storedSizes.get(landscapeWidth + "x" + landscapeHeight);
if (large == null) return; // no baseline. can't work.
Bitmap original = ((BitmapDrawable) large).getBitmap();
Bitmap cropped = Bitmap.createBitmap(original, 0, 0, width, height);
Drawable croppedDrawable = new BitmapDrawable(getResources(), cropped);
overrideDrawable(croppedDrawable);
if (height <= original.getHeight() || width <= original.getWidth()) {
Bitmap cropped = Bitmap.createBitmap(original, 0, 0, width, height);
Drawable croppedDrawable = new BitmapDrawable(getResources(), cropped);
overrideDrawable(croppedDrawable);
}
} else {
Util.runOnBackground(() -> {
Bitmap bitmap = ((BitmapDrawable) defaultDrawable).getBitmap();