Skip to content
This repository was archived by the owner on Jul 22, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion library/src/main/java/link/fls/swipestack/SwipeHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ private void resetViewPosition() {
.alpha(1)
.setDuration(mAnimationDuration)
.setInterpolator(new OvershootInterpolator(1.4f))
.setListener(null);
.setListener(new AnimationUtils.AnimationEndListener() {
@Override
public void onAnimationEnd(Animator animation) {
mSwipeStack.onViewClicked();
}
});
}

private void swipeViewToLeft(int duration) {
Expand Down
11 changes: 11 additions & 0 deletions library/src/main/java/link/fls/swipestack/SwipeStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ public void onSwipeEnd() {
if (mProgressListener != null) mProgressListener.onSwipeEnd(getCurrentPosition());
}

public void onViewClicked() {
if (mListener != null) mListener.onViewClicked(getCurrentPosition());
}

public void onViewSwipedToLeft() {
if (mListener != null) mListener.onViewSwipedToLeft(getCurrentPosition());
removeTopView();
Expand Down Expand Up @@ -420,6 +424,13 @@ public void resetStack() {
* swiped to the left / right or when the stack gets empty.
*/
public interface SwipeStackListener {
/**
* Called when a view has been clicked.
*
* @param position The position of the view in the adapter currently in use.
*/
void onViewClicked(int position);

/**
* Called when a view has been dismissed to the left.
*
Expand Down