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

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