public class TimedUndoAdapter extends SimpleSwipeUndoAdapter
SimpleSwipeUndoAdapter which automatically dismisses items after a timeout.| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_TIMEOUT_MS
The default time in milliseconds before an item in the undo state should automatically dismiss.
|
IGNORE_ITEM_VIEW_TYPE, NO_SELECTION| Constructor and Description |
|---|
TimedUndoAdapter(V undoAdapter,
Context context,
OnDismissCallback dismissCallback)
Creates a new
TimedUndoAdapterGen, decorating given BaseAdapter. |
| Modifier and Type | Method and Description |
|---|---|
void |
dismiss(int position)
Dismisses the
View corresponding to given position. |
void |
onDismiss(ViewGroup listView,
int[] reverseSortedPositions)
Called when the user has indicated they she would like to dismiss one or
more list item positions.
|
void |
onDismiss(View view,
int position)
Called when the user has definitively dismissed an item.
Do NOT remove the item from the adapter here! Instead, do this in OnDismissCallback.onDismiss(android.view.ViewGroup, int[]). |
void |
onUndo(View view,
int position)
Called when the undo button is clicked for given position, and the primary
View is shown. |
void |
onUndoShown(View view,
int position)
Called when the undo
View is shown for given position. |
void |
setTimeoutMs(long timeoutMs)
Sets the time in milliseconds after which an item in the undo state should automatically dismiss.
|
getPrimaryView, getUndoView, getViewgetUndoCallback, setDismissableManager, setListViewWrapper, setSwipeUndoTouchListener, setUndoCallback, undoadd, areAllItemsEnabled, getCount, getDecoratedBaseAdapter, getDropDownView, getItem, getItemId, getItemViewType, getListViewWrapper, getPositionForSection, getRootAdapter, getSectionForPosition, getSections, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, setAbsListView, swapItems, unregisterDataSetObserverpublic static final long DEFAULT_TIMEOUT_MS
public TimedUndoAdapter(V undoAdapter,
Context context,
OnDismissCallback dismissCallback)
TimedUndoAdapterGen, decorating given BaseAdapter.undoAdapter - the BaseAdapter that is decorated. Must implement
UndoAdapter.context - the Context.dismissCallback - the OnDismissCallback that is notified of dismissed items.public void setTimeoutMs(long timeoutMs)
public void onUndoShown(View view, int position)
UndoCallbackView is shown for given position.onUndoShown in interface UndoCallbackonUndoShown in class SimpleSwipeUndoAdapterview - the parent View, which contains both the primary and the undo Views.position - the position for which the undo View is shown.public void onUndo(View view, int position)
UndoCallbackView is shown.onUndo in interface UndoCallbackonUndo in class SimpleSwipeUndoAdapterview - the parent View, which contains both the primary and the undo Views.position - the position for which the button has been clicked.public void onDismiss(View view, int position)
UndoCallbackOnDismissCallback.onDismiss(android.view.ViewGroup, int[]).onDismiss in interface UndoCallbackonDismiss in class SimpleSwipeUndoAdapterview - the parent View, which contains both the primary and the undo Views.position - the position of the item that is dismissed.public void dismiss(int position)
SwipeUndoAdapterView corresponding to given position. Calling this method has the same effect as manually swiping an item off the screen.dismiss in class SwipeUndoAdapterposition - the position of the item in the ListAdapter. Must be visible.public void onDismiss(ViewGroup listView, int[] reverseSortedPositions)
OnDismissCallbackonDismiss in interface OnDismissCallbackonDismiss in class SimpleSwipeUndoAdapterlistView - The originating ListView implementationreverseSortedPositions - An array of positions to dismiss, sorted in descending order
for convenience.