refactor(android): Remove useless arguments, fix typo and style

This commit is contained in:
Florian Rival 2016-08-21 20:07:05 +02:00
parent e8c3e1b128
commit 442627bd37
1 changed files with 5 additions and 9 deletions

View File

@ -26,9 +26,8 @@ import java.util.Date;
*/
class ImageResizer {
private static Bitmap resizeImage(Bitmap image, int maxWidth, int maxHeight, Context context) {
private static Bitmap resizeImage(Bitmap image, int maxWidth, int maxHeight) {
Bitmap newImage = null;
if (image == null) {
return null; // Can't load the image from the given path.
}
@ -84,7 +83,6 @@ class ImageResizer {
return newFile.getAbsolutePath();
}
/**
* Get {@link File} object for the given Android URI.<br>
* Use content resolver to get real path if direct path doesn't return valid file.
@ -152,9 +150,6 @@ class ImageResizer {
public static String createResizedImage(Context context, String imagePath, int newWidth,
int newHeight, Bitmap.CompressFormat compressFormat,
int quality, int rotation, String outputPath) throws IOException {
Bitmap sourceImage;
if (!imagePath.startsWith("content://") && !imagePath.startsWith("file://")) {
sourceImage = BitmapFactory.decodeFile(imagePath);
@ -169,12 +164,12 @@ class ImageResizer {
// Start transformations:
// Scale it first so there are fewer pixels to transform in the rotation
Bitmap scaledImage = ImageResizer.resizeImage(sourceImage, newWidth, newHeight, context);
Bitmap scaledImage = ImageResizer.resizeImage(sourceImage, newWidth, newHeight);
if (sourceImage != scaledImage) {
sourceImage.recycle();
}
// Rotate if neccesary
// Rotate if necessary
Bitmap rotatedImage = scaledImage;
if (rotation > 0) {
int orientation = getOrientation(context, Uri.parse(imagePath));
@ -186,6 +181,7 @@ class ImageResizer {
scaledImage.recycle();
}
// Save the resulting image
File path = context.getCacheDir();
if (outputPath != null) {
path = new File(outputPath);