Don't show navigation overlay if tap navigation is disabled (#5534)

* Don't show navigation overlay if tap navigation is disabled

* Apply feedback
This commit is contained in:
Ivan Iskandar 2021-07-15 19:44:53 +07:00 committed by GitHub
parent ae97bb0445
commit b7c2890250
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 10 deletions

View File

@ -19,17 +19,14 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet)
private var navigation: ViewerNavigation? = null
fun setNavigation(navigation: ViewerNavigation, showOnStart: Boolean) {
if (!showOnStart && this.navigation == null) {
this.navigation = navigation
isVisible = false
return
}
fun setNavigation(navigation: ViewerNavigation, tappingEnabled: Boolean, showOnStart: Boolean) {
val firstLaunch = this.navigation == null
this.navigation = navigation
invalidate()
if (isVisible) return
if (isVisible || (!showOnStart && firstLaunch) || !tappingEnabled) {
return
}
viewPropertyAnimator = animate()
.alpha(1f)

View File

@ -128,7 +128,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
config.navigationModeChangedListener = {
val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay
activity.binding.navigationOverlay.setNavigation(config.navigator, showOnStart)
activity.binding.navigationOverlay.setNavigation(config.navigator, config.tappingEnabled, showOnStart)
}
}

View File

@ -129,7 +129,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
config.navigationModeChangedListener = {
val showOnStart = config.navigationOverlayOnStart || config.forceNavigationOverlay
activity.binding.navigationOverlay.setNavigation(config.navigator, showOnStart)
activity.binding.navigationOverlay.setNavigation(config.navigator, config.tappingEnabled, showOnStart)
}
frame.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)