Merge pull request #1067 from lbwstco/master

fix: 修复全面屏Home手势与左右翻页冲突的问题
pull/1072/head
kunfei 3 years ago committed by GitHub
commit 5170bbe353
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.Rect
import android.graphics.RectF
import android.os.Build
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.ViewConfiguration
import android.view.WindowInsets
import android.widget.FrameLayout
import io.legado.app.help.AppConfig
import io.legado.app.help.ReadBookConfig
@ -156,6 +158,16 @@ class ReadView(context: Context, attrs: AttributeSet) :
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent): Boolean {
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) {
MotionEvent.ACTION_DOWN -> {
if (isTextSelected) {

Loading…
Cancel
Save