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

Commit 39acff5a authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski
Browse files

Wire support for archives to DocumentsUI.

Bug: 20176812
Change-Id: I8220afa2f53b07aa842bf6ac24fcc62afd4e2617
parent a99fce54
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -300,10 +300,11 @@ public abstract class BaseActivity extends Activity {

    void onDirectoryCreated(DocumentInfo doc) {
        checkArgument(doc.isDirectory());
        openDirectory(doc);
        openContainerDocument(doc);
    }

    void openDirectory(DocumentInfo doc) {
    void openContainerDocument(DocumentInfo doc) {
        checkArgument(doc.isContainer());
        mState.stack.push(doc);
        mState.stackTouched = true;
        onCurrentDirectoryChanged(ANIM_DOWN);
+2 −2
Original line number Diff line number Diff line
@@ -421,8 +421,8 @@ public class DocumentsActivity extends BaseActivity {
    @Override
    public void onDocumentPicked(DocumentInfo doc, DocumentContext context) {
        final FragmentManager fm = getFragmentManager();
        if (doc.isDirectory()) {
            openDirectory(doc);
        if (doc.isContainer()) {
            openContainerDocument(doc);
        } else if (mState.action == ACTION_OPEN || mState.action == ACTION_GET_CONTENT) {
            // Explicit file picked, return
            new ExistingFinishTask(doc.derivedUri).executeOnExecutor(getExecutorForCurrentDirectory());
+2 −2
Original line number Diff line number Diff line
@@ -185,8 +185,8 @@ public class DownloadsActivity extends BaseActivity {
    @Override
    public void onDocumentPicked(DocumentInfo doc, DocumentContext context) {
        final FragmentManager fm = getFragmentManager();
        if (doc.isDirectory()) {
            openDirectory(doc);
        if (doc.isContainer()) {
            openContainerDocument(doc);
        } else {
            // First try managing the document; we expect manager to filter
            // based on authority, so we don't grant.
+2 −2
Original line number Diff line number Diff line
@@ -311,8 +311,8 @@ public class FilesActivity extends BaseActivity {

    @Override
    public void onDocumentPicked(DocumentInfo doc, @Nullable DocumentContext siblings) {
        if (doc.isDirectory()) {
            openDirectory(doc);
        if (doc.isContainer()) {
            openContainerDocument(doc);
        } else {
            openDocument(doc, siblings);
        }
+8 −0
Original line number Diff line number Diff line
@@ -243,6 +243,14 @@ public class DocumentInfo implements Durable, Parcelable {
        return (flags & Document.FLAG_DIR_HIDE_GRID_TITLES) != 0;
    }

    public boolean isArchive() {
        return (flags & Document.FLAG_ARCHIVE) != 0;
    }

    public boolean isContainer() {
        return isDirectory() || isArchive();
    }

    public int hashCode() {
        return derivedUri.hashCode() + mimeType.hashCode();
    }