Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
woxblom committed Oct 20, 2017
1 parent aed1e50 commit 09cec72
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Add this to proguard rules, otherwise animations won't work correctly
-keep class com.woxthebox.draglistview.** { *; }

## Usage
**NOTE: The adapter must use stable ids.
List and Grid layouts are used as example in the sample project.

For list and grid view use the DragListView.
Expand Down Expand Up @@ -203,10 +202,16 @@ List and Grid layouts are used as example in the sample project.
mLayoutId = layoutId;
mGrabHandleId = grabHandleId;
mDragOnLongPress = dragOnLongPress;
setHasStableIds(true);
setItemList(list);
}

The adapter must provide unique ids for each item with the implementation of the abstract method below.

/**
* @return a unique id for an item at the specific position.
*/
public abstract long getUniqueItemId(int position);

Your ViewHolder should extend DragItemAdapter.ViewHolder and you must supply an id of the view that should respond to a drag.
You also need to provide a boolean to the super constructor to decide if you want the drag to happen on long press or directly when touching the item.
If you want to respond to clicks, long clicks or touch events on the itemView root layout you should not set your own click listeners.
Expand Down

0 comments on commit 09cec72

Please sign in to comment.