zoom in more at double tap in some cases

This commit is contained in:
tibbi 2019-02-05 16:47:27 +01:00
parent 361b82f197
commit 7d95c8ab65
2 changed files with 3 additions and 2 deletions

View File

@ -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'

View File

@ -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()