|
|
@ -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) { |
|
|
|