java.lang.Object | ||
↳ | com.mobeta.android.dslv.SimpleFloatViewManager | |
↳ | com.mobeta.android.dslv.DragSortController |
Class that starts and stops item drags on a DragSortListView
based on touch gestures. This class also inherits from
SimpleFloatViewManager
, which provides basic float View
creation.
An instance of this class is meant to be passed to the methods
DragSortListView#setTouchListener() and
DragSortListView#setFloatViewManager() of your
DragSortListView
instance.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | CLICK_REMOVE | Remove mode enum. | |||||||||
int | FLING_REMOVE | ||||||||||
int | MISS | ||||||||||
int | ON_DOWN | Drag init mode enum. | |||||||||
int | ON_DRAG | ||||||||||
int | ON_LONG_PRESS |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Calls #DragSortController(DragSortListView, int) with a
0 drag handle id, FLING_RIGHT_REMOVE remove mode,
and ON_DOWN drag init.
| |||||||||||
By default, sorting is enabled, and removal is disabled.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Checks for the touch of an item's drag handle (specified by
setDragHandleId(int) ), and returns that item's position
if a drag handle touch was detected. | |||||||||||
Overrides to provide fading when slide removal is enabled.
| |||||||||||
Set the resource id for the View that represents click
removal button.
| |||||||||||
Set the resource id for the View that represents the drag
handle in a list item.
| |||||||||||
Set how a drag is initiated.
| |||||||||||
Set the resource id for the View that represents the fling
handle in a list item.
| |||||||||||
Enable/Disable item removal without affecting remove mode.
| |||||||||||
One of CLICK_REMOVE, FLING_RIGHT_REMOVE,
FLING_LEFT_REMOVE,
SLIDE_RIGHT_REMOVE, or SLIDE_LEFT_REMOVE.
| |||||||||||
Enable/Disable list item sorting.
| |||||||||||
Sets flags to restrict certain motions of the floating View
based on DragSortController settings (such as remove mode).
| |||||||||||
Get the position to start dragging based on the ACTION_DOWN
MotionEvent.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Remove mode enum.
Drag init mode enum.
Calls #DragSortController(DragSortListView, int) with a 0 drag handle id, FLING_RIGHT_REMOVE remove mode, and ON_DOWN drag init. By default, sorting is enabled, and removal is disabled.
dslv | The DSLV instance |
---|
By default, sorting is enabled, and removal is disabled.
dslv | The DSLV instance |
---|---|
dragHandleId | The resource id of the View that represents the drag handle in a list item. |
Checks for the touch of an item's drag handle (specified by
setDragHandleId(int)
), and returns that item's position
if a drag handle touch was detected.
ev | The ACTION_DOWN MotionEvent. |
---|
Overrides to provide fading when slide removal is enabled.
floatView | The floating View. |
---|---|
position | The location (top-left; relative to DSLV
top-left) at which the float
View would like to appear, given the current touch location
and the offset provided in startDrag(int, View, int, int, int) . |
touch | The current touch location (relative to DSLV top-left). |
Set the resource id for the View that represents click removal button.
id | An android resource id. |
---|
Set the resource id for the View that represents the drag handle in a list item.
id | An android resource id. |
---|
Set how a drag is initiated. Needs to be one of ON_DOWN, ON_DRAG, or ON_LONG_PRESS.
mode | The drag init mode. |
---|
Set the resource id for the View that represents the fling handle in a list item.
id | An android resource id. |
---|
Enable/Disable item removal without affecting remove mode.
One of CLICK_REMOVE, FLING_RIGHT_REMOVE, FLING_LEFT_REMOVE, SLIDE_RIGHT_REMOVE, or SLIDE_LEFT_REMOVE.
Enable/Disable list item sorting. Disabling is useful if only item removal is desired. Prevents drags in the vertical direction.
enabled | Set true to enable list
item sorting.
|
---|
Sets flags to restrict certain motions of the floating View based on DragSortController settings (such as remove mode). Starts the drag on the DragSortListView.
position | The list item position (includes headers). |
---|---|
deltaX | Touch x-coord minus left edge of floating View. |
deltaY | Touch y-coord minus top edge of floating View. |
Get the position to start dragging based on the ACTION_DOWN
MotionEvent. This function simply calls
dragHandleHitPosition(MotionEvent)
. Override
to change drag handle behavior;
this function is called internally when an ACTION_DOWN
event is detected.
ev | The ACTION_DOWN MotionEvent. |
---|