You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,8 +48,9 @@ If no value is passed for the list, by default, **RIGHT** is the direction for s
48
48
**Implementation of interface method**
49
49
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.
50
50
51
-
override fun swipeToDelete(adapterPosition: Int) {
51
+
override fun swipeToDelete(adapterPosition: Int, swipeDirection: DIRECTION) {
52
52
adapter.removeItem(adapterPosition)
53
+
// swipeDirection gives the direction in which the item was swiped
53
54
}
54
55
55
56
> 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
121
122
**Implementation of interface method**
122
123
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.
123
124
124
-
override fun swipeToPerform(adapterPosition: Int) {
125
+
override fun swipeToPerform(adapterPosition: Int, swipeDirection: DIRECTION) {
125
126
// Perform your task
127
+
// swipeDirection gives the direction in which the item was swiped
126
128
}
127
129
128
130
> 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