mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
216de91ce0
commit
078a42d0d8
@ -141,7 +141,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
private var autoPageJob: Job? = null
|
private var autoPageJob: Job? = null
|
||||||
private var backupJob: Job? = null
|
private var backupJob: Job? = null
|
||||||
private var keepScreenJon: Job? = null
|
private var keepScreenJon: Job? = null
|
||||||
private val tts by lazy { TTS() }
|
private var tts: TTS? = null
|
||||||
val textActionMenu: TextActionMenu by lazy {
|
val textActionMenu: TextActionMenu by lazy {
|
||||||
TextActionMenu(this, this)
|
TextActionMenu(this, this)
|
||||||
}
|
}
|
||||||
@ -633,7 +633,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
when (itemId) {
|
when (itemId) {
|
||||||
R.id.menu_aloud -> when (AppConfig.contentSelectSpeakMod) {
|
R.id.menu_aloud -> when (AppConfig.contentSelectSpeakMod) {
|
||||||
1 -> binding.readView.aloudStartSelect()
|
1 -> binding.readView.aloudStartSelect()
|
||||||
else -> tts.speak(binding.readView.getSelectText())
|
else -> speak(binding.readView.getSelectText())
|
||||||
}
|
}
|
||||||
R.id.menu_bookmark -> binding.readView.curPage.let {
|
R.id.menu_bookmark -> binding.readView.curPage.let {
|
||||||
val bookmark = it.createBookmark()
|
val bookmark = it.createBookmark()
|
||||||
@ -683,6 +683,13 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
readView.isTextSelected = false
|
readView.isTextSelected = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun speak(text: String) {
|
||||||
|
if (tts == null) {
|
||||||
|
tts = TTS()
|
||||||
|
}
|
||||||
|
tts?.speak(text)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 鼠标滚轮翻页
|
* 鼠标滚轮翻页
|
||||||
*/
|
*/
|
||||||
@ -1196,7 +1203,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
tts.clearTts()
|
tts?.clearTts()
|
||||||
textActionMenu.dismiss()
|
textActionMenu.dismiss()
|
||||||
popupAction.dismiss()
|
popupAction.dismiss()
|
||||||
binding.readView.onDestroy()
|
binding.readView.onDestroy()
|
||||||
|
Loading…
Reference in New Issue
Block a user