pull/34/head
kunfei 5 years ago
parent ba179cfee8
commit 948f360ebb
  1. 4
      app/src/main/java/io/legado/app/help/IntentDataHelp.kt
  2. 11
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  3. 4
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -4,8 +4,10 @@ object IntentDataHelp {
private val bigData: MutableMap<String, Any> = 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? {

@ -467,11 +467,14 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(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
)
}
}

@ -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<BookSourceViewModel>(R.layout.activity_book_source),
BookSourceAdapter.CallBack,
@ -80,6 +82,8 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(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<CheckSourceService>(Pair("data", adapter.getSelectionIds()))
}
if (item.groupId == R.id.source_group) {
search_view.setQuery(item.title, true)

Loading…
Cancel
Save