Skip to content

Commit 985f348

Browse files
committed
cleanup
Signed-off-by: Alex Knop <[email protected]>
1 parent 4e03b0c commit 985f348

File tree

2 files changed

+0
-70
lines changed

2 files changed

+0
-70
lines changed

app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,6 @@ private static Bitmap addThumbnailToCache(String imageKey, Bitmap bitmap, String
193193

194194
Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, pxW, pxH);
195195

196-
// Rotate image, obeying exif tag
197-
thumbnail = BitmapUtils.rotateImage(thumbnail,path);
198-
199196
// Add thumbnail to cache
200197
// do not overwrite any pre-existing image
201198
if (!mThumbnailCache.containsKey(imageKey)) {

app/src/main/java/com/owncloud/android/utils/BitmapUtils.java

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -224,73 +224,6 @@ public static Bitmap scaleBitmap(Bitmap bitmap, float px, int width, int height,
224224
return Bitmap.createScaledBitmap(bitmap, w, h, true);
225225
}
226226

227-
/**
228-
* Rotate bitmap according to EXIF orientation. Cf. http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/
229-
*
230-
* @param bitmap Bitmap to be rotated
231-
* @param storagePath Path to source file of bitmap. Needed for EXIF information.
232-
* @return correctly EXIF-rotated bitmap
233-
*/
234-
public static Bitmap rotateImage(Bitmap bitmap, String storagePath) {
235-
Bitmap resultBitmap = bitmap;
236-
237-
try {
238-
ExifInterface exifInterface = new ExifInterface(storagePath);
239-
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1);
240-
241-
if (orientation != ExifInterface.ORIENTATION_NORMAL) {
242-
Matrix matrix = new Matrix();
243-
switch (orientation) {
244-
// 2
245-
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: {
246-
matrix.postScale(-1.0f, 1.0f);
247-
break;
248-
}
249-
// 3
250-
case ExifInterface.ORIENTATION_ROTATE_180: {
251-
matrix.postRotate(180);
252-
break;
253-
}
254-
// 4
255-
case ExifInterface.ORIENTATION_FLIP_VERTICAL: {
256-
matrix.postScale(1.0f, -1.0f);
257-
break;
258-
}
259-
// 5
260-
case ExifInterface.ORIENTATION_TRANSPOSE: {
261-
matrix.postRotate(-90);
262-
matrix.postScale(1.0f, -1.0f);
263-
break;
264-
}
265-
// 6
266-
case ExifInterface.ORIENTATION_ROTATE_90: {
267-
matrix.postRotate(90);
268-
break;
269-
}
270-
// 7
271-
case ExifInterface.ORIENTATION_TRANSVERSE: {
272-
matrix.postRotate(90);
273-
matrix.postScale(1.0f, -1.0f);
274-
break;
275-
}
276-
// 8
277-
case ExifInterface.ORIENTATION_ROTATE_270: {
278-
matrix.postRotate(270);
279-
break;
280-
}
281-
}
282-
283-
// Rotate the bitmap
284-
resultBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
285-
if (!resultBitmap.equals(bitmap)) {
286-
bitmap.recycle();
287-
}
288-
}
289-
} catch (Exception exception) {
290-
Log_OC.e("BitmapUtil", "Could not rotate the image: " + storagePath);
291-
}
292-
return resultBitmap;
293-
}
294227

295228
/**
296229
* Detect if Image will be rotated according to EXIF orientation. Cf. http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/

0 commit comments

Comments
 (0)