|
|
|
@ -227,6 +227,8 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity |
|
|
|
|
R.id.menu_check_source -> checkSource() |
|
|
|
|
R.id.menu_top_sel -> viewModel.topSource(*adapter.getSelection().toTypedArray()) |
|
|
|
|
R.id.menu_bottom_sel -> viewModel.bottomSource(*adapter.getSelection().toTypedArray()) |
|
|
|
|
R.id.menu_add_group -> selectionAddToGroup() |
|
|
|
|
R.id.menu_remove_group -> selectionRemoveFromGroup() |
|
|
|
|
} |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
@ -253,6 +255,48 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity |
|
|
|
|
}.show().applyTint() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressLint("InflateParams") |
|
|
|
|
private fun selectionAddToGroup() { |
|
|
|
|
alert(titleResource = R.string.add_group) { |
|
|
|
|
var editText: AutoCompleteTextView? = null |
|
|
|
|
customView { |
|
|
|
|
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { |
|
|
|
|
editText = edit_view |
|
|
|
|
edit_view.setHint(R.string.group_name) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
okButton { |
|
|
|
|
editText?.text?.toString()?.let { |
|
|
|
|
if (it.isNotEmpty()) { |
|
|
|
|
viewModel.selectionAddToGroup(adapter.getSelection(), it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
noButton { } |
|
|
|
|
}.show().applyTint() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressLint("InflateParams") |
|
|
|
|
private fun selectionRemoveFromGroup() { |
|
|
|
|
alert(titleResource = R.string.remove_group) { |
|
|
|
|
var editText: AutoCompleteTextView? = null |
|
|
|
|
customView { |
|
|
|
|
layoutInflater.inflate(R.layout.dialog_edit_text, null).apply { |
|
|
|
|
editText = edit_view |
|
|
|
|
edit_view.setHint(R.string.group_name) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
okButton { |
|
|
|
|
editText?.text?.toString()?.let { |
|
|
|
|
if (it.isNotEmpty()) { |
|
|
|
|
viewModel.selectionRemoveFromGroup(adapter.getSelection(), it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
noButton { } |
|
|
|
|
}.show().applyTint() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun upGroupMenu() { |
|
|
|
|
groupMenu?.removeGroup(R.id.source_group) |
|
|
|
|
groups.sortedWith(Collator.getInstance(java.util.Locale.CHINESE)) |
|
|
|
|