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

Commit fe478239 authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix bug 3167945 - list selection mode should persist across rotations"

parents 81603452 a0eeeac8
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1210,6 +1210,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        int position;
        int height;
        String filter;
        boolean inActionMode;
        int checkedItemCount;
        SparseBooleanArray checkState;
        LongSparseArray<Boolean> checkIdState;
@@ -1232,6 +1233,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            position = in.readInt();
            height = in.readInt();
            filter = in.readString();
            inActionMode = in.readByte() != 0;
            checkedItemCount = in.readInt();
            checkState = in.readSparseBooleanArray();
            long[] idState = in.createLongArray();
@@ -1251,6 +1253,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            out.writeInt(position);
            out.writeInt(height);
            out.writeString(filter);
            out.writeByte((byte) (inActionMode ? 1 : 0));
            out.writeInt(checkedItemCount);
            out.writeSparseBooleanArray(checkState);
            out.writeLongArray(checkIdState != null ? checkIdState.getKeys() : new long[0]);
@@ -1330,6 +1333,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            }
        }

        ss.inActionMode = mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL && mChoiceActionMode != null;

        ss.checkState = mCheckStates;
        ss.checkIdState = mCheckedIdStates;
        ss.checkedItemCount = mCheckedItemCount;
@@ -1376,6 +1381,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te

        mCheckedItemCount = ss.checkedItemCount;

        if (ss.inActionMode && mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL &&
                mMultiChoiceModeCallback != null) {
            mChoiceActionMode = startActionMode(mMultiChoiceModeCallback);
        }

        requestLayout();
    }