fix: 修复全面屏Home手势与左右翻页冲突的问题

pull/1067/head
lbwstco 3 years ago committed by GitHub
parent 798eed1cd7
commit 37029c961c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt

@ -6,9 +6,11 @@ import android.graphics.Canvas
import android.graphics.Paint import android.graphics.Paint
import android.graphics.Rect import android.graphics.Rect
import android.graphics.RectF import android.graphics.RectF
import android.os.Build
import android.util.AttributeSet import android.util.AttributeSet
import android.view.MotionEvent import android.view.MotionEvent
import android.view.ViewConfiguration import android.view.ViewConfiguration
import android.view.WindowInsets
import android.widget.FrameLayout import android.widget.FrameLayout
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.ReadBookConfig import io.legado.app.help.ReadBookConfig
@ -156,6 +158,16 @@ class ReadView(context: Context, attrs: AttributeSet) :
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent): Boolean { override fun onTouchEvent(event: MotionEvent): Boolean {
callBack.screenOffTimerStart() callBack.screenOffTimerStart()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val insets = this.rootWindowInsets.getInsetsIgnoringVisibility(WindowInsets.Type.mandatorySystemGestures())
val height = activity?.windowManager?.currentWindowMetrics?.bounds?.height()
if (height != null) {
if (event.y > height.minus(insets.bottom)) {
return true;
}
}
}
when (event.action) { when (event.action) {
MotionEvent.ACTION_DOWN -> { MotionEvent.ACTION_DOWN -> {
if (isTextSelected) { if (isTextSelected) {

Loading…
Cancel
Save