From c71a525de83cf1cda002c5f22827857dc7c7f780 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 15 Nov 2020 15:56:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/constant/PreferKey.kt | 18 +++++------ .../main/java/io/legado/app/help/AppConfig.kt | 20 ++++++------ .../read/config/ClickActionConfigDialog.kt | 32 +++++++++---------- .../legado/app/ui/book/read/page/PageView.kt | 18 +++++------ 4 files changed, 43 insertions(+), 45 deletions(-) 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 6a47308d5..548356466 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -4,15 +4,15 @@ object PreferKey { const val language = "language" const val themeMode = "themeMode" const val hideStatusBar = "hideStatusBar" - const val clickActionTopLeft = "clickActionTopLeft" - const val clickActionTopCenter = "clickActionTopCenter" - const val clickActionTopRight = "clickActionTopRight" - const val clickActionMiddleLeft = "clickActionMiddleLeft" - const val clickActionMiddleCenter = "clickActionMiddleCenter" - const val clickActionMiddleRight = "clickActionMiddleRight" - const val clickActionBottomLeft = "clickActionBottomLeft" - const val clickActionBottomCenter = "clickActionBottomCenter" - const val clickActionBottomRight = "clickActionBottomRight" + const val clickActionTL = "clickActionTopLeft" + const val clickActionTC = "clickActionTopCenter" + const val clickActionTR = "clickActionTopRight" + const val clickActionML = "clickActionMiddleLeft" + const val clickActionMC = "clickActionMiddleCenter" + const val clickActionMR = "clickActionMiddleRight" + const val clickActionBL = "clickActionBottomLeft" + const val clickActionBC = "clickActionBottomCenter" + const val clickActionBR = "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 a6064e855..b01e1ee7f 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -137,16 +137,14 @@ object AppConfig { val importKeepName get() = App.INSTANCE.getPrefBoolean(PreferKey.importKeepName) - val clickActionTopLeft get() = App.INSTANCE.getPrefInt(PreferKey.clickActionTopLeft, 2) - val clickActionTopCenter get() = App.INSTANCE.getPrefInt(PreferKey.clickActionTopCenter, 2) - val clickActionTopRight get() = App.INSTANCE.getPrefInt(PreferKey.clickActionTopRight, 1) - val clickActionMiddleLeft get() = App.INSTANCE.getPrefInt(PreferKey.clickActionMiddleLeft, 2) - val clickActionMiddleCenter - get() = App.INSTANCE.getPrefInt(PreferKey.clickActionMiddleCenter, 0) - val clickActionMiddleRight get() = App.INSTANCE.getPrefInt(PreferKey.clickActionMiddleRight, 1) - val clickActionBottomLeft get() = App.INSTANCE.getPrefInt(PreferKey.clickActionBottomLeft, 2) - val clickActionBottomCenter - get() = App.INSTANCE.getPrefInt(PreferKey.clickActionBottomCenter, 1) - val clickActionBottomRight get() = App.INSTANCE.getPrefInt(PreferKey.clickActionBottomRight, 1) + val clickActionTL get() = App.INSTANCE.getPrefInt(PreferKey.clickActionTL, 2) + val clickActionTC get() = App.INSTANCE.getPrefInt(PreferKey.clickActionTC, 2) + val clickActionTR get() = App.INSTANCE.getPrefInt(PreferKey.clickActionTR, 1) + val clickActionML get() = App.INSTANCE.getPrefInt(PreferKey.clickActionML, 2) + val clickActionMC get() = App.INSTANCE.getPrefInt(PreferKey.clickActionMC, 0) + val clickActionMR get() = App.INSTANCE.getPrefInt(PreferKey.clickActionMR, 1) + val clickActionBL get() = App.INSTANCE.getPrefInt(PreferKey.clickActionBL, 2) + val clickActionBC get() = App.INSTANCE.getPrefInt(PreferKey.clickActionBC, 1) + val clickActionBR get() = App.INSTANCE.getPrefInt(PreferKey.clickActionBR, 1) } 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 index 55082400e..30608a1f8 100644 --- 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 @@ -56,14 +56,14 @@ class ClickActionConfigDialog : BaseDialogFragment() { } private fun initData() = with(AppConfig) { - tv_top_left.text = actions[clickActionTopLeft] - tv_top_center.text = actions[clickActionTopCenter] - tv_top_right.text = actions[clickActionTopRight] - tv_middle_left.text = actions[clickActionMiddleLeft] - tv_middle_right.text = actions[clickActionMiddleRight] - tv_bottom_left.text = actions[clickActionBottomLeft] - tv_bottom_center.text = actions[clickActionBottomCenter] - tv_bottom_right.text = actions[clickActionBottomRight] + tv_top_left.text = actions[clickActionTL] + tv_top_center.text = actions[clickActionTC] + tv_top_right.text = actions[clickActionTR] + tv_middle_left.text = actions[clickActionML] + tv_middle_right.text = actions[clickActionMR] + tv_bottom_left.text = actions[clickActionBL] + tv_bottom_center.text = actions[clickActionBC] + tv_bottom_right.text = actions[clickActionBR] } private fun initViewEvent() { @@ -72,49 +72,49 @@ class ClickActionConfigDialog : BaseDialogFragment() { } tv_top_left.onClick { selectAction { action -> - putPrefInt(PreferKey.clickActionTopLeft, action) + putPrefInt(PreferKey.clickActionTL, action) (it as? TextView)?.text = actions[action] } } tv_top_center.onClick { selectAction { action -> - putPrefInt(PreferKey.clickActionTopCenter, action) + putPrefInt(PreferKey.clickActionTC, action) (it as? TextView)?.text = actions[action] } } tv_top_right.onClick { selectAction { action -> - putPrefInt(PreferKey.clickActionTopRight, action) + putPrefInt(PreferKey.clickActionTR, action) (it as? TextView)?.text = actions[action] } } tv_middle_left.onClick { selectAction { action -> - putPrefInt(PreferKey.clickActionMiddleLeft, action) + putPrefInt(PreferKey.clickActionML, action) (it as? TextView)?.text = actions[action] } } tv_middle_right.onClick { selectAction { action -> - putPrefInt(PreferKey.clickActionMiddleRight, action) + putPrefInt(PreferKey.clickActionMR, action) (it as? TextView)?.text = actions[action] } } tv_bottom_left.onClick { selectAction { action -> - putPrefInt(PreferKey.clickActionBottomLeft, action) + putPrefInt(PreferKey.clickActionBL, action) (it as? TextView)?.text = actions[action] } } tv_bottom_center.onClick { selectAction { action -> - putPrefInt(PreferKey.clickActionBottomCenter, action) + putPrefInt(PreferKey.clickActionBC, action) (it as? TextView)?.text = actions[action] } } tv_bottom_right.onClick { selectAction { action -> - putPrefInt(PreferKey.clickActionBottomRight, action) + putPrefInt(PreferKey.clickActionBR, action) (it as? TextView)?.text = actions[action] } } 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 0fb334989..4bd777ab8 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 @@ -261,31 +261,31 @@ class PageView(context: Context, attrs: AttributeSet) : when { isTextSelected -> isTextSelected = false mcRect.contains(startX, startY) -> if (!isAbortAnim) { - click(AppConfig.clickActionMiddleCenter) + click(AppConfig.clickActionMC) } bcRect.contains(startX, startY) -> { - click(AppConfig.clickActionBottomCenter) + click(AppConfig.clickActionBC) } blRect.contains(startX, startY) -> { - click(AppConfig.clickActionBottomLeft) + click(AppConfig.clickActionBL) } brRect.contains(startX, startY) -> { - click(AppConfig.clickActionBottomRight) + click(AppConfig.clickActionBR) } mlRect.contains(startX, startY) -> { - click(AppConfig.clickActionMiddleLeft) + click(AppConfig.clickActionML) } mrRect.contains(startX, startY) -> { - click(AppConfig.clickActionMiddleRight) + click(AppConfig.clickActionMR) } tlRect.contains(startX, startY) -> { - click(AppConfig.clickActionTopLeft) + click(AppConfig.clickActionTL) } tcRect.contains(startX, startY) -> { - click(AppConfig.clickActionTopCenter) + click(AppConfig.clickActionTC) } trRect.contains(startX, startY) -> { - click(AppConfig.clickActionTopRight) + click(AppConfig.clickActionTR) } } }