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

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

Converge toList and getAll methods.

Change-Id: I71ba53947f1840a21a9b1f77523dce8675308c99
parent 40ebd9f5
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;
        }