public abstract class

DragSortCursorAdapter

extends CursorAdapter
implements DragSortListView.DragSortListener
java.lang.Object
   ↳ android.widget.BaseAdapter
     ↳ android.support.v4.widget.CursorAdapter
       ↳ com.mobeta.android.dslv.DragSortCursorAdapter
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

A subclass of android.widget.CursorAdapter that provides reordering of the elements in the Cursor based on completed drag-sort operations. The reordering is a simple mapping of list positions into Cursor positions (the Cursor is unchanged). To persist changes made by drag-sorts, one can retrieve the mapping with the getCursorPositions() method, which returns the reordered list of Cursor positions. An instance of this class is passed to setAdapter(ListAdapter) and, since this class implements the DragSortListView.DragSortListener interface, it is automatically set as the DragSortListener for the DragSortListView instance.

Summary

Constants
int REMOVED
[Expand]
Inherited Constants
From class android.support.v4.widget.CursorAdapter
From interface android.widget.Adapter
[Expand]
Inherited Fields
From class android.support.v4.widget.CursorAdapter
Public Constructors
DragSortCursorAdapter(Context context, Cursor c)
DragSortCursorAdapter(Context context, Cursor c, boolean autoRequery)
DragSortCursorAdapter(Context context, Cursor c, int flags)
Public Methods
void changeCursor(Cursor cursor)
Changes Cursor and clears list-Cursor mapping.
void drag(int from, int to)
Does nothing.
void drop(int from, int to)
On drop, this updates the mapping between Cursor positions and ListView positions.
int getCount()
int getCursorPosition(int position)
Get the Cursor position mapped to by the provided list position (given all previously handled drag-sort operations).
ArrayList<Integer> getCursorPositions()
Get the current order of Cursor positions presented by the list.
View getDropDownView(int position, View convertView, ViewGroup parent)
Object getItem(int position)
long getItemId(int position)
int getListPosition(int cursorPosition)
Get the list position mapped to by the provided Cursor position.
View getView(int position, View convertView, ViewGroup parent)
void remove(int which)
On remove, this updates the mapping between Cursor positions and ListView positions.
void reset()
Resets list-cursor mapping.
Cursor swapCursor(Cursor newCursor)
Swaps Cursor and clears list-Cursor mapping.
[Expand]
Inherited Methods
From class android.support.v4.widget.CursorAdapter
From class android.widget.BaseAdapter
From class java.lang.Object
From interface android.widget.Adapter
From interface android.widget.Filterable
From interface android.widget.ListAdapter
From interface android.widget.SpinnerAdapter
From interface com.mobeta.android.dslv.DragSortListView.DragListener
From interface com.mobeta.android.dslv.DragSortListView.DropListener
From interface com.mobeta.android.dslv.DragSortListView.RemoveListener

Constants

public static final int REMOVED

Constant Value: -1 (0xffffffff)

Public Constructors

public DragSortCursorAdapter (Context context, Cursor c)

public DragSortCursorAdapter (Context context, Cursor c, boolean autoRequery)

public DragSortCursorAdapter (Context context, Cursor c, int flags)

Public Methods

public void changeCursor (Cursor cursor)

Changes Cursor and clears list-Cursor mapping.

public void drag (int from, int to)

Does nothing. Just completes DragSortListener interface.

public void drop (int from, int to)

On drop, this updates the mapping between Cursor positions and ListView positions. The Cursor is unchanged. Retrieve the current mapping with getCursorPositions().

See Also

public int getCount ()

public int getCursorPosition (int position)

Get the Cursor position mapped to by the provided list position (given all previously handled drag-sort operations).

Parameters
position List position
Returns
  • The mapped-to Cursor position

public ArrayList<Integer> getCursorPositions ()

Get the current order of Cursor positions presented by the list.

public View getDropDownView (int position, View convertView, ViewGroup parent)

public Object getItem (int position)

public long getItemId (int position)

public int getListPosition (int cursorPosition)

Get the list position mapped to by the provided Cursor position. If the provided Cursor position has been removed by a drag-sort, this returns REMOVED.

Parameters
cursorPosition A Cursor position
Returns
  • The mapped-to list position or REMOVED

public View getView (int position, View convertView, ViewGroup parent)

public void remove (int which)

On remove, this updates the mapping between Cursor positions and ListView positions. The Cursor is unchanged. Retrieve the current mapping with getCursorPositions().

See Also

public void reset ()

Resets list-cursor mapping.

public Cursor swapCursor (Cursor newCursor)

Swaps Cursor and clears list-Cursor mapping.

See Also
  • android.widget.CursorAdapter#swapCursor(android.database.Cursor)