public class SelectionBehavior extends ListViewBehavior implements ItemReorderBehavior.ItemReorderListener, SwipeExecuteBehavior.SwipeExecuteListener, SwipeActionsBehavior.SwipeActionsListener
ListViewBehavior
that can be used to allow the end user
to select items from the list with gestures.Modifier and Type | Class and Description |
---|---|
static interface |
SelectionBehavior.SelectionChangedListener
Interface definition for a callback to be invoked when the selection is changed.
|
static class |
SelectionBehavior.SelectionMode
An enumeration with the different modes of selection that can be used as a parameter for
the
setSelectionMode(com.telerik.widget.list.SelectionBehavior.SelectionMode) method. |
static class |
SelectionBehavior.SelectionOnTouch
An enumeration with the different modes of selection that can be used as a parameter for
the
setSelectionOnTouch(com.telerik.widget.list.SelectionBehavior.SelectionOnTouch) method. |
Constructor and Description |
---|
SelectionBehavior()
Creates a new instance of the SelectionBehavior.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(SelectionBehavior.SelectionChangedListener listener)
Adds a listener to be called when the selection of items changes.
|
void |
changeIsSelected(int position) |
void |
changeIsSelected(int position,
boolean value) |
void |
endSelection()
A method that is used to notify the behavior that the selection should be stopped.
|
boolean |
getIsSelected(int position) |
SelectionBehavior.SelectionMode |
getSelectionMode()
Gets the current
SelectionBehavior.SelectionMode . |
SelectionBehavior.SelectionOnTouch |
getSelectionOnLongPress()
Gets the current
SelectionBehavior.SelectionOnTouch . |
SelectionBehavior.SelectionOnTouch |
getSelectionOnTouch()
Gets the current
SelectionBehavior.SelectionOnTouch . |
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 |
onDetached(RadListView owner)
Called when the behavior is detached to
RadListView with
removeBehavior(ListViewBehavior). |
void |
onExecuteFinished(int position)
Called when the swipe content is dismissed.
|
void |
onExecuteFinished(SwipeActionsBehavior.SwipeActionEvent eventInfo)
Called when the swipe content is dismissed.
|
void |
onLongPress(MotionEvent motionEvent)
Called when the long press gesture is detected by
RadListView 's
ListViewGestureListener . |
void |
onReorderFinished()
Called when reorder is finished.
|
void |
onReorderItem(int positionFrom,
int positionTo)
Called when the item at positionFrom needs to be reordered to positionTo.
|
void |
onReorderStarted(int position)
Called when the reorder starts for the item at the specified position.
|
void |
onSwipeEnded(int position,
int finalOffset)
Called when swipe gesture ends.
|
void |
onSwipeEnded(SwipeActionsBehavior.SwipeActionEvent eventInfo)
Called when swipe gesture ends.
|
void |
onSwipeProgressChanged(int position,
int currentOffset,
View swipeContent)
Called when the progress of the swipe for the item at the specified position changes.
|
void |
onSwipeProgressChanged(SwipeActionsBehavior.SwipeActionEvent eventInfo)
Called when the progress of the swipe for the item at the specified position changes.
|
void |
onSwipeStarted(int position)
Called when the swipe gesture starts for the item at the specified position.
|
void |
onSwipeStarted(SwipeActionsBehavior.SwipeActionEvent eventInfo)
Called when the swipe gesture starts for the item at the specified position.
|
void |
onSwipeStateChanged(SwipeActionsBehavior.SwipeActionsState oldState,
SwipeActionsBehavior.SwipeActionsState newState)
Called when the swipe state changes.
|
boolean |
onTapUp(MotionEvent motionEvent)
Called when the tap up gesture is detected by
RadListView 's
ListViewGestureListener . |
void |
removeListener(SelectionBehavior.SelectionChangedListener listener)
Removes a listener that is called when the selection of items changes.
|
List |
selectedItems()
Gets the list of currently selected items.
|
void |
setSelectionMode(SelectionBehavior.SelectionMode selectionMode)
Sets a new
SelectionBehavior.SelectionMode . |
void |
setSelectionOnLongPress(SelectionBehavior.SelectionOnTouch selectionOnLongPress)
Sets a new
SelectionBehavior.SelectionOnTouch value for long press. |
void |
setSelectionOnTouch(SelectionBehavior.SelectionOnTouch selectionOnTouch)
Sets a new value for
SelectionBehavior.SelectionOnTouch . |
bindViewHolder, createViewHolder, getItemViewType, managesViewHolders, onActionUpOrCancel, onDispatchDraw, onFling, onInterceptTouchEvent, onLayout, onLongPressDrag, onLongPressDragEnded, onScrolled, onShortPressDrag
public SelectionBehavior()
public List selectedItems()
public SelectionBehavior.SelectionOnTouch getSelectionOnTouch()
SelectionBehavior.SelectionOnTouch
.
This value is used to determine the behavior when the tap gesture is detected.
The default value is AFTER_START
.public void setSelectionOnTouch(SelectionBehavior.SelectionOnTouch selectionOnTouch)
SelectionBehavior.SelectionOnTouch
.
This value is used to determine the behavior when the tap gesture is detected.
The default value is AFTER_START
.selectionOnTouch
- the new value.public SelectionBehavior.SelectionOnTouch getSelectionOnLongPress()
SelectionBehavior.SelectionOnTouch
.
This value is used to determine the behavior when the long press gesture is detected.
The default value is ALWAYS
.public void setSelectionOnLongPress(SelectionBehavior.SelectionOnTouch selectionOnLongPress)
SelectionBehavior.SelectionOnTouch
value for long press.
This value is used to determine the behavior when the long press gesture is detected.
The default value is ALWAYS
.selectionOnLongPress
- the new value.public SelectionBehavior.SelectionMode getSelectionMode()
SelectionBehavior.SelectionMode
.
The default value is MULTIPLE
.public void setSelectionMode(SelectionBehavior.SelectionMode selectionMode)
SelectionBehavior.SelectionMode
.
The default value is MULTIPLE
.selectionMode
- the new value.public void addListener(SelectionBehavior.SelectionChangedListener listener)
listener
- the new listener.public void removeListener(SelectionBehavior.SelectionChangedListener listener)
listener
- the listener to remove.public void endSelection()
public void onReorderStarted(int position)
ItemReorderBehavior.ItemReorderListener
onReorderStarted
in interface ItemReorderBehavior.ItemReorderListener
position
- the position of the item that is reordered.public void onReorderItem(int positionFrom, int positionTo)
ItemReorderBehavior.ItemReorderListener
onReorderItem
in interface ItemReorderBehavior.ItemReorderListener
positionFrom
- the previous position of the reordered item.positionTo
- the new position of the reordered item.public void onReorderFinished()
ItemReorderBehavior.ItemReorderListener
onReorderFinished
in interface ItemReorderBehavior.ItemReorderListener
public void onSwipeStarted(SwipeActionsBehavior.SwipeActionEvent eventInfo)
SwipeActionsBehavior.SwipeActionsListener
onSwipeStarted
in interface SwipeActionsBehavior.SwipeActionsListener
eventInfo
- an instance of the SwipeActionsBehavior.SwipeActionEvent
class containing information
about the event.public void onSwipeProgressChanged(SwipeActionsBehavior.SwipeActionEvent eventInfo)
SwipeActionsBehavior.SwipeActionsListener
onSwipeProgressChanged
in interface SwipeActionsBehavior.SwipeActionsListener
eventInfo
- an instance of the SwipeActionsBehavior.SwipeActionEvent
class containing information
about the event.public void onSwipeEnded(SwipeActionsBehavior.SwipeActionEvent eventInfo)
SwipeActionsBehavior.SwipeActionsListener
onSwipeEnded
in interface SwipeActionsBehavior.SwipeActionsListener
eventInfo
- an instance of the SwipeActionsBehavior.SwipeActionEvent
class containing information
about the event.public void onSwipeStateChanged(SwipeActionsBehavior.SwipeActionsState oldState, SwipeActionsBehavior.SwipeActionsState newState)
SwipeActionsBehavior.SwipeActionsListener
onSwipeStateChanged
in interface SwipeActionsBehavior.SwipeActionsListener
oldState
- a value from the SwipeActionsBehavior.SwipeActionsState
enum representing the old state.newState
- a value from the SwipeActionsBehavior.SwipeActionsState
enum representing the old state.public void onExecuteFinished(SwipeActionsBehavior.SwipeActionEvent eventInfo)
SwipeActionsBehavior.SwipeActionsListener
onExecuteFinished
in interface SwipeActionsBehavior.SwipeActionsListener
eventInfo
- an instance of the SwipeActionsBehavior.SwipeActionEvent
class containing information
about the event.public void onSwipeStarted(int position)
SwipeExecuteBehavior.SwipeExecuteListener
onSwipeStarted
in interface SwipeExecuteBehavior.SwipeExecuteListener
position
- the position of the item that is swiped.public void onSwipeProgressChanged(int position, int currentOffset, View swipeContent)
SwipeExecuteBehavior.SwipeExecuteListener
onSwipeProgressChanged
in interface SwipeExecuteBehavior.SwipeExecuteListener
position
- the position of the item that is swiped.currentOffset
- the current offset from the start that the swiped item has made.swipeContent
- the swipe content that is shown behind the item.public void onSwipeEnded(int position, int finalOffset)
SwipeExecuteBehavior.SwipeExecuteListener
onSwipeEnded
in interface SwipeExecuteBehavior.SwipeExecuteListener
position
- the position of the item that is swiped.finalOffset
- the final offset from the start that the swiped item has made.public void onExecuteFinished(int position)
SwipeExecuteBehavior.SwipeExecuteListener
onExecuteFinished
in interface SwipeExecuteBehavior.SwipeExecuteListener
position
- the position of the item that is swiped.public boolean isInProgress()
ListViewBehavior
isInProgress
in class ListViewBehavior
public boolean getIsSelected(int position)
public void changeIsSelected(int position, boolean value)
public void changeIsSelected(int position)
public void onLongPress(MotionEvent motionEvent)
ListViewBehavior
RadListView
's
ListViewGestureListener
.onLongPress
in class ListViewBehavior
motionEvent
- The motion eventpublic boolean onTapUp(MotionEvent motionEvent)
ListViewBehavior
RadListView
's
ListViewGestureListener
.onTapUp
in class ListViewBehavior
motionEvent
- The motion eventpublic void onAttached(RadListView listView)
ListViewBehavior
RadListView
with
addBehavior(ListViewBehavior).onAttached
in class ListViewBehavior
listView
- The parent list viewpublic void onDetached(RadListView owner)
ListViewBehavior
RadListView
with
removeBehavior(ListViewBehavior).onDetached
in class ListViewBehavior
owner
- The parent list view