diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 57ccd5f14..229d5d7e6 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -43,6 +43,7 @@ object ReadBookConfig { App.INSTANCE.putPrefInt(PreferKey.pageAnim, value) } var isScroll = pageAnim == 3 + val clickTurnPage get() = App.INSTANCE.getPrefBoolean(PreferKey.clickTurnPage, true) var bg: Drawable? = null init { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt index 586b3d88e..700728b14 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt @@ -52,4 +52,19 @@ abstract class HorizontalPageDelegate(pageView: PageView) : PageDelegate(pageVie } } + override fun nextPageByAnim() { + if (!hasNext()) return + setDirection(Direction.NEXT) + setBitmap() + setTouchPoint(viewWidth.toFloat(), 0f) + onAnimStart() + } + + override fun prevPageByAnim() { + if (!hasPrev()) return + setDirection(Direction.PREV) + setBitmap() + setTouchPoint(0f, 0f) + onAnimStart() + } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt index 2b26714c4..9736f13c3 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt @@ -12,6 +12,7 @@ import android.widget.Scroller import androidx.annotation.CallSuper import com.google.android.material.snackbar.Snackbar import io.legado.app.help.AppConfig +import io.legado.app.help.ReadBookConfig import io.legado.app.ui.book.read.page.ContentView import io.legado.app.ui.book.read.page.PageView import io.legado.app.utils.screenshot @@ -193,6 +194,10 @@ abstract class PageDelegate(protected val pageView: PageView) : open fun onScroll() {}//移动contentView, slidePage + abstract fun nextPageByAnim() + + abstract fun prevPageByAnim() + @CallSuper open fun setDirection(direction: Direction) { mDirection = direction @@ -260,21 +265,14 @@ abstract class PageDelegate(protected val pageView: PageView) : if (centerRectF.contains(x, y)) { pageView.callBack.clickCenter() setTouchPoint(x, y) - } else { + } else if (ReadBookConfig.clickTurnPage) { if (x > viewWidth / 2 || AppConfig.clickAllNext ) { - //设置动画方向 - if (!hasNext()) return true - setDirection(Direction.NEXT) - setBitmap() + nextPageByAnim() } else { - if (!hasPrev()) return true - setDirection(Direction.PREV) - setBitmap() + prevPageByAnim() } - setTouchPoint(x, y) - onAnimStart() } return true } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt index d90ee8649..368a9ad8a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt @@ -58,4 +58,12 @@ class ScrollPageDelegate(pageView: PageView) : PageDelegate(pageView) { super.onDestroy() mVelocity.recycle() } + + override fun nextPageByAnim() { + + } + + override fun prevPageByAnim() { + + } } \ No newline at end of file diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml index 785646c60..a19a8ba4c 100644 --- a/app/src/main/res/xml/pref_config_read.xml +++ b/app/src/main/res/xml/pref_config_read.xml @@ -29,7 +29,7 @@ app:iconSpaceReserved="false" />