From 9b12555ae8d49f0b373c8cf8a1a65da9837e2151 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 2 Sep 2019 08:25:57 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/receiver/MediaButtonReceiver.kt | 4 +++- .../main/java/io/legado/app/ui/readbook/ReadBookActivity.kt | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt b/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt index 2e6d33712..54d6ba4e9 100644 --- a/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt +++ b/app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt @@ -48,9 +48,11 @@ class MediaButtonReceiver : BroadcastReceiver() { if (!ActivityHelp.isExist(ReadBookActivity::class.java)) { val intent = Intent(context, ReadBookActivity::class.java) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + intent.putExtra("readAloud", true) context.startActivity(intent) + } else { + postEvent(Bus.READ_ALOUD_BUTTON, true) } - postEvent(Bus.READ_ALOUD_BUTTON, true) } } diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt index ad45d60d2..1d9635ece 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt @@ -324,6 +324,10 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea .getTextChapter(content_text_view, bookChapter, content, viewModel.chapterSize) page_view.upContent() curChapterChanged() + if (intent.getBooleanExtra("readAloud", false)) { + intent.removeExtra("readAloud") + readAloud() + } } viewModel.durChapterIndex - 1 -> launch { viewModel.prevTextChapter = ChapterProvider