public class ItemReorderBehavior extends ListViewBehavior
ListViewBehavior
that can be used to allow the end user
to reorder items from the list with a combination of long press and drag.Modifier and Type | Class and Description |
---|---|
static interface |
ItemReorderBehavior.ItemReorderListener
Interface definition for a callback to be invoked when item reorder is occurring.
|
Constructor and Description |
---|
ItemReorderBehavior()
Creates a new instance of the SelectionBehavior.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ItemReorderBehavior.ItemReorderListener listener)
Adds a listener to be called when reorder occurs.
|
int |
getScrollValue() |
boolean |
isInProgress()
Returns true if the current behavior is in progress.
|
void |
onAttached(RadListView listView)
Called when the behavior is attached to
RadListView with
addBehavior(ListViewBehavior). |
void |
onDispatchDraw(Canvas canvas)
Called when
RadListView 's onDispatchDraw method is called. |
boolean |
onFling(MotionEvent motionEvent,
MotionEvent motionEvent2,
float v,
float v2)
Called when the fling gesture is detected by
RadListView 's
ListViewGestureListener . |
void |
onLongPress(MotionEvent motionEvent)
Called when the long press gesture is detected by
RadListView 's
ListViewGestureListener . |
void |
onLongPressDrag(float startX,
float startY,
float currentX,
float currentY)
Called when the drag gesture is detected by
RadListView 's
ListViewGestureListener which started with long press. |
boolean |
onLongPressDragEnded(boolean isCanceled)
Called when a current gesture combination of long press and drag ends on up or cancel.
|
void |
removeListener(ItemReorderBehavior.ItemReorderListener listener)
Removes a listener that is called when reorder occurs.
|
void |
setScrollValue(int scrollValue) |
bindViewHolder, createViewHolder, getItemViewType, managesViewHolders, onActionUpOrCancel, onDetached, onInterceptTouchEvent, onLayout, onScrolled, onShortPressDrag, onTapUp
public ItemReorderBehavior()
public void addListener(ItemReorderBehavior.ItemReorderListener listener)
listener
- the new listener.public void removeListener(ItemReorderBehavior.ItemReorderListener listener)
listener
- the listener to remove.public boolean isInProgress()
ListViewBehavior
isInProgress
in class ListViewBehavior
public void onAttached(RadListView listView)
ListViewBehavior
RadListView
with
addBehavior(ListViewBehavior).onAttached
in class ListViewBehavior
listView
- The parent list viewpublic void onLongPress(MotionEvent motionEvent)
ListViewBehavior
RadListView
's
ListViewGestureListener
.onLongPress
in class ListViewBehavior
motionEvent
- The motion eventpublic void onLongPressDrag(float startX, float startY, float currentX, float currentY)
ListViewBehavior
RadListView
's
ListViewGestureListener
which started with long press.onLongPressDrag
in class ListViewBehavior
startX
- the x coordinate where the gesture startedstartY
- the y coordinate where the gesture startedcurrentX
- the x coordinate where the gesture occurring nowcurrentY
- the y coordinate where the gesture occurring nowpublic boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float v, float v2)
ListViewBehavior
RadListView
's
ListViewGestureListener
.onFling
in class ListViewBehavior
motionEvent
- The first down motion event that started the fling.motionEvent2
- The move motion event that triggered the current onFling.v
- The velocity of this fling measured in pixels per second
along the x axis.v2
- The velocity of this fling measured in pixels per second
along the y axis.public boolean onLongPressDragEnded(boolean isCanceled)
ListViewBehavior
onLongPressDragEnded
in class ListViewBehavior
isCanceled
- whether the gesture was cancelledpublic void onDispatchDraw(Canvas canvas)
ListViewBehavior
RadListView
's onDispatchDraw method is called.onDispatchDraw
in class ListViewBehavior
canvas
- the canvas on which to draw the viewpublic int getScrollValue()
public void setScrollValue(int scrollValue)