From 552350a3be074816a0b28d148d436c5db7688c83 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 13 Aug 2020 22:29:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/association/ImportBookSourceActivity.kt | 6 +++++- .../legado/app/ui/association/ImportBookSourceViewModel.kt | 4 ++-- .../io/legado/app/ui/association/ImportRssSourceActivity.kt | 6 +++++- .../legado/app/ui/association/ImportRssSourceViewModel.kt | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt index 1064ac03d..874bb9e5e 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt @@ -47,7 +47,11 @@ class ImportBookSourceActivity : VMBaseActivity( }) viewModel.successLiveData.observe(this, Observer { rotate_loading.hide() - successDialog() + if (it > 0) { + successDialog() + } else { + errorDialog(getString(R.string.wrong_format)) + } }) initData() } diff --git a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt index babcd269c..3fbad78f2 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportBookSourceViewModel.kt @@ -18,7 +18,7 @@ import java.io.File class ImportBookSourceViewModel(app: Application) : BaseViewModel(app) { val errorLiveData = MutableLiveData() - val successLiveData = MutableLiveData() + val successLiveData = MutableLiveData() val allSources = arrayListOf() val sourceCheckState = arrayListOf() @@ -110,7 +110,7 @@ class ImportBookSourceViewModel(app: Application) : BaseViewModel(app) { sourceCheckState.add(has) selectStatus.add(!has) } - successLiveData.postValue(true) + successLiveData.postValue(allSources.size) } } diff --git a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceActivity.kt index e80508295..35e3ca284 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceActivity.kt @@ -47,7 +47,11 @@ class ImportRssSourceActivity : VMBaseActivity( }) viewModel.successLiveData.observe(this, Observer { rotate_loading.hide() - successDialog() + if (it > 0) { + successDialog() + } else { + errorDialog(getString(R.string.wrong_format)) + } }) initData() } diff --git a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceViewModel.kt index 8b6baae29..13b752a79 100644 --- a/app/src/main/java/io/legado/app/ui/association/ImportRssSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/association/ImportRssSourceViewModel.kt @@ -17,7 +17,7 @@ import java.io.File class ImportRssSourceViewModel(app: Application) : BaseViewModel(app) { val errorLiveData = MutableLiveData() - val successLiveData = MutableLiveData() + val successLiveData = MutableLiveData() val allSources = arrayListOf() val sourceCheckState = arrayListOf() @@ -105,7 +105,7 @@ class ImportRssSourceViewModel(app: Application) : BaseViewModel(app) { sourceCheckState.add(has) selectStatus.add(!has) } - successLiveData.postValue(true) + successLiveData.postValue(allSources.size) } }