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

Commit 546d5b10 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Converge toList and getAll methods."

parents e7991045 f347eef4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1125,8 +1125,7 @@ public class DirectoryFragment extends Fragment
        List<String> modelIds = mAdapter.getModelIds();

        // Get the current selection.
        String[] alreadySelected = mSelectionManager.getSelection().getAll();
        for (String id : alreadySelected) {
        for (String id : mSelectionManager.getSelection().getAll()) {
           enabled.add(id);
        }

@@ -1790,7 +1789,7 @@ public class DirectoryFragment extends Fragment
        updateLayout(state.derivedMode);

        if (mSelection != null) {
            mSelectionManager.setItemsSelected(mSelection.toList(), true);
            mSelectionManager.setItemsSelected(mSelection.getAll(), true);
            mSelection.clear();
        }

+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;
        }