zoom in more at double tap in some cases
This commit is contained in:
parent
361b82f197
commit
7d95c8ab65
|
@ -75,7 +75,7 @@ dependencies {
|
||||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||||
implementation 'com.caverock:androidsvg-aar:1.3'
|
implementation 'com.caverock:androidsvg-aar:1.3'
|
||||||
implementation 'com.github.tibbi:gestureviews:985ba285fb'
|
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 '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'
|
kapt 'androidx.room:room-compiler:2.0.0'
|
||||||
|
|
|
@ -56,6 +56,7 @@ import java.util.*
|
||||||
class PhotoFragment : ViewPagerFragment() {
|
class PhotoFragment : ViewPagerFragment() {
|
||||||
private val DEFAULT_DOUBLE_TAP_ZOOM = 2f
|
private val DEFAULT_DOUBLE_TAP_ZOOM = 2f
|
||||||
private val ZOOMABLE_VIEW_LOAD_DELAY = 150L
|
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
|
// devices with good displays, but the rest of the hardware not good enough for them
|
||||||
private val WEIRD_DEVICES = arrayListOf(
|
private val WEIRD_DEVICES = arrayListOf(
|
||||||
|
@ -537,7 +538,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
val bitmapAspectRatio = height / width.toFloat()
|
val bitmapAspectRatio = height / width.toFloat()
|
||||||
val screenAspectRatio = mScreenHeight / mScreenWidth.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
|
DEFAULT_DOUBLE_TAP_ZOOM
|
||||||
} else if (context!!.portrait && bitmapAspectRatio <= screenAspectRatio) {
|
} else if (context!!.portrait && bitmapAspectRatio <= screenAspectRatio) {
|
||||||
mScreenHeight / height.toFloat()
|
mScreenHeight / height.toFloat()
|
||||||
|
|
Loading…
Reference in New Issue