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) } }