Skip to content

Commit

Permalink
Pull Request daimajia#72
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Lo authored and Albert Lo committed Aug 30, 2015
1 parent 4f4c82f commit 5f3f50b
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ public void onLayout(SwipeLayout v) {

}

class SwipeMemory extends SimpleSwipeListener {
private class SwipeMemory extends SimpleSwipeListener {

private int position;
private int mOpenTimes = 0;

SwipeMemory(int position) {
this.position = position;
Expand All @@ -185,8 +186,12 @@ class SwipeMemory extends SimpleSwipeListener {
public void onClose(SwipeLayout layout) {
if (mode == Attributes.Mode.Multiple) {
mOpenPositions.remove(position);
} else if(position == mOpenPosition) {
mOpenPosition = INVALID_POSITION;
} else {
mOpenTimes--;
if ((mOpenTimes <= 0) || (position == mOpenPosition)) {
mOpenPosition = INVALID_POSITION;
mOpenTimes = 0;
}
}
}

Expand All @@ -199,9 +204,10 @@ public void onStartOpen(SwipeLayout layout) {

@Override
public void onOpen(SwipeLayout layout) {
if (mode == Attributes.Mode.Multiple)
if (mode == Attributes.Mode.Multiple) {
mOpenPositions.add(position);
else {
} else {
mOpenTimes++;
closeAllExcept(layout);
mOpenPosition = position;
}
Expand Down

0 comments on commit 5f3f50b

Please sign in to comment.