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 63cd99e2a..bffd0b422 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -236,7 +236,7 @@ class PhotoFragment : ViewPagerFragment() { override fun onReady() { background = ColorDrawable(if (context.config.darkBackground) Color.BLACK else context.config.backgroundColor) - setDoubleTapZoomScale(getDoubleTapZoomScale()) + setDoubleTapZoomScale(getDoubleTapZoomScale(sWidth, sHeight)) } override fun onTileLoadError(e: Exception?) { @@ -259,12 +259,7 @@ class PhotoFragment : ViewPagerFragment() { } } - private fun getDoubleTapZoomScale(): Float { - val bitmapOptions = BitmapFactory.Options() - bitmapOptions.inJustDecodeBounds = true - BitmapFactory.decodeFile(medium.path, bitmapOptions) - val width = bitmapOptions.outWidth - val height = bitmapOptions.outHeight + private fun getDoubleTapZoomScale(width: Int, height: Int): Float { val bitmapAspectRatio = height / (width).toFloat() return if (context == null) {