From 4a91960875c12605d865fcab9930cf658e61d9cd Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 18 Dec 2017 22:33:51 +0100 Subject: [PATCH] flip the exif fetching functions, use the deprecated one first --- .../gallery/fragments/PhotoFragment.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 48030b07e..a9af4d393 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -228,15 +228,15 @@ class PhotoFragment : ViewPagerFragment() { var orient = defaultOrientation try { - val uri = if (medium.path.startsWith("content:/")) Uri.parse(medium.path) else Uri.fromFile(File(medium.path)) - val inputStream = context!!.contentResolver.openInputStream(uri) - val exif = ExifInterface() - exif.readExif(inputStream, ExifInterface.Options.OPTION_ALL) - orient = exif.getTag(ExifInterface.TAG_ORIENTATION)?.getValueAsInt(defaultOrientation) ?: defaultOrientation + val exif = android.media.ExifInterface(medium.path) + orient = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, defaultOrientation) if (orient == defaultOrientation) { - val exif2 = android.media.ExifInterface(medium.path) - orient = exif2.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, defaultOrientation) + val uri = if (medium.path.startsWith("content:/")) Uri.parse(medium.path) else Uri.fromFile(File(medium.path)) + val inputStream = context!!.contentResolver.openInputStream(uri) + val exif2 = ExifInterface() + exif2.readExif(inputStream, ExifInterface.Options.OPTION_ALL) + orient = exif2.getTag(ExifInterface.TAG_ORIENTATION)?.getValueAsInt(defaultOrientation) ?: defaultOrientation } } catch (ignored: Exception) { }