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

Commit f657025b authored by Jon Mann's avatar Jon Mann
Browse files

Fix intermittent crash on copy cancelled.

Test: N/A
Bug: 36354374
Change-Id: Ie9c79a9bd30dcb28f2fdcefa92e625c5abdf9c88
parent f6e07df1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -264,7 +264,9 @@
        <item quantity="other">Copied <xliff:g id="count" example="3">%1$d</xliff:g> files to clipboard.</item>
    </plurals>
    <!-- Toast shown when the file operation is not supported [CHAR LIMIT=48] -->
    <string name="file_operation_error">File operation is not supported.</string>
    <string name="file_operation_rejected">File operation is not supported.</string>
    <!-- Toast shown when the file operation is not supported [CHAR LIMIT=48] -->
    <string name="file_operation_error">File operation failed.</string>
    <!-- Toast shown when renaming document failed with an error [CHAR LIMIT=48] -->
    <string name="rename_error">Failed to rename document</string>
    <!-- Context Menu item that ejects the root selected [CHAR LIMIT=24] -->
+7 −2
Original line number Diff line number Diff line
@@ -303,8 +303,13 @@ public class ActionHandler<T extends Activity & Addons> extends AbstractActionHa
                        selection,
                        mModel::getItemUri,
                        mClipStore);
            } catch (IOException e) {
                throw new RuntimeException("Failed to create uri supplier.", e);
            } catch (Exception e) {
                Log.e(TAG,"Failed to delete a file because we were unable to get item URIs.", e);
                mDialogs.showFileOperationStatus(
                        FileOperations.Callback.STATUS_FAILED,
                        FileOperationService.OPERATION_DELETE,
                        selection.size());
                return;
            }

            FileOperation operation = new FileOperation.Builder()
+1 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ public final class FileOperations {
        @interface Status {}
        static final int STATUS_ACCEPTED = 0;
        static final int STATUS_REJECTED = 1;
        static final int STATUS_FAILED = 2;

        /**
         * Performs operation when the file operation starts or fails to start.
+4 −0
Original line number Diff line number Diff line
@@ -97,6 +97,10 @@ public interface DialogController {
        public void showFileOperationStatus(
                @Status int status, @OpType int opType, int docCount) {
            if (status == FileOperations.Callback.STATUS_REJECTED) {
                Snackbars.showOperationRejected(mActivity);
                return;
            }
            if (status == FileOperations.Callback.STATUS_FAILED) {
                Snackbars.showOperationFailed(mActivity);
                return;
            }
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ public final class Snackbars {
        makeSnackbar(activity, message, Snackbar.LENGTH_SHORT).show();
    }

    public static final void showOperationRejected(Activity activity) {
        makeSnackbar(activity, R.string.file_operation_rejected, Snackbar.LENGTH_SHORT).show();
    }

    public static final void showOperationFailed(Activity activity) {
        makeSnackbar(activity, R.string.file_operation_error, Snackbar.LENGTH_SHORT).show();
    }