From 2e07c6db5c135cc3bc31a88b861e983e8c90a060 Mon Sep 17 00:00:00 2001 From: Rakhimulin Damir Date: Tue, 26 Jan 2021 17:37:43 +0300 Subject: [PATCH] Update item touch helper --- .../src/main/java/com/rerekt/rekukler/RecyclerViewDSL.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rekukler/src/main/java/com/rerekt/rekukler/RecyclerViewDSL.kt b/rekukler/src/main/java/com/rerekt/rekukler/RecyclerViewDSL.kt index 2105563..74f35a6 100644 --- a/rekukler/src/main/java/com/rerekt/rekukler/RecyclerViewDSL.kt +++ b/rekukler/src/main/java/com/rerekt/rekukler/RecyclerViewDSL.kt @@ -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 = @@ -82,8 +81,7 @@ class RecyclerViewConfig( onSwiped.invoke(viewHolder, direction) } } - ) - } + ).apply { itemTouchHelper = this } fun dividerItemDecoration( size: Int,