diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 233ea5486..f4c8bfdf2 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -50,7 +50,7 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity SearchView.OnQueryTextListener { override val viewModel: BookSourceViewModel get() = getViewModel(BookSourceViewModel::class.java) - + private val importRecordKey = "bookSourceRecordKey" private val qrRequestCode = 101 private val importSource = 132 private lateinit var adapter: BookSourceAdapter @@ -199,7 +199,7 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity private fun showImportDialog() { val aCache = ACache.get(this, cacheDir = false) val cacheUrls: MutableList = aCache - .getAsString("sourceUrl") + .getAsString(importRecordKey) ?.splitNotBlank(",") ?.toMutableList() ?: mutableListOf() alert(titleResource = R.string.import_book_source_on_line) { @@ -209,7 +209,7 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity editText = edit_view edit_view.setFilterValues(cacheUrls) { cacheUrls.remove(it) - aCache.put("sourceUrl", cacheUrls.joinToString(",")) + aCache.put(importRecordKey, cacheUrls.joinToString(",")) } } } @@ -218,7 +218,7 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity text?.let { if (!cacheUrls.contains(it)) { cacheUrls.add(0, it) - aCache.put("sourceUrl", cacheUrls.joinToString(",")) + aCache.put(importRecordKey, cacheUrls.joinToString(",")) } Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show() viewModel.importSource(it) { msg -> diff --git a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt index 72446092c..51b72cb3c 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt @@ -45,6 +45,7 @@ class ReplaceRuleActivity : VMBaseActivity(R.layout.activi ReplaceRuleAdapter.CallBack { override val viewModel: ReplaceRuleViewModel get() = getViewModel(ReplaceRuleViewModel::class.java) + private val importRecordKey = "replaceRuleRecordKey" private val importSource = 132 private lateinit var adapter: ReplaceRuleAdapter private var groups = hashSetOf() @@ -149,7 +150,7 @@ class ReplaceRuleActivity : VMBaseActivity(R.layout.activi private fun showImportDialog() { val aCache = ACache.get(this, cacheDir = false) val cacheUrls: MutableList = aCache - .getAsString("replaceRuleUrl") + .getAsString(importRecordKey) ?.splitNotBlank(",") ?.toMutableList() ?: mutableListOf() alert(titleResource = R.string.import_replace_rule_on_line) { @@ -159,7 +160,7 @@ class ReplaceRuleActivity : VMBaseActivity(R.layout.activi editText = edit_view edit_view.setFilterValues(cacheUrls) { cacheUrls.remove(it) - aCache.put("replaceRuleUrl", cacheUrls.joinToString(",")) + aCache.put(importRecordKey, cacheUrls.joinToString(",")) } } } @@ -168,7 +169,7 @@ class ReplaceRuleActivity : VMBaseActivity(R.layout.activi text?.let { if (!cacheUrls.contains(it)) { cacheUrls.add(0, it) - aCache.put("replaceRuleUrl", cacheUrls.joinToString(",")) + aCache.put(importRecordKey, cacheUrls.joinToString(",")) } Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show() viewModel.importSource(it) { msg -> diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt index 6b1c40077..e02207af3 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt @@ -50,7 +50,7 @@ class RssSourceActivity : VMBaseActivity(R.layout.activity_r override val viewModel: RssSourceViewModel get() = getViewModel(RssSourceViewModel::class.java) - + private val importRecordKey = "rssSourceRecordKey" private val qrRequestCode = 101 private val importSource = 13141 private lateinit var adapter: RssSourceAdapter @@ -227,7 +227,7 @@ class RssSourceActivity : VMBaseActivity(R.layout.activity_r private fun showImportDialog() { val aCache = ACache.get(this, cacheDir = false) val cacheUrls: MutableList = aCache - .getAsString("sourceUrl") + .getAsString(importRecordKey) ?.splitNotBlank(",") ?.toMutableList() ?: mutableListOf() alert(titleResource = R.string.import_book_source_on_line) { @@ -237,7 +237,7 @@ class RssSourceActivity : VMBaseActivity(R.layout.activity_r editText = edit_view edit_view.setFilterValues(cacheUrls) { cacheUrls.remove(it) - aCache.put("sourceUrl", cacheUrls.joinToString(",")) + aCache.put(importRecordKey, cacheUrls.joinToString(",")) } } } @@ -246,7 +246,7 @@ class RssSourceActivity : VMBaseActivity(R.layout.activity_r text?.let { if (!cacheUrls.contains(it)) { cacheUrls.add(0, it) - aCache.put("sourceUrl", cacheUrls.joinToString(",")) + aCache.put(importRecordKey, cacheUrls.joinToString(",")) } Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show() viewModel.importSource(it) { msg ->