Skip to content

Commit

Permalink
fix bug: 'SelectableHelper#clearSelected()'
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfeng committed Nov 27, 2020
1 parent 9fe416e commit 434d84a
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
Expand Down Expand Up @@ -141,9 +142,12 @@ public void setSelectMode(SelectMode mode) {
/**
* 清除所所列表项的选中状态。
*/
@SuppressWarnings("WhileLoopReplaceableByForEach")
public void clearSelected() {
for (Integer selectedPosition : mSelectedPositions.subList(0, mSelectedPositions.size())) {
deselect(selectedPosition);
Iterator<Integer> iterator = mSelectedPositions.iterator();
while (iterator.hasNext()) {
// 不能使用 for 循环,因为该方法会会删除列表中的元素
deselect(iterator.next());
}
notifySelectCountChanged();
}
Expand Down

0 comments on commit 434d84a

Please sign in to comment.