|
|
@ -22,6 +22,7 @@ import io.legado.app.constant.AppPattern |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
import io.legado.app.databinding.ActivityBookSourceBinding |
|
|
|
import io.legado.app.databinding.ActivityBookSourceBinding |
|
|
|
|
|
|
|
import io.legado.app.databinding.DialogEditTextBinding |
|
|
|
import io.legado.app.help.IntentDataHelp |
|
|
|
import io.legado.app.help.IntentDataHelp |
|
|
|
import io.legado.app.help.LocalConfig |
|
|
|
import io.legado.app.help.LocalConfig |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
@ -38,7 +39,6 @@ import io.legado.app.ui.widget.dialog.TextDialog |
|
|
|
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper |
|
|
|
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper |
|
|
|
import io.legado.app.ui.widget.recycler.ItemTouchCallback |
|
|
|
import io.legado.app.ui.widget.recycler.ItemTouchCallback |
|
|
|
import io.legado.app.ui.widget.recycler.VerticalDivider |
|
|
|
import io.legado.app.ui.widget.recycler.VerticalDivider |
|
|
|
import io.legado.app.ui.widget.text.AutoCompleteTextView |
|
|
|
|
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.* |
|
|
|
import org.jetbrains.anko.startActivity |
|
|
|
import org.jetbrains.anko.startActivity |
|
|
|
import org.jetbrains.anko.startActivityForResult |
|
|
|
import org.jetbrains.anko.startActivityForResult |
|
|
@ -279,15 +279,12 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
private fun checkSource() { |
|
|
|
private fun checkSource() { |
|
|
|
alert(titleResource = R.string.search_book_key) { |
|
|
|
alert(titleResource = R.string.search_book_key) { |
|
|
|
var editText: AutoCompleteTextView? = null |
|
|
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { |
|
|
|
customView { |
|
|
|
editView.setText(CheckSource.keyword) |
|
|
|
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { |
|
|
|
|
|
|
|
editText = findViewById(R.id.edit_view) |
|
|
|
|
|
|
|
editText?.setText(CheckSource.keyword) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
customView = alertBinding.root |
|
|
|
okButton { |
|
|
|
okButton { |
|
|
|
editText?.text?.toString()?.let { |
|
|
|
alertBinding.editView.text?.toString()?.let { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
CheckSource.keyword = it |
|
|
|
CheckSource.keyword = it |
|
|
|
} |
|
|
|
} |
|
|
@ -301,17 +298,14 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
private fun selectionAddToGroups() { |
|
|
|
private fun selectionAddToGroups() { |
|
|
|
alert(titleResource = R.string.add_group) { |
|
|
|
alert(titleResource = R.string.add_group) { |
|
|
|
var editText: AutoCompleteTextView? = null |
|
|
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { |
|
|
|
customView { |
|
|
|
editView.setHint(R.string.group_name) |
|
|
|
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { |
|
|
|
editView.setFilterValues(groups.toList()) |
|
|
|
editText = findViewById(R.id.edit_view) |
|
|
|
editView.dropDownHeight = 180.dp |
|
|
|
editText?.setHint(R.string.group_name) |
|
|
|
|
|
|
|
editText?.setFilterValues(groups.toList()) |
|
|
|
|
|
|
|
editText?.dropDownHeight = 180.dp |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
customView = alertBinding.root |
|
|
|
okButton { |
|
|
|
okButton { |
|
|
|
editText?.text?.toString()?.let { |
|
|
|
alertBinding.editView.text?.toString()?.let { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
viewModel.selectionAddToGroups(adapter.getSelection(), it) |
|
|
|
viewModel.selectionAddToGroups(adapter.getSelection(), it) |
|
|
|
} |
|
|
|
} |
|
|
@ -324,17 +318,14 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
private fun selectionRemoveFromGroups() { |
|
|
|
private fun selectionRemoveFromGroups() { |
|
|
|
alert(titleResource = R.string.remove_group) { |
|
|
|
alert(titleResource = R.string.remove_group) { |
|
|
|
var editText: AutoCompleteTextView? = null |
|
|
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { |
|
|
|
customView { |
|
|
|
editView.setHint(R.string.group_name) |
|
|
|
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { |
|
|
|
editView.setFilterValues(groups.toList()) |
|
|
|
editText = findViewById(R.id.edit_view) |
|
|
|
editView.dropDownHeight = 180.dp |
|
|
|
editText?.setHint(R.string.group_name) |
|
|
|
|
|
|
|
editText?.setFilterValues(groups.toList()) |
|
|
|
|
|
|
|
editText?.dropDownHeight = 180.dp |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
customView = alertBinding.root |
|
|
|
okButton { |
|
|
|
okButton { |
|
|
|
editText?.text?.toString()?.let { |
|
|
|
alertBinding.editView.text?.toString()?.let { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
viewModel.selectionRemoveFromGroups(adapter.getSelection(), it) |
|
|
|
viewModel.selectionRemoveFromGroups(adapter.getSelection(), it) |
|
|
|
} |
|
|
|
} |
|
|
@ -360,19 +351,16 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
?.splitNotBlank(",") |
|
|
|
?.splitNotBlank(",") |
|
|
|
?.toMutableList() ?: mutableListOf() |
|
|
|
?.toMutableList() ?: mutableListOf() |
|
|
|
alert(titleResource = R.string.import_book_source_on_line) { |
|
|
|
alert(titleResource = R.string.import_book_source_on_line) { |
|
|
|
var editText: AutoCompleteTextView? = null |
|
|
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { |
|
|
|
customView { |
|
|
|
editView.setFilterValues(cacheUrls) |
|
|
|
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { |
|
|
|
editView.delCallBack = { |
|
|
|
editText = findViewById(R.id.edit_view) |
|
|
|
|
|
|
|
editText?.setFilterValues(cacheUrls) |
|
|
|
|
|
|
|
editText?.delCallBack = { |
|
|
|
|
|
|
|
cacheUrls.remove(it) |
|
|
|
cacheUrls.remove(it) |
|
|
|
aCache.put(importRecordKey, cacheUrls.joinToString(",")) |
|
|
|
aCache.put(importRecordKey, cacheUrls.joinToString(",")) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
customView = alertBinding.root |
|
|
|
okButton { |
|
|
|
okButton { |
|
|
|
val text = editText?.text?.toString() |
|
|
|
val text = alertBinding.editView.text?.toString() |
|
|
|
text?.let { |
|
|
|
text?.let { |
|
|
|
if (!cacheUrls.contains(it)) { |
|
|
|
if (!cacheUrls.contains(it)) { |
|
|
|
cacheUrls.add(0, it) |
|
|
|
cacheUrls.add(0, it) |
|
|
|