mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-01-04 12:30:34 +01:00
use proper orientation at otg images
This commit is contained in:
parent
c25513fbcf
commit
04d42d6772
@ -24,6 +24,7 @@ import com.bumptech.glide.request.target.Target
|
||||
import com.davemorrissey.labs.subscaleview.ImageSource
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.OTG_PATH
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.activities.PhotoActivity
|
||||
import com.simplemobiletools.gallery.activities.ViewPagerActivity
|
||||
@ -314,11 +315,12 @@ class PhotoFragment : ViewPagerFragment() {
|
||||
var orient = defaultOrientation
|
||||
|
||||
try {
|
||||
val exif = android.media.ExifInterface(medium.path)
|
||||
val pathToLoad = getPathToLoad(medium)
|
||||
val exif = android.media.ExifInterface(pathToLoad)
|
||||
orient = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, defaultOrientation)
|
||||
|
||||
if (orient == defaultOrientation) {
|
||||
val uri = if (medium.path.startsWith("content:/")) Uri.parse(medium.path) else Uri.fromFile(File(medium.path))
|
||||
if (orient == defaultOrientation || medium.path.startsWith(OTG_PATH)) {
|
||||
val uri = if (pathToLoad.startsWith("content:/")) Uri.parse(pathToLoad) else Uri.fromFile(File(pathToLoad))
|
||||
val inputStream = context!!.contentResolver.openInputStream(uri)
|
||||
val exif2 = ExifInterface()
|
||||
exif2.readExif(inputStream, ExifInterface.Options.OPTION_ALL)
|
||||
|
Loading…
Reference in New Issue
Block a user