This commit is contained in:
kunfei
2023-03-16 15:53:56 +08:00
parent 940b1e00c0
commit 453f9147ee

View File

@@ -59,6 +59,7 @@ class BookshelfManageActivity :
private val groupRequestCode = 22
private val addToGroupRequestCode = 34
private val adapter by lazy { BookAdapter(this, this) }
private val itemTouchCallback by lazy { ItemTouchCallback(adapter) }
private var booksFlowJob: Job? = null
private var menu: Menu? = null
private var searchView: SearchView? = null
@@ -159,7 +160,6 @@ class BookshelfManageActivity :
binding.recyclerView.layoutManager = LinearLayoutManager(this)
binding.recyclerView.addItemDecoration(VerticalDivider(this))
binding.recyclerView.adapter = adapter
val itemTouchCallback = ItemTouchCallback(adapter)
itemTouchCallback.isCanDrag = AppConfig.bookshelfSort == 3
val dragSelectTouchHelper: DragSelectTouchHelper =
DragSelectTouchHelper(adapter.dragSelectCallback).setSlideArea(16, 50)
@@ -281,7 +281,15 @@ class BookshelfManageActivity :
private fun alertDelSelection() {
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) {
okButton { viewModel.deleteBook(adapter.selection) }
val checkBox = CheckBox(this@BookshelfManageActivity).apply {
setText(R.string.delete_book_file)
}
val view = LinearLayout(this@BookshelfManageActivity).apply {
setPadding(16.dpToPx(), 0, 16.dpToPx(), 0)
addView(checkBox)
}
customView { view }
okButton { viewModel.deleteBook(adapter.selection, checkBox.isChecked) }
noButton()
}
}