Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 845df820 authored by Brett Chabot's avatar Brett Chabot
Browse files

ListView.setItemChecked(p, false) always clears all items.

This fixes the bug where, in SINGLE_CHOICE_MODE, calling
ListView.setItemChecked(x, false) would always uncheck all
items, even if another item, y, was currently checked.
parent 8487ab3e
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -3264,12 +3264,13 @@ public class ListView extends AbsListView {
        if (mChoiceMode == CHOICE_MODE_MULTIPLE) {
            mCheckStates.put(position, value);
        } else {
            // Clear the old value: if something was selected and value == false
            // then it is unselected
            // Clear all values if we're checking something, or unchecking the currently
            // selected item
            if (value || isItemChecked(position)) {
                mCheckStates.clear();
            // If value == true, select the appropriate position
            }
            // this may end up selecting the value we just cleared but this way
            // we don't have to first to a get(position)
            // we ensure length of mCheckStates is 1, a fact getCheckedItemPosition relies on
            if (value) {
                mCheckStates.put(position, true);
            }