diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt
index 72d260d8a..0d1e5ef7e 100644
--- a/app/src/main/java/io/legado/app/constant/PreferKey.kt
+++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt
@@ -72,6 +72,7 @@ object PreferKey {
const val exportCharset = "exportCharset"
const val exportUseReplace = "exportUseReplace"
const val useZhLayout = "useZhLayout"
+ const val fullScreenGesturesSupport = "fullScreenGesturesSupport"
const val cPrimary = "colorPrimary"
const val cAccent = "colorAccent"
diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt
index c72078564..cda42eed4 100644
--- a/app/src/main/java/io/legado/app/help/AppConfig.kt
+++ b/app/src/main/java/io/legado/app/help/AppConfig.kt
@@ -190,6 +190,9 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val replaceEnableDefault get() = appCtx.getPrefBoolean(PreferKey.replaceEnableDefault, true)
+ val fullScreenGesturesSupport: Boolean
+ get () = appCtx.getPrefBoolean(PreferKey.fullScreenGesturesSupport, false)
+
private fun getPrefUserAgent(): String {
val ua = appCtx.getPrefString(PreferKey.userAgent)
if (ua.isNullOrBlank()) {
diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt
index 5e4b9cec6..3fe8ed971 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt
@@ -16,6 +16,7 @@ import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.bottomBackground
import io.legado.app.ui.book.read.ReadBookActivity
+import io.legado.app.ui.book.read.page.ReadView
import io.legado.app.utils.dp
import io.legado.app.utils.getPrefBoolean
import io.legado.app.utils.postEvent
@@ -127,6 +128,9 @@ class MoreConfigDialog : DialogFragment() {
"clickRegionalConfig" -> {
(activity as? ReadBookActivity)?.showClickRegionalConfig()
}
+ "fullScreenGesturesSupport" -> {
+ ((activity as? ReadBookActivity)?.findViewById(R.id.read_view) as ReadView).setRect9x()
+ }
}
return super.onPreferenceTreeClick(preference)
}
diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt
index ef53ab14b..bba292427 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt
@@ -77,15 +77,15 @@ class ReadView(context: Context, attrs: AttributeSet) :
private var firstCharIndex: Int = 0
val slopSquare by lazy { ViewConfiguration.get(context).scaledTouchSlop }
- private val tlRect = RectF(0f, 0f, width * 0.33f, height * 0.33f)
- private val tcRect = RectF(width * 0.33f, 0f, width * 0.66f, height * 0.33f)
- private val trRect = RectF(width * 0.36f, 0f, width - 0f, height * 0.33f)
- private val mlRect = RectF(0f, height * 0.33f, width * 0.33f, height * 0.66f)
- private val mcRect = RectF(width * 0.33f, height * 0.33f, width * 0.66f, height * 0.66f)
- private val mrRect = RectF(width * 0.66f, height * 0.33f, width - 0f, height * 0.66f)
- private val blRect = RectF(0f, height * 0.66f, width * 0.33f, height - 0f)
- private val bcRect = RectF(width * 0.33f, height * 0.66f, width * 0.66f, height - 0f)
- private val brRect = RectF(width * 0.66f, height * 0.66f, width - 0f, height - 0f)
+ private val tlRect = RectF()
+ private val tcRect = RectF()
+ private val trRect = RectF()
+ private val mlRect = RectF()
+ private val mcRect = RectF()
+ private val mrRect = RectF()
+ private val blRect = RectF()
+ private val bcRect = RectF()
+ private val brRect = RectF()
private val autoPageRect by lazy { Rect() }
private val autoPagePint by lazy { Paint().apply { color = context.accentColor } }
private val boundary by lazy { BreakIterator.getWordInstance(Locale.getDefault()) }
@@ -99,19 +99,25 @@ class ReadView(context: Context, attrs: AttributeSet) :
setWillNotDraw(false)
upPageAnim()
}
+ setRect9x()
}
- override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
- super.onSizeChanged(w, h, oldw, oldh)
- tlRect.set(0f, 0f, width * 0.33f, height * 0.33f)
+ public fun setRect9x() {
+ val edge = if (AppConfig.fullScreenGesturesSupport) { 200f } else { 0f }
+ tlRect.set(0f + edge, 0f, width * 0.33f, height * 0.33f)
tcRect.set(width * 0.33f, 0f, width * 0.66f, height * 0.33f)
- trRect.set(width * 0.36f, 0f, width - 0f, height * 0.33f)
- mlRect.set(0f, height * 0.33f, width * 0.33f, height * 0.66f)
+ trRect.set(width * 0.36f, 0f, width - 0f - edge, height * 0.33f)
+ mlRect.set(0f + edge, height * 0.33f, width * 0.33f, height * 0.66f)
mcRect.set(width * 0.33f, height * 0.33f, width * 0.66f, height * 0.66f)
- mrRect.set(width * 0.66f, height * 0.33f, width - 0f, height * 0.66f)
- blRect.set(0f, height * 0.66f, width * 0.33f, height - 10f)
- bcRect.set(width * 0.33f, height * 0.66f, width * 0.66f, height - 0f)
- brRect.set(width * 0.66f, height * 0.66f, width - 0f, height - 0f)
+ mrRect.set(width * 0.66f, height * 0.33f, width - 0f - edge, height * 0.66f)
+ blRect.set(0f + edge, height * 0.66f, width * 0.33f, height - 10f - edge)
+ bcRect.set(width * 0.33f, height * 0.66f, width * 0.66f, height - 0f - edge)
+ brRect.set(width * 0.66f, height * 0.66f, width - 0f - edge, height - 0f - edge)
+ }
+
+ override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
+ super.onSizeChanged(w, h, oldw, oldh)
+ setRect9x()
prevPage.x = -w.toFloat()
pageDelegate?.setViewSize(w, h)
}
diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml
index 295a29b37..ec507138c 100644
--- a/app/src/main/res/values-zh-rHK/strings.xml
+++ b/app/src/main/res/values-zh-rHK/strings.xml
@@ -680,6 +680,7 @@
中
信息
切換佈局
+ 全面屏手勢優化
主色調
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 245a0aeab..0b7551fc5 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -693,6 +693,7 @@
訊息
切換布局
文章字重轉換
+ 全面屏手勢優化
主色調
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index 6ecebfe3e..0889ca112 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -693,6 +693,7 @@
信息
切换布局
文章字重切换
+ 全面屏手势优化
主色调
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 629f44767..da4faf74d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -694,6 +694,7 @@
Information
Switch Layout
Text font weight switching
+ Full screen gestures support
Primary
diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml
index 9f240fc63..6f4b6e440 100644
--- a/app/src/main/res/xml/pref_config_read.xml
+++ b/app/src/main/res/xml/pref_config_read.xml
@@ -103,6 +103,13 @@
app:iconSpaceReserved="false"
app:isBottomBackground="true" />
+
+