pull/951/head
gedoor 4 years ago
parent e7fe6b0d83
commit 767b573da9
  1. 42
      app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt

@ -82,7 +82,6 @@ class ReadAloudDialog : BaseDialogFragment() {
cbTtsFollowSys.setTextColor(textColor)
}
initData()
initOnChange()
initEvent()
}
@ -95,7 +94,25 @@ class ReadAloudDialog : BaseDialogFragment() {
seekTtsSpeechRate.progress = AppConfig.ttsSpeechRate
}
private fun initOnChange() = with(binding) {
private fun initEvent() = with(binding) {
llMainMenu.setOnClickListener {
callBack?.showMenuBar()
dismissAllowingStateLoss()
}
llSetting.setOnClickListener {
ReadAloudConfigDialog().show(childFragmentManager, "readAloudConfigDialog")
}
tvPre.setOnClickListener { ReadBook.moveToPrevChapter(upContent = true, toLast = false) }
tvNext.setOnClickListener { ReadBook.moveToNextChapter(true) }
ivStop.setOnClickListener {
ReadAloud.stop(requireContext())
dismissAllowingStateLoss()
}
ivPlayPause.setOnClickListener { callBack?.onClickReadAloud() }
ivPlayPrev.setOnClickListener { ReadAloud.prevParagraph(requireContext()) }
ivPlayNext.setOnClickListener { ReadAloud.nextParagraph(requireContext()) }
llCatalog.setOnClickListener { callBack?.openChapterList() }
llToBackstage.setOnClickListener { callBack?.finish() }
cbTtsFollowSys.setOnCheckedChangeListener { _, isChecked ->
requireContext().putPrefBoolean("ttsFollowSys", isChecked)
seekTtsSpeechRate.isEnabled = !isChecked
@ -119,27 +136,6 @@ class ReadAloudDialog : BaseDialogFragment() {
})
}
private fun initEvent() = with(binding) {
llMainMenu.setOnClickListener {
callBack?.showMenuBar()
dismissAllowingStateLoss()
}
llSetting.setOnClickListener {
ReadAloudConfigDialog().show(childFragmentManager, "readAloudConfigDialog")
}
tvPre.setOnClickListener { ReadBook.moveToPrevChapter(upContent = true, toLast = false) }
tvNext.setOnClickListener { ReadBook.moveToNextChapter(true) }
ivStop.setOnClickListener {
ReadAloud.stop(requireContext())
dismissAllowingStateLoss()
}
ivPlayPause.setOnClickListener { callBack?.onClickReadAloud() }
ivPlayPrev.setOnClickListener { ReadAloud.prevParagraph(requireContext()) }
ivPlayNext.setOnClickListener { ReadAloud.nextParagraph(requireContext()) }
llCatalog.setOnClickListener { callBack?.openChapterList() }
llToBackstage.setOnClickListener { callBack?.finish() }
}
private fun upPlayState() {
if (!BaseReadAloudService.pause) {
binding.ivPlayPause.setImageResource(R.drawable.ic_pause_24dp)

Loading…
Cancel
Save