Skip to content

Commit

Permalink
Merge pull request #13 from Rere-kt/feature/item-touch-helper
Browse files Browse the repository at this point in the history
Update item touch helper
  • Loading branch information
dionep authored Jan 26, 2021
2 parents 7b6574e + 2e07c6d commit e82c567
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions rekukler/src/main/java/com/rerekt/rekukler/RecyclerViewDSL.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ class RecyclerViewConfig(
swipeFlags: Int = 0,
onSwiped: (RecyclerView.ViewHolder, direction: Int) -> Unit = { _, _ -> },
onMove: (RecyclerView.ViewHolder, RecyclerView.ViewHolder) -> Boolean = { _, _ -> true }
) {
itemTouchHelper = ItemTouchHelper(
) = ItemTouchHelper(
object : ItemTouchHelper.Callback() {
override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int = makeMovementFlags(dragFlags, swipeFlags)
override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean =
Expand All @@ -82,8 +81,7 @@ class RecyclerViewConfig(
onSwiped.invoke(viewHolder, direction)
}
}
)
}
).apply { itemTouchHelper = this }

fun dividerItemDecoration(
size: Int,
Expand Down

0 comments on commit e82c567

Please sign in to comment.