From 7d95c8ab65c1fbb9983747f2f6b40e21151fe1e6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Feb 2019 16:47:27 +0100 Subject: [PATCH] zoom in more at double tap in some cases --- app/build.gradle | 2 +- .../simplemobiletools/gallery/pro/fragments/PhotoFragment.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 767d127be..780ecf626 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -75,7 +75,7 @@ dependencies { implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.caverock:androidsvg-aar:1.3' implementation 'com.github.tibbi:gestureviews:985ba285fb' - implementation 'com.github.tibbi:subsampling-scale-image-view:3ccd2f9c2b' + implementation 'com.github.tibbi:subsampling-scale-image-view:03df52339d' kapt 'com.github.bumptech.glide:compiler:4.8.0' // keep it here too, not just in Commons, else loading SVGs wont work kapt 'androidx.room:room-compiler:2.0.0' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 05c6b244d..66ae242f6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -56,6 +56,7 @@ import java.util.* class PhotoFragment : ViewPagerFragment() { private val DEFAULT_DOUBLE_TAP_ZOOM = 2f private val ZOOMABLE_VIEW_LOAD_DELAY = 150L + private val SAME_ASPECT_RATIO_THRESHOLD = 0.01 // devices with good displays, but the rest of the hardware not good enough for them private val WEIRD_DEVICES = arrayListOf( @@ -537,7 +538,7 @@ class PhotoFragment : ViewPagerFragment() { val bitmapAspectRatio = height / width.toFloat() val screenAspectRatio = mScreenHeight / mScreenWidth.toFloat() - return if (context == null || bitmapAspectRatio == screenAspectRatio) { + return if (context == null || Math.abs(bitmapAspectRatio - screenAspectRatio) < SAME_ASPECT_RATIO_THRESHOLD) { DEFAULT_DOUBLE_TAP_ZOOM } else if (context!!.portrait && bitmapAspectRatio <= screenAspectRatio) { mScreenHeight / height.toFloat()