mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-02-17 04:20:38 +01:00
rename rotation to orientation at exif changes
This commit is contained in:
parent
b1c1d131d9
commit
467f603ba1
@ -383,15 +383,15 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||
|
||||
private fun rotateByExif() {
|
||||
val exif = ExifInterface(getCurrentPath())
|
||||
val rotation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
|
||||
val newRotation = getNewRotation(rotation)
|
||||
exif.setAttribute(ExifInterface.TAG_ORIENTATION, newRotation)
|
||||
val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
|
||||
val newOrientation = getNewOrientation(orientation)
|
||||
exif.setAttribute(ExifInterface.TAG_ORIENTATION, newOrientation)
|
||||
exif.saveAttributes()
|
||||
File(getCurrentPath()).setLastModified(System.currentTimeMillis())
|
||||
(getCurrentFragment() as? PhotoFragment)?.refreshBitmap()
|
||||
}
|
||||
|
||||
private fun getNewRotation(rotation: Int): String {
|
||||
private fun getNewOrientation(rotation: Int): String {
|
||||
return when (rotation) {
|
||||
ExifInterface.ORIENTATION_ROTATE_90 -> ExifInterface.ORIENTATION_ROTATE_180
|
||||
ExifInterface.ORIENTATION_ROTATE_180 -> ExifInterface.ORIENTATION_ROTATE_270
|
||||
|
Loading…
x
Reference in New Issue
Block a user