/** Unselected choice state in item */ protected void unselectedChoiceStates() { int start = swipeListView.getFirstVisiblePosition(); int end = swipeListView.getLastVisiblePosition(); for (int i = 0; i < checked.size(); i++) { if (checked.get(i) && i >= start && i <= end) { reloadChoiceStateInView( swipeListView.getChildAt(i - start).findViewById(swipeFrontView), i); } checked.set(i, false); } swipeListView.onChoiceEnded(); returnOldActions(); }
/** * Swap choice state in item * * @param position position of list */ private void swapChoiceState(int position) { int lastCount = getCountSelected(); boolean lastChecked = checked.get(position); checked.set(position, !lastChecked); int count = lastChecked ? lastCount - 1 : lastCount + 1; if (lastCount == 0 && count == 1) { swipeListView.onChoiceStarted(); closeOpenedItems(); setActionsTo(SwipeListView.SWIPE_ACTION_CHOICE); } if (lastCount == 1 && count == 0) { swipeListView.onChoiceEnded(); returnOldActions(); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { swipeListView.setItemChecked(position, !lastChecked); } swipeListView.onChoiceChanged(position, !lastChecked); reloadChoiceStateInView(frontView, position); }