Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Commit

Permalink
Changed API for gesture flags & updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
thesurix committed Oct 29, 2017
1 parent 10781c4 commit 38506a8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ext {
buildTools = '25.0.3'
buildTools = '26.0.2'
supportLibrary = '26.0.1'
butterKnife = '8.8.1'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public boolean onDoubleTap(final MonthItem item, final int position) {
mGestureManager = new GestureManager.Builder(mRecyclerView)
.setSwipeEnabled(true)
.setLongPressDragEnabled(true)
.setGestureFlags(ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT, ItemTouchHelper.UP | ItemTouchHelper.DOWN)
.setSwipeFlags(ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT)
.setDragFlags(ItemTouchHelper.UP | ItemTouchHelper.DOWN)
.build();

adapter.setDataChangeListener(new GestureAdapter.OnDataChangeListener<MonthItem>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,41 @@ public Builder setManualDragEnabled(final boolean enabled) {
/**
* Sets flags for swipe and drag gesture. Do not set this flags if you want predefined flags for RecyclerView layout manager.
* See {@link ItemTouchHelper} flags.
*
* This method is deprecated, use {@link #setDragFlags(int)} or {@link #setSwipeFlags(int)}.
* @param swipeFlags flags for swipe gesture
* @param dragFlags flags for drag gesture
* @return returns builder instance
*/
@Deprecated
public Builder setGestureFlags(final int swipeFlags, final int dragFlags) {
this.swipeFlags = swipeFlags;
this.dragFlags = dragFlags;
return this;
}

/**
* Sets flags for swipe gesture. Do not set this flags if you want predefined flags for RecyclerView layout manager.
* See {@link ItemTouchHelper} flags.
* @param flags flags for swipe gesture
* @return returns builder instance
*/
public Builder setSwipeFlags(final int flags) {
swipeFlags = flags;
return this;
}

/**
* Sets flags for drag gesture. Do not set this flags if you want predefined flags for RecyclerView layout manager.
* See {@link ItemTouchHelper} flags.
* @param flags flags for drag gesture
* @return returns builder instance
*/
public Builder setDragFlags(final int flags) {
dragFlags = flags;
return this;
}

/**
* Builds {@link GestureManager} instance.
* @return returns GestureManager instance
Expand Down

0 comments on commit 38506a8

Please sign in to comment.