fix target resolution of fullscreen media in case the image is rotated

This commit is contained in:
tibbi 2018-01-28 16:20:15 +01:00
parent 5b709d0b70
commit d36ce4ab8d

View file

@ -194,8 +194,14 @@ class PhotoFragment : ViewPagerFragment() {
private fun loadBitmap(degrees: Float = 0f) { private fun loadBitmap(degrees: Float = 0f) {
if (degrees == 0f) { if (degrees == 0f) {
val targetWidth = if (ViewPagerActivity.screenWidth == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenWidth var targetWidth = if (ViewPagerActivity.screenWidth == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenWidth
val targetHeight = if (ViewPagerActivity.screenHeight == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenHeight var targetHeight = if (ViewPagerActivity.screenHeight == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenHeight
val exif = android.media.ExifInterface(medium.path)
val orientation = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, -1)
if (orientation == ORIENTATION_ROTATE_90) {
targetWidth = targetHeight
targetHeight = Target.SIZE_ORIGINAL
}
val options = RequestOptions() val options = RequestOptions()
.signature(medium.path.getFileSignature()) .signature(medium.path.getFileSignature())
@ -231,7 +237,7 @@ class PhotoFragment : ViewPagerFragment() {
} }
private fun addZoomableView() { private fun addZoomableView() {
if ((medium.isImage()) && isFragmentVisible && view.subsampling_view.isGone() && !medium.isDng()) { if (medium.isImage() && isFragmentVisible && view.subsampling_view.isGone() && !medium.isDng()) {
val defaultOrientation = -1 val defaultOrientation = -1
var orient = defaultOrientation var orient = defaultOrientation