public class UndoHelper<Item extends com.mikepenz.fastadapter.IItem>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
UndoHelper.UndoListener<Item extends com.mikepenz.fastadapter.IItem> |
| Constructor and Description |
|---|
UndoHelper(com.mikepenz.fastadapter.FastAdapter<Item> adapter,
UndoHelper.UndoListener<Item> undoListener)
Constructor to create the UndoHelper
|
| Modifier and Type | Method and Description |
|---|---|
android.support.design.widget.Snackbar |
getSnackBar() |
android.support.design.widget.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) |
android.support.design.widget.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(android.support.design.widget.Snackbar snackBar,
java.lang.String actionText)
an optional method to add a
Snackbar of your own with custom styling. |
public UndoHelper(com.mikepenz.fastadapter.FastAdapter<Item> adapter, UndoHelper.UndoListener<Item> undoListener)
adapter - the root FastAdapterundoListener - the listener which gets called when an item was really removedpublic void withSnackBar(@NonNull
android.support.design.widget.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 Action@Nullable public android.support.design.widget.Snackbar getSnackBar()
@Nullable public android.support.design.widget.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 android.support.design.widget.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