use the default zoom level if the image matches the screen

This commit is contained in:
tibbi 2017-12-29 21:42:25 +01:00
parent 30374930bd
commit 422b1fb690

View file

@ -37,7 +37,7 @@ import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
class PhotoFragment : ViewPagerFragment() { class PhotoFragment : ViewPagerFragment() {
private var DEFAULT_DOUBLE_TAP_ZOOM = 5f private var DEFAULT_DOUBLE_TAP_ZOOM = 2f
private var isFragmentVisible = false private var isFragmentVisible = false
private var isFullscreen = false private var isFullscreen = false
private var wasInit = false private var wasInit = false
@ -283,7 +283,7 @@ class PhotoFragment : ViewPagerFragment() {
val bitmapAspectRatio = height / width.toFloat() val bitmapAspectRatio = height / width.toFloat()
val screenAspectRatio = ViewPagerActivity.screenHeight / ViewPagerActivity.screenWidth.toFloat() val screenAspectRatio = ViewPagerActivity.screenHeight / ViewPagerActivity.screenWidth.toFloat()
return if (context == null) { return if (context == null || bitmapAspectRatio == screenAspectRatio) {
DEFAULT_DOUBLE_TAP_ZOOM DEFAULT_DOUBLE_TAP_ZOOM
} else if (ViewPagerActivity.wasDecodedByGlide) { } else if (ViewPagerActivity.wasDecodedByGlide) {
1f 1f