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

Commit 1794d444 authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski
Browse files

DO NOT MERGE: Fix breadcrumbs for archives.

Test: Tested manually by opening an archive. The breadcrumb should use
      the archive file name.
Bug: 31783726

Change-Id: Ic0351a0d50afa222b82533f89308323ddf62dc57
(cherry picked from commit 99fb548d)
parent a4a23b07
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -149,15 +149,28 @@ public class ArchivesProvider extends DocumentsProvider implements Closeable {
            throws FileNotFoundException {
        final ArchiveId archiveId = ArchiveId.fromDocumentId(documentId);
        if (archiveId.mPath.equals("/")) {
            try (final Cursor archiveCursor = getContext().getContentResolver().query(
                    archiveId.mArchiveUri,
                    new String[] { Document.COLUMN_DISPLAY_NAME },
                    null, null, null, null)) {
                if (archiveCursor == null) {
                    throw new FileNotFoundException(
                            "Cannot resolve display name of the archive.");
                }
                archiveCursor.moveToFirst();
                final String displayName = archiveCursor.getString(
                        archiveCursor.getColumnIndex(Document.COLUMN_DISPLAY_NAME));

                final MatrixCursor cursor = new MatrixCursor(
                        projection != null ? projection : Archive.DEFAULT_PROJECTION);
                final RowBuilder row = cursor.newRow();
                row.add(Document.COLUMN_DOCUMENT_ID, documentId);
            row.add(Document.COLUMN_DISPLAY_NAME, "Archive");  // TODO: Translate.
                row.add(Document.COLUMN_DISPLAY_NAME, displayName);
                row.add(Document.COLUMN_SIZE, 0);
                row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
                return cursor;
            }
        }

        Loader loader = null;
        try {