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

Commit f6e07df1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Better naming for created archives." into arc-apps

parents 643dc5de de69cec7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -337,6 +337,9 @@
    <!-- Text shown on button to open an application -->
    <string name="open_app">Open <xliff:g id="name" example="Cloud Storage">%1$s</xliff:g></string>

    <!-- File name of an archive file created when compressing files, without the file extension (.zip). -->
    <string name="new_archive_file_name">archive<xliff:g id="extension" example=".zip">%s</xliff:g></string>

    <!-- Dialog text shown when confirming if they want to overwrite a file -->
    <string name="overwrite_file_confirmation_message">Overwrite <xliff:g id="name" example="foobar.txt">%1$s</xliff:g>?</string>
</resources>
+10 −2
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import javax.annotation.Nullable;
final class CompressJob extends CopyJob {

    private static final String TAG = "CompressJob";
    private static final String NEW_ARCHIVE_EXTENSION = ".zip";

    /**
     * Moves files to a destination identified by {@code destination}.
@@ -92,9 +93,16 @@ final class CompressJob extends CopyJob {
        final ContentResolver resolver = appContext.getContentResolver();

        // TODO: Move this to DocumentsProvider.
        // TODO: Choose better dispaly name.

        String displayName;
        if (mResolvedDocs.size() == 1) {
            displayName = mResolvedDocs.get(0).displayName + NEW_ARCHIVE_EXTENSION;
        } else {
            displayName = service.getString(R.string.new_archive_file_name, NEW_ARCHIVE_EXTENSION);
        }

        final Uri archiveUri = DocumentsContract.createDocument(
                resolver, mDstInfo.derivedUri, "application/zip", "archive.zip");
                resolver, mDstInfo.derivedUri, "application/zip", displayName);

        try {
            mDstInfo = DocumentInfo.fromUri(resolver, ArchivesProvider.buildUriForArchive(