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 02e2d18d8..427509f61 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -6,7 +6,14 @@ object PreferKey { const val themeMode = "themeMode" const val hideStatusBar = "hideStatusBar" const val clickTurnPage = "clickTurnPage" - const val clickAllNext = "clickAllNext" + const val clickActionTopLeft = "clickActionTopLeft" + const val clickActionTopCenter = "clickActionTopCenter" + const val clickActionTopRight = "clickActionTopRight" + const val clickActionCenterLeft = "clickActionCenterLeft" + const val clickActionCenterRight = "clickActionCenterRight" + const val clickActionBottomLeft = "clickActionBottomLeft" + const val clickActionBottomCenter = "clickActionBottomCenter" + const val clickActionBottomRight = "clickActionBottomRight" const val hideNavigationBar = "hideNavigationBar" const val precisionSearch = "precisionSearch" const val speakEngine = "speakEngine" 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 6efcdffea..88e6c5508 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -136,5 +136,7 @@ object AppConfig { val changeSourceLoadToc get() = App.INSTANCE.getPrefBoolean(PreferKey.changeSourceLoadToc) val importKeepName get() = App.INSTANCE.getPrefBoolean(PreferKey.importKeepName) + + val clickTurnPage get() = App.INSTANCE.getPrefBoolean(PreferKey.clickTurnPage, true) } 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 6b388742f..2303c414b 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -153,8 +153,6 @@ object ReadBookConfig { App.INSTANCE.putPrefBoolean(PreferKey.shareLayout, value) } } - val clickTurnPage get() = App.INSTANCE.getPrefBoolean(PreferKey.clickTurnPage, true) - val clickAllNext get() = App.INSTANCE.getPrefBoolean(PreferKey.clickAllNext, false) val textFullJustify get() = App.INSTANCE.getPrefBoolean(PreferKey.textFullJustify, true) val textBottomJustify get() = App.INSTANCE.getPrefBoolean(PreferKey.textBottomJustify, true) var hideStatusBar = App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index 598668e8b..94292bb81 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -24,6 +24,7 @@ import io.legado.app.lib.theme.backgroundColor import io.legado.app.service.help.CacheBook import io.legado.app.service.help.ReadBook import io.legado.app.ui.book.read.config.BgTextConfigDialog +import io.legado.app.ui.book.read.config.ClickActionConfigDialog import io.legado.app.ui.book.read.config.PaddingConfigDialog import io.legado.app.ui.book.source.edit.BookSourceEditActivity import io.legado.app.ui.widget.text.AutoCompleteTextView @@ -94,6 +95,10 @@ abstract class ReadBookBaseActivity : BgTextConfigDialog().show(supportFragmentManager, "bgTextConfig") } + fun showClickRegionalConfig() { + ClickActionConfigDialog().show(supportFragmentManager, "clickActionConfig") + } + /** * 屏幕方向 */ diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ClickActionConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ClickActionConfigDialog.kt new file mode 100644 index 000000000..5880c0a44 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ClickActionConfigDialog.kt @@ -0,0 +1,33 @@ +package io.legado.app.ui.book.read.config + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import io.legado.app.R +import io.legado.app.base.BaseDialogFragment + +class ClickActionConfigDialog : BaseDialogFragment() { + + override fun onStart() { + super.onStart() + dialog?.window?.let { + it.setBackgroundDrawableResource(R.color.transparent) + it.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) + } + } + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return inflater.inflate(R.layout.dialog_click_action_config, container) + } + + override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { + + } + + +} \ No newline at end of file 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 fbb8fa226..9aab31fd2 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 @@ -116,6 +116,9 @@ class MoreConfigDialog : DialogFragment() { override fun onPreferenceTreeClick(preference: Preference?): Boolean { when (preference?.key) { "customPageKey" -> PageKeyDialog(requireContext()).show() + "clickRegionalConfig" -> { + (activity as? ReadBookActivity)?.showClickRegionalConfig() + } } return super.onPreferenceTreeClick(preference) } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt index 6e5595bcd..d1de3f240 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt @@ -117,7 +117,6 @@ class ReadAloudConfigDialog : DialogFragment() { when (preference) { is ListPreference -> { val index = preference.findIndexOfValue(value) - // Set the summary to reflect the new value. preference.summary = if (index >= 0) preference.entries[index] else null } else -> { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index b502e20cd..6a0ea71da 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -10,6 +10,7 @@ import android.util.AttributeSet import android.view.MotionEvent import android.view.ViewConfiguration import android.widget.FrameLayout +import io.legado.app.help.AppConfig import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.accentColor import io.legado.app.service.help.ReadBook @@ -247,8 +248,8 @@ class PageView(context: Context, attrs: AttributeSet) : if (!isAbortAnim) { callBack.clickCenter() } - } else if (ReadBookConfig.clickTurnPage) { - if (startX > width / 2 || ReadBookConfig.clickAllNext) { + } else if (AppConfig.clickTurnPage) { + if (startX > width / 2) { pageDelegate?.nextPageByAnim(defaultAnimationSpeed) } else { pageDelegate?.prevPageByAnim(defaultAnimationSpeed) diff --git a/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt b/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt index 62f8f18f2..b992f772f 100644 --- a/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt @@ -9,6 +9,7 @@ import io.legado.app.utils.ColorUtils import io.legado.app.utils.dp import io.legado.app.utils.getCompatColor +@Suppress("unused") open class StrokeTextView(context: Context, attrs: AttributeSet?) : AppCompatTextView(context, attrs) { @@ -40,7 +41,7 @@ open class StrokeTextView(context: Context, attrs: AttributeSet?) : .setSelectedStrokeColor(context.getCompatColor(R.color.accent)) .setPressedBgColor(context.getCompatColor(R.color.transparent30)) .create() - this.setTextColor( + setTextColor( Selector.colorBuild() .setDefaultColor(context.getCompatColor(R.color.secondaryText)) .setSelectedColor(context.getCompatColor(R.color.accent)) @@ -58,7 +59,7 @@ open class StrokeTextView(context: Context, attrs: AttributeSet?) : .setSelectedStrokeColor(context.accentColor) .setPressedBgColor(context.getCompatColor(R.color.transparent30)) .create() - this.setTextColor( + setTextColor( Selector.colorBuild() .setDefaultColor(context.getPrimaryTextColor(isLight)) .setSelectedColor(context.accentColor) @@ -75,7 +76,7 @@ open class StrokeTextView(context: Context, attrs: AttributeSet?) : .setSelectedStrokeColor(ThemeStore.accentColor(context)) .setPressedBgColor(context.getCompatColor(R.color.transparent30)) .create() - this.setTextColor( + setTextColor( Selector.colorBuild() .setDefaultColor(ThemeStore.textColorSecondary(context)) .setSelectedColor(ThemeStore.accentColor(context)) diff --git a/app/src/main/res/layout/dialog_click_action_config.xml b/app/src/main/res/layout/dialog_click_action_config.xml new file mode 100644 index 000000000..f67e622d3 --- /dev/null +++ b/app/src/main/res/layout/dialog_click_action_config.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index c85d20733..621f2ebab 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -197,7 +197,6 @@ 音量鍵翻頁 點擊翻頁 - 點擊總是翻下一頁 翻頁動畫 屏幕超時 返回 @@ -781,5 +780,6 @@ 拷贝URL 没有书籍 保留原名 + 点击区域设置 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8dc1d3b0f..789648b94 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -197,7 +197,6 @@ 音量鍵翻頁 點擊翻頁 - 點擊總是翻下一頁 翻頁動畫 螢幕超時 返回 @@ -781,5 +780,6 @@ 拷贝URL 没有书籍 保留原名 + 点击区域设置 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 1e56e877e..47b52d26d 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -199,7 +199,6 @@ 音量键翻页 点击翻页 - 点击总是翻下一页 翻页动画 屏幕超时 返回 @@ -784,5 +783,6 @@ 拷贝URL 没有书籍 保留原名 + 点击区域设置 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f4007a799..070c91ee6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -200,7 +200,6 @@ Book Volume keys to turn page Tap screen to turn page - Tap screen always to next page Flip animation Keep screen awake Back @@ -787,5 +786,6 @@ 拷贝URL 没有书籍 保留原名 + 点击区域设置 diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml index 7e2da9c1c..a9355f948 100644 --- a/app/src/main/res/xml/pref_config_read.xml +++ b/app/src/main/res/xml/pref_config_read.xml @@ -69,10 +69,10 @@ app:iconSpaceReserved="false" app:isBottomBackground="true" /> -