public class ListViewBehavior extends Object
RadListView
.Constructor and Description |
---|
ListViewBehavior() |
Modifier and Type | Method and Description |
---|---|
void |
bindViewHolder(ListViewHolder holder,
int i)
Binds the provided
ListViewHolder instance to the dataitem at the specified index. |
ListViewHolder |
createViewHolder(ViewGroup parent,
int viewType)
Creates a
ListViewHolder instance for the corresponding view type. |
int |
getItemViewType(int position,
int suggestedViewType)
Returns a view type identifier for the data item at the specified position.
|
boolean |
isInProgress()
Returns true if the current behavior is in progress.
|
boolean |
managesViewHolders()
Gets a boolean value determining whether the behavior takes care of creating and binding view holders.
|
boolean |
onActionUpOrCancel(boolean isCanceled)
Called when a previous gesture ends on up or cancel.
|
void |
onAttached(RadListView listView)
Called when the behavior is attached to
RadListView with
addBehavior(ListViewBehavior). |
void |
onDetached(RadListView listView)
Called when the behavior is detached to
RadListView with
removeBehavior(ListViewBehavior). |
void |
onDispatchDraw(Canvas canvas)
Called when
RadListView 's onDispatchDraw method is called. |
boolean |
onFling(MotionEvent motionEvent,
MotionEvent motionEvent2,
float velocityX,
float velocityY)
Called when the fling gesture is detected by
RadListView 's
ListViewGestureListener . |
boolean |
onInterceptTouchEvent(MotionEvent motionEvent) |
void |
onLayout(boolean changed,
int left,
int top,
int right,
int bottom)
Called when
RadListView 's onLayout method is called. |
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 |
onScrolled(int dx,
int dy) |
boolean |
onShortPressDrag(float startX,
float startY,
float currentX,
float currentY)
Called when the drag gesture is detected by
RadListView 's
ListViewGestureListener . |
boolean |
onTapUp(MotionEvent motionEvent)
Called when the tap up gesture is detected by
RadListView 's
ListViewGestureListener . |
public void onLayout(boolean changed, int left, int top, int right, int bottom)
RadListView
's onLayout method is called.
Derived classes with children should override this method and call layout on each of their children.
changed
- This is a new size or position for this viewleft
- Left position, relative to parenttop
- Top position, relative to parentright
- Right position, relative to parentbottom
- Bottom position, relative to parentpublic boolean managesViewHolders()
true
if view holders are managed by the behavior; false
otherwise.public ListViewHolder createViewHolder(ViewGroup parent, int viewType)
ListViewHolder
instance for the corresponding view type.parent
- the parent of the view hosted by the view holder.viewType
- the type of view to create a view holder for.ListViewHolder
instance.public void bindViewHolder(ListViewHolder holder, int i)
ListViewHolder
instance to the dataitem at the specified index.holder
- the ListViewHolder
instance to bind.i
- the index of the data item in the source collection.public int getItemViewType(int position, int suggestedViewType)
position
- the position of the data item within the data source.suggestedViewType
- the view type returned by the assigned adapter.public void onAttached(RadListView listView)
RadListView
with
addBehavior(ListViewBehavior).listView
- The parent list viewpublic void onDetached(RadListView listView)
RadListView
with
removeBehavior(ListViewBehavior).listView
- The parent list viewpublic boolean onTapUp(MotionEvent motionEvent)
RadListView
's
ListViewGestureListener
.motionEvent
- The motion eventpublic boolean onInterceptTouchEvent(MotionEvent motionEvent)
public boolean onShortPressDrag(float startX, float startY, float currentX, float currentY)
RadListView
's
ListViewGestureListener
.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 onActionUpOrCancel(boolean isCanceled)
isCanceled
- whether the gesture was cancelledpublic void onLongPress(MotionEvent motionEvent)
RadListView
's
ListViewGestureListener
.motionEvent
- The motion eventpublic void onLongPressDrag(float startX, float startY, float currentX, float currentY)
RadListView
's
ListViewGestureListener
which started with long press.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 onLongPressDragEnded(boolean isCanceled)
isCanceled
- whether the gesture was cancelledpublic boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float velocityX, float velocityY)
RadListView
's
ListViewGestureListener
.motionEvent
- The first down motion event that started the fling.motionEvent2
- The move motion event that triggered the current onFling.velocityX
- The velocity of this fling measured in pixels per second
along the x axis.velocityY
- The velocity of this fling measured in pixels per second
along the y axis.public void onScrolled(int dx, int dy)
public void onDispatchDraw(Canvas canvas)
RadListView
's onDispatchDraw method is called.canvas
- the canvas on which to draw the viewpublic boolean isInProgress()