From 948f360ebbd147df15d55e086ce9c349ac972b98 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 18 Sep 2019 19:06:13 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/help/IntentDataHelp.kt | 4 +++- .../io/legado/app/ui/book/read/ReadBookActivity.kt | 11 +++++++---- .../app/ui/book/source/manage/BookSourceActivity.kt | 4 ++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/IntentDataHelp.kt b/app/src/main/java/io/legado/app/help/IntentDataHelp.kt index 4c1ca38d5..e7484949e 100644 --- a/app/src/main/java/io/legado/app/help/IntentDataHelp.kt +++ b/app/src/main/java/io/legado/app/help/IntentDataHelp.kt @@ -4,8 +4,10 @@ object IntentDataHelp { private val bigData: MutableMap = mutableMapOf() - fun putData(key: String, data: Any) { + fun putData(data: Any, tag: String = ""): String { + val key = tag + System.currentTimeMillis() bigData[key] = data + return key } fun getData(key: String): Any? { diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index ebf23f520..e94febcbe 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -467,11 +467,14 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea val book = viewModel.bookData.value val textChapter = viewModel.curTextChapter if (book != null && textChapter != null) { - val key = System.currentTimeMillis().toString() - IntentDataHelp.putData(key, textChapter) + val key = IntentDataHelp.putData(textChapter) ReadAloud.play( - this, book.name, textChapter.title, - viewModel.durPageIndex, key, play + this, + book.name, + textChapter.title, + viewModel.durPageIndex, + key, + play ) } } diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 573444123..32510192b 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -21,6 +21,7 @@ import io.legado.app.help.ItemTouchCallback import io.legado.app.help.storage.Restore import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.primaryTextColor +import io.legado.app.service.CheckSourceService import io.legado.app.ui.book.source.edit.SourceEditActivity import io.legado.app.ui.qrcode.QrCodeActivity import io.legado.app.utils.getViewModel @@ -30,6 +31,7 @@ import kotlinx.android.synthetic.main.view_search.* import kotlinx.android.synthetic.main.view_title_bar.* import org.jetbrains.anko.startActivity import org.jetbrains.anko.startActivityForResult +import org.jetbrains.anko.startService class BookSourceActivity : VMBaseActivity(R.layout.activity_book_source), BookSourceAdapter.CallBack, @@ -80,6 +82,8 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity R.id.menu_enable_selection -> viewModel.enableSelection(adapter.getSelectionIds()) R.id.menu_disable_selection -> viewModel.disableSelection(adapter.getSelectionIds()) R.id.menu_del_selection -> viewModel.delSelection(adapter.getSelectionIds()) + R.id.menu_check_book_source -> + startService(Pair("data", adapter.getSelectionIds())) } if (item.groupId == R.id.source_group) { search_view.setQuery(item.title, true)