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

Commit d7a36059 authored by Steve McKay's avatar Steve McKay
Browse files

Converge Selection toList and getAll.

This change couldn't be cherrypicked in UI.
https://googleplex-android-review.git.corp.google.com/#/c/1115604/

Change-Id: I232622ae36a0a124a91a85865d9d0adaa5a98a3d
parent 8552ca51
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1788,7 +1788,7 @@ public class DirectoryFragment extends Fragment
        updateLayout(state.derivedMode);

        if (mRestoredSelection != null) {
            mSelectionManager.setItemsSelected(mRestoredSelection.toList(), true);
            mSelectionManager.setItemsSelected(mRestoredSelection.getAll(), true);
            // Note, we'll take care of cleaning up retained selection
            // in the selection handler where we already have some
            // specialized code to handle when selection was restored.
+7 −12
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ public final class MultiSelectManager {
     * Updates selection to include items in {@code selection}.
     */
    public void updateSelection(Selection selection) {
        setItemsSelected(selection.toList(), true);
        setItemsSelected(selection.getAll(), true);
    }

    /**
@@ -641,18 +641,13 @@ public final class MultiSelectManager {
        }

        /**
         * Returns an unordered array of selected positions.
         * Returns an unordered array of selected positions, including any
         * provisional selection currently in effect.
         */
        public String[] getAll() {
            return toList().toArray(new String[0]);
        }

        /**
         * Returns an unordered array of selected positions (including any
         * provisional selections current in effect).
         */
        public List<String> toList() {
            ArrayList<String> selection = new ArrayList<String>(mSelection);
        public List<String> getAll() {
            ArrayList<String> selection =
                    new ArrayList<String>(mSelection.size() + mProvisionalSelection.size());
            selection.addAll(mSelection);
            selection.addAll(mProvisionalSelection);
            return selection;
        }