Skip to content

Commit e385657

Browse files
committed
rm code duplicates
1 parent cee3342 commit e385657

File tree

1 file changed

+16
-34
lines changed

1 file changed

+16
-34
lines changed

src/android/CameraLauncher.java

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -990,49 +990,31 @@ private Bitmap getScaledAndRotatedBitmap(String imageUrl, boolean unknownSources
990990
localFile = new File(getTempDirectoryPath() + fileName);
991991
galleryUri = Uri.fromFile(localFile);
992992
writeUncompressedImage(fileStream, galleryUri);
993-
try {
994-
String mimeType = FileHelper.getMimeType(imageUrl.toString(), cordova);
995-
if ("image/jpeg".equalsIgnoreCase(mimeType)) {
996-
// ExifInterface doesn't like the file:// prefix
997-
String filePath = galleryUri.toString().replace("file://", "");
998-
// read exifData of source
999-
exifData = new ExifHelper();
1000-
exifData.createInFile(filePath);
1001-
// Use ExifInterface to pull rotation information
1002-
if (this.correctOrientation) {
1003-
ExifInterface exif = new ExifInterface(filePath);
1004-
rotate = exifToDegrees(exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED));
1005-
}
1006-
}
1007-
} catch (Exception oe) {
1008-
LOG.w(LOG_TAG, "Unable to read Exif data: " + oe.toString());
1009-
rotate = 0;
1010-
}
1011993
}
1012994
} catch (Exception e) {
1013995
LOG.e(LOG_TAG, "Exception while getting input stream: " + e.toString());
1014996
return null;
1015997
}
1016998
} else {
1017999
galleryUri = Uri.fromFile(new File(imageUrl));
1018-
try {
1019-
String mimeType = FileHelper.getMimeType(imageUrl.toString(), cordova);
1020-
if ("image/jpeg".equalsIgnoreCase(mimeType)) {
1021-
// ExifInterface doesn't like the file:// prefix
1022-
String filePath = galleryUri.toString().replace("file://", "");
1023-
// read exifData of source
1024-
exifData = new ExifHelper();
1025-
exifData.createInFile(filePath);
1026-
// Use ExifInterface to pull rotation information
1027-
if (this.correctOrientation) {
1028-
ExifInterface exif = new ExifInterface(filePath);
1029-
rotate = exifToDegrees(exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED));
1030-
}
1000+
}
1001+
try {
1002+
String mimeType = FileHelper.getMimeType(imageUrl.toString(), cordova);
1003+
if ("image/jpeg".equalsIgnoreCase(mimeType)) {
1004+
// ExifInterface doesn't like the file:// prefix
1005+
String filePath = galleryUri.toString().replace("file://", "");
1006+
// read exifData of source
1007+
exifData = new ExifHelper();
1008+
exifData.createInFile(filePath);
1009+
// Use ExifInterface to pull rotation information
1010+
if (this.correctOrientation) {
1011+
ExifInterface exif = new ExifInterface(filePath);
1012+
rotate = exifToDegrees(exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED));
10311013
}
1032-
} catch (Exception oe) {
1033-
LOG.w(LOG_TAG, "Unable to read Exif data: " + oe.toString());
1034-
rotate = 0;
10351014
}
1015+
} catch (Exception oe) {
1016+
LOG.w(LOG_TAG, "Unable to read Exif data: " + oe.toString());
1017+
rotate = 0;
10361018
}
10371019

10381020

0 commit comments

Comments
 (0)