|
@@ -59,6 +59,7 @@ class BookshelfManageActivity :
|
|
|
private val groupRequestCode = 22
|
|
private val groupRequestCode = 22
|
|
|
private val addToGroupRequestCode = 34
|
|
private val addToGroupRequestCode = 34
|
|
|
private val adapter by lazy { BookAdapter(this, this) }
|
|
private val adapter by lazy { BookAdapter(this, this) }
|
|
|
|
|
+ private val itemTouchCallback by lazy { ItemTouchCallback(adapter) }
|
|
|
private var booksFlowJob: Job? = null
|
|
private var booksFlowJob: Job? = null
|
|
|
private var menu: Menu? = null
|
|
private var menu: Menu? = null
|
|
|
private var searchView: SearchView? = null
|
|
private var searchView: SearchView? = null
|
|
@@ -159,7 +160,6 @@ class BookshelfManageActivity :
|
|
|
binding.recyclerView.layoutManager = LinearLayoutManager(this)
|
|
binding.recyclerView.layoutManager = LinearLayoutManager(this)
|
|
|
binding.recyclerView.addItemDecoration(VerticalDivider(this))
|
|
binding.recyclerView.addItemDecoration(VerticalDivider(this))
|
|
|
binding.recyclerView.adapter = adapter
|
|
binding.recyclerView.adapter = adapter
|
|
|
- val itemTouchCallback = ItemTouchCallback(adapter)
|
|
|
|
|
itemTouchCallback.isCanDrag = AppConfig.bookshelfSort == 3
|
|
itemTouchCallback.isCanDrag = AppConfig.bookshelfSort == 3
|
|
|
val dragSelectTouchHelper: DragSelectTouchHelper =
|
|
val dragSelectTouchHelper: DragSelectTouchHelper =
|
|
|
DragSelectTouchHelper(adapter.dragSelectCallback).setSlideArea(16, 50)
|
|
DragSelectTouchHelper(adapter.dragSelectCallback).setSlideArea(16, 50)
|
|
@@ -281,7 +281,15 @@ class BookshelfManageActivity :
|
|
|
|
|
|
|
|
private fun alertDelSelection() {
|
|
private fun alertDelSelection() {
|
|
|
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) {
|
|
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()
|
|
noButton()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|