mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix(reader): Prevent potential NPE
This commit is contained in:
parent
8bc22fec28
commit
a4ab7f11e2
1 changed files with 24 additions and 27 deletions
|
@ -301,8 +301,7 @@ class PagerPageHolder(
|
|||
private fun SubsamplingScaleImageView.landscapeZoom(forward: Boolean?) {
|
||||
forward ?: return
|
||||
if (viewer.config.landscapeZoom && viewer.config.imageScaleType == SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE && sWidth > sHeight && scale == minScale) {
|
||||
handler.postDelayed(
|
||||
{
|
||||
handler.postDelayed(500) {
|
||||
val point = when (viewer.config.imageZoomType) {
|
||||
ZoomType.Left -> if (forward) PointF(0F, 0F) else PointF(sWidth.toFloat(), 0F)
|
||||
ZoomType.Right -> if (forward) PointF(sWidth.toFloat(), 0F) else PointF(0F, 0F)
|
||||
|
@ -321,14 +320,12 @@ class PagerPageHolder(
|
|||
rootInsets?.bottomCutoutInset()?.toFloat() ?: 0f
|
||||
}
|
||||
val targetScale = (height.toFloat() - topInsets - bottomInsets) / sHeight.toFloat()
|
||||
animateScaleAndCenter(min(targetScale, minScale * 2), point)!!
|
||||
(animateScaleAndCenter(min(targetScale, minScale * 2), point) ?: return@postDelayed)
|
||||
.withDuration(500)
|
||||
.withEasing(SubsamplingScaleImageView.EASE_IN_OUT_QUAD)
|
||||
.withInterruptible(true)
|
||||
.start()
|
||||
},
|
||||
500,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue