pull/48/head
kunfei 5 years ago
parent a48ed64d8e
commit 7e65dceb53
  1. 9
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -106,7 +106,7 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
intent.data?.let { intent.data?.let {
when (it.path) { when (it.path) {
"/importonline" -> it.getQueryParameter("src")?.let { url -> "/importonline" -> it.getQueryParameter("src")?.let { url ->
Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE) Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show()
viewModel.importSource(url) { msg -> viewModel.importSource(url) { msg ->
title_bar.snackbar(msg) title_bar.snackbar(msg)
} }
@ -201,7 +201,7 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
cacheUrls.add(0, it) cacheUrls.add(0, it)
aCache.put("sourceUrl", cacheUrls.joinToString(",")) aCache.put("sourceUrl", cacheUrls.joinToString(","))
} }
Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE) Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show()
viewModel.importSource(it) { msg -> viewModel.importSource(it) { msg ->
title_bar.snackbar(msg) title_bar.snackbar(msg)
} }
@ -235,7 +235,7 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
override fun onFilePicked(requestCode: Int, currentPath: String) { override fun onFilePicked(requestCode: Int, currentPath: String) {
if (requestCode == importSource) { if (requestCode == importSource) {
Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE) Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show()
viewModel.importSourceFromFilePath(currentPath) { msg -> viewModel.importSourceFromFilePath(currentPath) { msg ->
title_bar.snackbar(msg) title_bar.snackbar(msg)
} }
@ -278,7 +278,7 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
when (requestCode) { when (requestCode) {
qrRequestCode -> if (resultCode == RESULT_OK) { qrRequestCode -> if (resultCode == RESULT_OK) {
data?.getStringExtra("result")?.let { data?.getStringExtra("result")?.let {
Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE) Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show()
viewModel.importSource(it) { msg -> viewModel.importSource(it) { msg ->
title_bar.snackbar(msg) title_bar.snackbar(msg)
} }
@ -289,6 +289,7 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
val path = FileUtils.getPath(this, it) val path = FileUtils.getPath(this, it)
if (path != null) { if (path != null) {
Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE) Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE)
.show()
viewModel.importSourceFromFilePath(path) { msg -> viewModel.importSourceFromFilePath(path) { msg ->
title_bar.snackbar(msg) title_bar.snackbar(msg)
} }

Loading…
Cancel
Save