Skip to content

In SwipeItemManagerImpl file, if use the integer to store the swipe state in SINGLE state, it will trigger state mess when scroll the listView. So use the set to store the swipe state for SINGLE as well. #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void openItem(int position) {
if (!mOpenPositions.contains(position))
mOpenPositions.add(position);
} else {
mOpenPosition = position;
mOpenPositions.add(position);
}
swipeAdapterInterface.notifyDatasetChanged();
}
Expand All @@ -85,7 +85,7 @@ public void closeItem(int position) {
mOpenPositions.remove(position);
} else {
if (mOpenPosition == position)
mOpenPosition = INVALID_POSITION;
mOpenPositions.remove(position);
}
swipeAdapterInterface.notifyDatasetChanged();
}
Expand All @@ -100,11 +100,7 @@ public void closeAllExcept(SwipeLayout layout) {

@Override
public void closeAllItems() {
if (mode == Attributes.Mode.Multiple) {
mOpenPositions.clear();
} else {
mOpenPosition = INVALID_POSITION;
}
mOpenPositions.clear();
for (SwipeLayout s : mShownLayouts) {
s.close();
}
Expand All @@ -117,11 +113,7 @@ public void removeShownLayouts(SwipeLayout layout) {

@Override
public List<Integer> getOpenItems() {
if (mode == Attributes.Mode.Multiple) {
return new ArrayList<Integer>(mOpenPositions);
} else {
return Collections.singletonList(mOpenPosition);
}
return new ArrayList<Integer>(mOpenPositions);
}

@Override
Expand All @@ -131,11 +123,7 @@ public List<SwipeLayout> getOpenLayouts() {

@Override
public boolean isOpen(int position) {
if (mode == Attributes.Mode.Multiple) {
return mOpenPositions.contains(position);
} else {
return mOpenPosition == position;
}
return mOpenPositions.contains(position);
}

class ValueBox {
Expand Down Expand Up @@ -183,11 +171,7 @@ class SwipeMemory extends SimpleSwipeListener {

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

@Override
Expand All @@ -203,7 +187,8 @@ public void onOpen(SwipeLayout layout) {
mOpenPositions.add(position);
else {
closeAllExcept(layout);
mOpenPosition = position;
mOpenPositions.clear();
mOpenPositions.add(position);
}
}

Expand Down