Skip to content

Commit 137b75a

Browse files
authored
Update README.md
1 parent 6388881 commit 137b75a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ If no value is passed for the list, by default, **RIGHT** is the direction for s
4848
**Implementation of interface method**
4949
In a notes app, if you wish to delete the note from your database, after it is swiped, then you can used this method to perform the action. The note can be deleted by getting the *NOTE* using the adapter position inside the list passed to RecyclerView Adapter.
5050

51-
override fun swipeToDelete(adapterPosition: Int) {
51+
override fun swipeToDelete(adapterPosition: Int, swipeDirection: DIRECTION) {
5252
adapter.removeItem(adapterPosition)
53+
// swipeDirection gives the direction in which the item was swiped
5354
}
5455
5556
> The third parameter is an optional parameter, for the Color integer, if the user wants a color in the background when the view is swiped out. This is how the user can pass the Color int as the parameter, `ContextCompat.getColor(this, R.color.colorAccent)`
@@ -121,8 +122,9 @@ If no value is passed for the list, by default, **RIGHT** is the direction for s
121122
**Implementation of interface method**
122123
In a notes app, if you wish to perform a task when a note is swiped, then you can used this method to perform the action.
123124

124-
override fun swipeToPerform(adapterPosition: Int) {
125+
override fun swipeToPerform(adapterPosition: Int, swipeDirection: DIRECTION) {
125126
// Perform your task
127+
// swipeDirection gives the direction in which the item was swiped
126128
}
127129
128130
> The third parameter is an optional parameter, for the Color integer, if the user wants a color in the background when the view is swiped out. This is how the user can pass the Color int as the parameter, `ContextCompat.getColor(this, R.color.colorAccent)`

0 commit comments

Comments
 (0)