public class UndoHelper<Item extends IItem>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
UndoHelper.UndoListener<Item extends IItem> |
| Constructor and Description |
|---|
UndoHelper(<any> adapter,
UndoHelper.UndoListener<Item> undoListener)
Constructor to create the UndoHelper
|
| Modifier and Type | Method and Description |
|---|---|
Snackbar |
getSnackBar() |
Snackbar |
remove(java.util.Set<java.lang.Integer> positions)
convenience method to be used if you have previously set a
Snackbar with withSnackBar(Snackbar, String) |
Snackbar |
remove(android.view.View view,
java.lang.String text,
java.lang.String actionText,
int duration,
java.util.Set<java.lang.Integer> positions)
removes items from the ItemAdapter.
|
void |
withSnackBar(Snackbar snackBar,
java.lang.String actionText)
an optional method to add a
Snackbar of your own with custom styling. |
public UndoHelper(<any> adapter,
UndoHelper.UndoListener<Item> undoListener)
adapter - the root FastAdapterundoListener - the listener which gets called when an item was really removedpublic void withSnackBar(Snackbar snackBar,
java.lang.String actionText)
Snackbar of your own with custom styling.
note that using this method will override your custom actionsnackBar - your own SnackbaractionText - the text to show for the Undo Actionpublic Snackbar getSnackBar()
public Snackbar remove(java.util.Set<java.lang.Integer> positions)
Snackbar with withSnackBar(Snackbar, String)positions - the positions where the items were removedwithSnackBar(Snackbar, String) was not previously calledpublic Snackbar remove(android.view.View view,
java.lang.String text,
java.lang.String actionText,
int duration,
java.util.Set<java.lang.Integer> positions)
withSnackBar(Snackbar, String) was used.
if it was not used, a default snackbar will be generatedview - the view which will host the SnackBartext - the text to show on the SnackBaractionText - the text to show for the Undo Actionpositions - the positions where the items were removed