|
|
@ -58,6 +58,7 @@ class DownloadActivity : VMBaseActivity<DownloadViewModel>(R.layout.activity_dow |
|
|
|
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { |
|
|
|
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { |
|
|
|
when (item.itemId) { |
|
|
|
when (item.itemId) { |
|
|
|
R.id.menu_download -> launch(IO) { |
|
|
|
R.id.menu_download -> launch(IO) { |
|
|
|
|
|
|
|
if (adapter.downloadMap.isNullOrEmpty()) { |
|
|
|
App.db.bookDao().webBooks.forEach { book -> |
|
|
|
App.db.bookDao().webBooks.forEach { book -> |
|
|
|
Download.start( |
|
|
|
Download.start( |
|
|
|
this@DownloadActivity, |
|
|
|
this@DownloadActivity, |
|
|
@ -66,6 +67,9 @@ class DownloadActivity : VMBaseActivity<DownloadViewModel>(R.layout.activity_dow |
|
|
|
book.totalChapterNum |
|
|
|
book.totalChapterNum |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Download.stop(this@DownloadActivity) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return super.onCompatOptionsItemSelected(item) |
|
|
|
return super.onCompatOptionsItemSelected(item) |
|
|
|