From 767b573da91c2f70042c047158a00873e5c9d5af Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 16 Apr 2021 22:24:23 +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 --- .../ui/book/read/config/ReadAloudDialog.kt | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) 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)