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

Commit e85cf98a authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski Committed by Android (Google) Code Review
Browse files

Merge "Wire support for archives to DocumentsUI."

parents 3696301a 39acff5a
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -300,10 +300,11 @@ public abstract class BaseActivity extends Activity {


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


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


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