daimajia / AndroidSwipeLayout

The Most Powerful Swipe Layout!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

opened when I scroll out of window andback close itself

gmm932 opened this issue · comments

opened when I scroll out of window and back closed itself

Bug in SwipeItemMangerImpl.java at Single mode.

Produce:

  1. Open one item (item A).
  2. Fast open other item (item B). Item A will close automatically.
  3. Call notifyDataSetChanged()

Result:
Item B will lose open state.

Reason:
Item B may open earlier than item A will close.
So in line 189 item B will invalidate mOpenPosition var.

Fix:
Add if (mOpenPosition == position) in line 188

public void onClose(SwipeLayout layout) { if (mode == Attributes.Mode.Multiple) { mOpenPositions.remove(position); } else if (mOpenPosition == position) { mOpenPosition = INVALID_POSITION; } }