pull/32/head
kunfei 5 years ago
parent 01f953ccaa
commit 67edd4172f
  1. 11
      app/src/main/java/io/legado/app/ui/readbook/config/ReadAloudDialog.kt

@ -13,7 +13,6 @@ import io.legado.app.constant.Bus
import io.legado.app.constant.Status import io.legado.app.constant.Status
import io.legado.app.service.ReadAloudService import io.legado.app.service.ReadAloudService
import io.legado.app.ui.readbook.Help import io.legado.app.ui.readbook.Help
import io.legado.app.ui.readbook.ReadBookActivity
import io.legado.app.utils.* import io.legado.app.utils.*
import kotlinx.android.synthetic.main.dialog_read_aloud.* import kotlinx.android.synthetic.main.dialog_read_aloud.*
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
@ -57,9 +56,8 @@ class ReadAloudDialog : DialogFragment() {
private fun initData() { private fun initData() {
observeEvent<Int>(Bus.ALOUD_STATE) { upPlayState(it) } observeEvent<Int>(Bus.ALOUD_STATE) { upPlayState(it) }
observeEvent<Int>(Bus.TTS_DS) { seek_timer.progress = it } observeEvent<Int>(Bus.TTS_DS) { seek_timer.progress = it }
val activity = activity callBack?.readAloudStatus?.let {
if (activity is ReadBookActivity) { upPlayState(it)
upPlayState(activity.readAloudStatus)
} }
seek_timer.progress = ReadAloudService.timeMinute seek_timer.progress = ReadAloudService.timeMinute
tv_timer.text = requireContext().getString(R.string.timer_m, ReadAloudService.timeMinute) tv_timer.text = requireContext().getString(R.string.timer_m, ReadAloudService.timeMinute)
@ -111,10 +109,7 @@ class ReadAloudDialog : DialogFragment() {
} }
private fun initOnClick() { private fun initOnClick() {
iv_menu.onClick { iv_menu.onClick { callBack?.showMenu(); dismiss() }
callBack?.showMenu()
dismiss()
}
iv_menu.onLongClick { callBack?.openChapterList(); true } iv_menu.onLongClick { callBack?.openChapterList(); true }
iv_stop.onClick { ReadAloudService.stop(requireContext()); dismiss() } iv_stop.onClick { ReadAloudService.stop(requireContext()); dismiss() }
iv_play_pause.onClick { postEvent(Bus.READ_ALOUD_BUTTON, true) } iv_play_pause.onClick { postEvent(Bus.READ_ALOUD_BUTTON, true) }

Loading…
Cancel
Save