mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-16 14:07:28 +01:00
Navigate to pan / landscape zoom (#6481)
* pan if the image is zoomed instead of navigating away quickly display full landscape image before zooming to fit height in fit to screen * add Tap to pan preference, defaults to true add landscape zoom preference, defaults to false * hide landscape image zoom option if scale is not fit screen * fix landscape image zoom for first image and loading image * properly reload pagerholders when landscape zoom option is changed * enable landscape zoom by default
This commit is contained in:
@@ -4,7 +4,9 @@ package eu.kanade.tachiyomi.util.view
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Point
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
@@ -259,3 +261,16 @@ inline fun <reified T : Drawable> T.copy(context: Context): T? {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun View?.isVisible(): Boolean {
|
||||
if (this == null) {
|
||||
return false
|
||||
}
|
||||
if (!this.isShown) {
|
||||
return false
|
||||
}
|
||||
val actualPosition = Rect()
|
||||
this.getGlobalVisibleRect(actualPosition)
|
||||
val screen = Rect(0, 0, Resources.getSystem().displayMetrics.widthPixels, Resources.getSystem().displayMetrics.heightPixels)
|
||||
return actualPosition.intersect(screen)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user