Skip to content

Commit

Permalink
added demo
Browse files Browse the repository at this point in the history
  • Loading branch information
pknotfound committed Apr 23, 2021
1 parent f59728f commit c960435
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/src/main/java/com/kedia/customswipelibrary/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,24 @@ class MainActivity : AppCompatActivity(), OnSwiped, OnDragged, OnSwipeToPerform
DIRECTION.LEFT,
DIRECTION.RIGHT)
recycler.addSwipeToPerform(list, this, ContextCompat.getColor(this, R.color.colorPrimaryDark))

/**
recycler.addSwipeToPerform(list, this, ContextCompat.getColor(this, R.color.colorPrimaryDark))
recycler.addSwipeToDelete(list, this, ContextCompat.getColor(this, R.color.colorPrimaryDark))
// try {
// SwipeToDelete.javaClass.getDeclaredMethod("some").invoke(SwipeToDelete)
// } catch (e: NoSuchMethodException) {
// e.printStackTrace()
// }
Only one of these methods can be used at once, because add swipe to delete is just a subset of
swipe to perform
*/

}

override fun onPositionDragged(fromPosition: Int, toPosition: Int) {
Log.d("TAG!!!!", "onPositionDragged: ")
adapter.moveItem(fromPosition, toPosition)
}

override fun swipeToDelete(adapterPosition: Int) {
Log.d("TAG!!!!", "swipeToDelete: ")
adapter.removeItem(adapterPosition)
}

Expand Down

0 comments on commit c960435

Please sign in to comment.