mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-04-04 15:43:46 -04:00
Prevent ArithmeticException
This commit is contained in:
@@ -6,6 +6,7 @@ Changes:
|
||||
|
||||
- Fix selected colour in colour changing dialog
|
||||
- Support for deleting multiple cards at once
|
||||
- Fix possible ArithmeticException when resizing image
|
||||
|
||||
## v2.0.4 (2021-07-27)
|
||||
|
||||
|
||||
@@ -242,17 +242,17 @@ public class Utils {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer maxSize = BITMAP_SIZE_BIG;
|
||||
double maxSize = BITMAP_SIZE_BIG;
|
||||
|
||||
Integer width = bitmap.getWidth();
|
||||
Integer height = bitmap.getHeight();
|
||||
double width = bitmap.getWidth();
|
||||
double height = bitmap.getHeight();
|
||||
|
||||
if (height > width) {
|
||||
Integer scale = height / maxSize;
|
||||
double scale = height / maxSize;
|
||||
height = maxSize;
|
||||
width = width / scale;
|
||||
} else if (width > height) {
|
||||
Integer scale = width / maxSize;
|
||||
double scale = width / maxSize;
|
||||
width = maxSize;
|
||||
height = height / scale;
|
||||
} else {
|
||||
@@ -260,7 +260,7 @@ public class Utils {
|
||||
width = maxSize;
|
||||
}
|
||||
|
||||
return Bitmap.createScaledBitmap(bitmap, width, height, true);
|
||||
return Bitmap.createScaledBitmap(bitmap, (int) Math.round(width), (int) Math.round(height), true);
|
||||
}
|
||||
|
||||
static public Bitmap rotateBitmap(Bitmap bitmap, ExifInterface exifInterface) {
|
||||
|
||||
Reference in New Issue
Block a user