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
+11-12Lines changed: 11 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# Android Swipe Actions
2
-
This library helps to add swipe actions to a RecyclerView. A swipe action is an action which is performed when a swipe gesture is recognized on an adapter item. This Library implements a delete action with an undo option which makes it usable out of the box. </br></br>
2
+
This library helps to add swipe actions to a RecyclerView. A swipe action is an action which is performed when a swipe gesture is recognized on an adapter item. The library contains an delete action with an undo option which makes it usable out of the box. </br></br>
colorID =R.color.colorInstantDelete, // background color
41
41
name ="instantDelete") // name of the action --> use this for debugging! otherwise not used
42
42
```
43
-
The pendingDeleteAction uses the Undo feature. Every other parameter besides the RecyclerView and SnackBar parent are optional.
43
+
The pendingDeleteAction uses the undo feature. Every other parameter besides the RecyclerView and SnackBar parent are optional.
44
44
To achieve an instant delete you could just set the undo parameter to false. If you'd like to customize the color and icon of the action you can also do so.
45
45
46
46
Furthermore you can customize the text of the shown SnackBar and specify a callback when items are deleted.
Information of the swiped item can be retrieved from the ViewHolder.
89
-
Originally the adapter position was used for the method call. This was not accurate because items could change positions. To prevent index errors
89
+
Originally the adapter position was used for the method call. This was not accurate because items could change their position in the adapter. To prevent index errors
90
90
the ViewHolder of the given item is used. This provides the benefit of accurate indices since the adapterPosition of the ViewHolder is updated.
91
-
However there is also the possibility of the ViewHolder being recycled or other magic happening internally. To be save you could make sure
92
-
that the adapterPosition makes sense (e.g. not -1 and not higher than the adapter size).
91
+
However there is also the possibility of the ViewHolder being recycled or other magic happening internally. To be save you could check if the adapterPosition makes sense (e.g. not -1 and not higher than the adapter size).
93
92
</br></br>
94
93
And thats all there is to it! Have fun adding those actions to your RecyclerViews!
0 commit comments