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

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

CL/1522740/ followups.

Change-Id: I8b84a2de808f7111c1e40a5f9cab5713922dc59e
parent 340db018
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -638,11 +638,10 @@ public class DirectoryFragment extends Fragment

        // Model must be accessed in UI thread, since underlying cursor is not threadsafe.
        List<DocumentInfo> docs = mModel.getDocuments(selected);
        BaseActivity activity = mActivity;
        if (docs.size() > 1) {
            activity.onDocumentsPicked(docs);
            mActivity.onDocumentsPicked(docs);
        } else {
            activity.onDocumentPicked(docs.get(0));
            mActivity.onDocumentPicked(docs.get(0));
        }
    }

+3 −13
Original line number Diff line number Diff line
@@ -59,6 +59,8 @@ public class Model {
                && (flags & Document.FLAG_PARTIAL) == 0;
    };

    private static final Predicate<Cursor> ANY_FILE_FILTER = (Cursor c) -> true;

    private static final String TAG = "Model";

    private boolean mIsLoading;
@@ -204,19 +206,7 @@ public class Model {
    }

    public List<DocumentInfo> getDocuments(Selection selection) {
        final int size = (selection != null) ? selection.size() : 0;

        final List<DocumentInfo> docs =  new ArrayList<>(size);
        // NOTE: That as this now iterates over only final (non-provisional) selection.
        for (String modelId: selection) {
            DocumentInfo doc = getDocument(modelId);
            if (doc == null) {
                Log.w(TAG, "Unable to obtain document for modelId: " + modelId);
                continue;
            }
            docs.add(doc);
        }
        return docs;
        return loadDocuments(selection, ANY_FILE_FILTER);
    }

    public @Nullable DocumentInfo getDocument(String modelId) {