|
|
@ -166,24 +166,24 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
private fun showImportDialog() { |
|
|
|
private fun showImportDialog() { |
|
|
|
val aCache = ACache.get(this, cacheDir = false) |
|
|
|
val aCache = ACache.get(this, cacheDir = false) |
|
|
|
val cacheUrls: MutableList<String>? = aCache |
|
|
|
val cacheUrls: MutableList<String> = aCache |
|
|
|
.getAsString("sourceUrl") |
|
|
|
.getAsString("sourceUrl") |
|
|
|
?.splitNotBlank(",") |
|
|
|
?.splitNotBlank(",") |
|
|
|
?.toMutableList() |
|
|
|
?.toMutableList() ?: mutableListOf() |
|
|
|
alert(titleResource = R.string.import_book_source_on_line) { |
|
|
|
alert(titleResource = R.string.import_book_source_on_line) { |
|
|
|
var editText: ATEAutoCompleteTextView? = null |
|
|
|
var editText: ATEAutoCompleteTextView? = null |
|
|
|
customView { |
|
|
|
customView { |
|
|
|
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { |
|
|
|
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { |
|
|
|
editText = edit_view |
|
|
|
editText = edit_view |
|
|
|
edit_view.setFilterValues(cacheUrls) { |
|
|
|
edit_view.setFilterValues(cacheUrls) { |
|
|
|
cacheUrls?.remove(it) |
|
|
|
cacheUrls.remove(it) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
okButton { |
|
|
|
okButton { |
|
|
|
val text = editText?.text?.toString() |
|
|
|
val text = editText?.text?.toString() |
|
|
|
text?.let { |
|
|
|
text?.let { |
|
|
|
if (cacheUrls?.contains(it) == true) { |
|
|
|
if (!cacheUrls.contains(it)) { |
|
|
|
cacheUrls.add(0, it) |
|
|
|
cacheUrls.add(0, it) |
|
|
|
aCache.put("sourceUrl", cacheUrls.joinToString(",")) |
|
|
|
aCache.put("sourceUrl", cacheUrls.joinToString(",")) |
|
|
|
} |
|
|
|
} |
|
|
|