mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化翻页动画
This commit is contained in:
@@ -198,6 +198,8 @@ abstract class BaseReadBookActivity :
|
||||
* 保持亮屏
|
||||
*/
|
||||
fun keepScreenOn(on: Boolean) {
|
||||
val isScreenOn = (window.attributes.flags and WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) != 0
|
||||
if (on == isScreenOn) return
|
||||
if (on) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
} else {
|
||||
|
||||
@@ -160,7 +160,6 @@ 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())
|
||||
@@ -174,6 +173,7 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
||||
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
callBack.screenOffTimerStart()
|
||||
if (isTextSelected) {
|
||||
curPage.cancelSelect()
|
||||
isTextSelected = false
|
||||
@@ -205,6 +205,7 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
||||
}
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
callBack.screenOffTimerStart()
|
||||
removeCallbacks(longPressRunnable)
|
||||
if (!pressDown) return true
|
||||
pressDown = false
|
||||
|
||||
@@ -133,6 +133,7 @@ fun View.screenshot(): Bitmap? {
|
||||
c.translate(-scrollX.toFloat(), -scrollY.toFloat())
|
||||
this.draw(c)
|
||||
c.setBitmap(null)
|
||||
screenshot.prepareToDraw()
|
||||
screenshot
|
||||
} else {
|
||||
null
|
||||
|
||||
Reference in New Issue
Block a user