|
|
|
@ -152,14 +152,14 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
|
binding.recyclerView.addItemDecoration(VerticalDivider(this)) |
|
|
|
|
adapter = BookSourceAdapter(this, this) |
|
|
|
|
binding.recyclerView.adapter = adapter |
|
|
|
|
val itemTouchCallback = ItemTouchCallback(adapter) |
|
|
|
|
itemTouchCallback.isCanDrag = true |
|
|
|
|
// When this page is opened, it is in selection mode |
|
|
|
|
val dragSelectTouchHelper: DragSelectTouchHelper = |
|
|
|
|
DragSelectTouchHelper(adapter.initDragSelectTouchHelperCallback()).setSlideArea(16, 50) |
|
|
|
|
DragSelectTouchHelper(adapter.dragSelectCallback).setSlideArea(16, 50) |
|
|
|
|
dragSelectTouchHelper.attachToRecyclerView(binding.recyclerView) |
|
|
|
|
// When this page is opened, it is in selection mode |
|
|
|
|
dragSelectTouchHelper.activeSlideSelect() |
|
|
|
|
// Note: need judge selection first, so add ItemTouchHelper after it. |
|
|
|
|
val itemTouchCallback = ItemTouchCallback(adapter) |
|
|
|
|
itemTouchCallback.isCanDrag = true |
|
|
|
|
ItemTouchHelper(itemTouchCallback).attachToRecyclerView(binding.recyclerView) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -339,12 +339,12 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
|
}.show() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun upGroupMenu() { |
|
|
|
|
groupMenu?.removeGroup(R.id.source_group) |
|
|
|
|
private fun upGroupMenu() = groupMenu?.let { menu -> |
|
|
|
|
menu.removeGroup(R.id.source_group) |
|
|
|
|
groups.sortedWith { o1, o2 -> |
|
|
|
|
o1.cnCompare(o2) |
|
|
|
|
}.map { |
|
|
|
|
groupMenu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it) |
|
|
|
|
menu.add(R.id.source_group, Menu.NONE, Menu.NONE, it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|