pull/32/head
kunfei 5 years ago
parent 9aa2735767
commit 9b12555ae8
  1. 4
      app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt
  2. 4
      app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt

@ -48,11 +48,13 @@ class MediaButtonReceiver : BroadcastReceiver() {
if (!ActivityHelp.isExist(ReadBookActivity::class.java)) { if (!ActivityHelp.isExist(ReadBookActivity::class.java)) {
val intent = Intent(context, ReadBookActivity::class.java) val intent = Intent(context, ReadBookActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.putExtra("readAloud", true)
context.startActivity(intent) context.startActivity(intent)
} } else {
postEvent(Bus.READ_ALOUD_BUTTON, true) postEvent(Bus.READ_ALOUD_BUTTON, true)
} }
} }
}
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
if (handleIntent(context, intent) && isOrderedBroadcast) { if (handleIntent(context, intent) && isOrderedBroadcast) {

@ -324,6 +324,10 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
.getTextChapter(content_text_view, bookChapter, content, viewModel.chapterSize) .getTextChapter(content_text_view, bookChapter, content, viewModel.chapterSize)
page_view.upContent() page_view.upContent()
curChapterChanged() curChapterChanged()
if (intent.getBooleanExtra("readAloud", false)) {
intent.removeExtra("readAloud")
readAloud()
}
} }
viewModel.durChapterIndex - 1 -> launch { viewModel.durChapterIndex - 1 -> launch {
viewModel.prevTextChapter = ChapterProvider viewModel.prevTextChapter = ChapterProvider

Loading…
Cancel
Save