diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt index e134884b7..8213c8bee 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt +++ b/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)