|
|
@ -21,6 +21,7 @@ import io.legado.app.lib.theme.ATH |
|
|
|
import io.legado.app.ui.book.group.GroupManageDialog |
|
|
|
import io.legado.app.ui.book.group.GroupManageDialog |
|
|
|
import io.legado.app.ui.book.group.GroupSelectDialog |
|
|
|
import io.legado.app.ui.book.group.GroupSelectDialog |
|
|
|
import io.legado.app.ui.widget.SelectActionBar |
|
|
|
import io.legado.app.ui.widget.SelectActionBar |
|
|
|
|
|
|
|
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.utils.applyTint |
|
|
|
import io.legado.app.utils.applyTint |
|
|
@ -71,6 +72,12 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi |
|
|
|
val itemTouchCallback = ItemTouchCallback() |
|
|
|
val itemTouchCallback = ItemTouchCallback() |
|
|
|
itemTouchCallback.onItemTouchCallbackListener = adapter |
|
|
|
itemTouchCallback.onItemTouchCallbackListener = adapter |
|
|
|
itemTouchCallback.isCanDrag = getPrefInt(PreferKey.bookshelfSort) == 3 |
|
|
|
itemTouchCallback.isCanDrag = getPrefInt(PreferKey.bookshelfSort) == 3 |
|
|
|
|
|
|
|
val dragSelectTouchHelper: DragSelectTouchHelper = |
|
|
|
|
|
|
|
DragSelectTouchHelper(adapter.initDragSelectTouchHelperCallback()).setSlideArea(16, 50) |
|
|
|
|
|
|
|
dragSelectTouchHelper.attachToRecyclerView(recycler_view) |
|
|
|
|
|
|
|
// When this page is opened, it is in selection mode |
|
|
|
|
|
|
|
dragSelectTouchHelper.activeSlideSelect() |
|
|
|
|
|
|
|
// Note: need judge selection first, so add ItemTouchHelper after it. |
|
|
|
ItemTouchHelper(itemTouchCallback).attachToRecyclerView(recycler_view) |
|
|
|
ItemTouchHelper(itemTouchCallback).attachToRecyclerView(recycler_view) |
|
|
|
select_action_bar.setMainActionText(R.string.move_to_group) |
|
|
|
select_action_bar.setMainActionText(R.string.move_to_group) |
|
|
|
select_action_bar.inflateMenu(R.menu.arrange_book_sel) |
|
|
|
select_action_bar.inflateMenu(R.menu.arrange_book_sel) |
|
|
|