|
|
@ -14,9 +14,13 @@ import io.legado.app.lib.dialogs.selector |
|
|
|
import io.legado.app.ui.book.read.ReadBookActivity |
|
|
|
import io.legado.app.ui.book.read.ReadBookActivity |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.putPrefInt |
|
|
|
import io.legado.app.utils.putPrefInt |
|
|
|
|
|
|
|
import io.legado.app.utils.toastOnUi |
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
|
|
|
|
import splitties.init.appCtx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 点击区域设置 |
|
|
|
|
|
|
|
*/ |
|
|
|
class ClickActionConfigDialog : BaseDialogFragment(R.layout.dialog_click_action_config) { |
|
|
|
class ClickActionConfigDialog : BaseDialogFragment(R.layout.dialog_click_action_config) { |
|
|
|
private val binding by viewBinding(DialogClickActionConfigBinding::bind) |
|
|
|
private val binding by viewBinding(DialogClickActionConfigBinding::bind) |
|
|
|
private val actions by lazy { |
|
|
|
private val actions by lazy { |
|
|
@ -29,6 +33,9 @@ class ClickActionConfigDialog : BaseDialogFragment(R.layout.dialog_click_action_ |
|
|
|
this[4] = getString(R.string.previous_chapter) |
|
|
|
this[4] = getString(R.string.previous_chapter) |
|
|
|
this[5] = getString(R.string.read_aloud_prev_paragraph) |
|
|
|
this[5] = getString(R.string.read_aloud_prev_paragraph) |
|
|
|
this[6] = getString(R.string.read_aloud_next_paragraph) |
|
|
|
this[6] = getString(R.string.read_aloud_next_paragraph) |
|
|
|
|
|
|
|
this[7] = getString(R.string.bookmark_add) |
|
|
|
|
|
|
|
this[8] = getString(R.string.edit_content) |
|
|
|
|
|
|
|
this[9] = getString(R.string.replace_rule) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -57,6 +64,7 @@ class ClickActionConfigDialog : BaseDialogFragment(R.layout.dialog_click_action_ |
|
|
|
tvTopCenter.text = actions[AppConfig.clickActionTC] |
|
|
|
tvTopCenter.text = actions[AppConfig.clickActionTC] |
|
|
|
tvTopRight.text = actions[AppConfig.clickActionTR] |
|
|
|
tvTopRight.text = actions[AppConfig.clickActionTR] |
|
|
|
tvMiddleLeft.text = actions[AppConfig.clickActionML] |
|
|
|
tvMiddleLeft.text = actions[AppConfig.clickActionML] |
|
|
|
|
|
|
|
tvMiddleCenter.text = actions[AppConfig.clickActionMC] |
|
|
|
tvMiddleRight.text = actions[AppConfig.clickActionMR] |
|
|
|
tvMiddleRight.text = actions[AppConfig.clickActionMR] |
|
|
|
tvBottomLeft.text = actions[AppConfig.clickActionBL] |
|
|
|
tvBottomLeft.text = actions[AppConfig.clickActionBL] |
|
|
|
tvBottomCenter.text = actions[AppConfig.clickActionBC] |
|
|
|
tvBottomCenter.text = actions[AppConfig.clickActionBC] |
|
|
@ -91,6 +99,12 @@ class ClickActionConfigDialog : BaseDialogFragment(R.layout.dialog_click_action_ |
|
|
|
(it as? TextView)?.text = actions[action] |
|
|
|
(it as? TextView)?.text = actions[action] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
binding.tvMiddleCenter.setOnClickListener { |
|
|
|
|
|
|
|
selectAction { action -> |
|
|
|
|
|
|
|
putPrefInt(PreferKey.clickActionMC, action) |
|
|
|
|
|
|
|
(it as? TextView)?.text = actions[action] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
binding.tvMiddleRight.setOnClickListener { |
|
|
|
binding.tvMiddleRight.setOnClickListener { |
|
|
|
selectAction { action -> |
|
|
|
selectAction { action -> |
|
|
|
putPrefInt(PreferKey.clickActionMR, action) |
|
|
|
putPrefInt(PreferKey.clickActionMR, action) |
|
|
@ -126,4 +140,17 @@ class ClickActionConfigDialog : BaseDialogFragment(R.layout.dialog_click_action_ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onDestroy() { |
|
|
|
|
|
|
|
super.onDestroy() |
|
|
|
|
|
|
|
AppConfig.run { |
|
|
|
|
|
|
|
if (clickActionTL * clickActionTC * clickActionTR |
|
|
|
|
|
|
|
* clickActionML * clickActionMC * clickActionMR |
|
|
|
|
|
|
|
* clickActionBL * clickActionBC * clickActionBR != 0 |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
putPrefInt(PreferKey.clickActionMC, 0) |
|
|
|
|
|
|
|
appCtx.toastOnUi("当前没有配置菜单区域,自动恢复中间区域为菜单.") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |