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

Commit 3f2cb056 authored by Martin Brabham's avatar Martin Brabham Committed by Matt Garnes
Browse files

Do not show Toasts when file copy cancelled.

- Bubble up CancelledOperationException when the Cancel/Move operation
  is cancelled. Handle cancellation differently than success.

Change-Id: I0d7e01c66e2d0d2085b16e4f67cfc56894316a12
(cherry picked from commit 0d3cb22d)
parent 47e19937
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -124,7 +124,8 @@ public abstract class ActionsPolicy {
                @Override
                public boolean onCancel() {
                    mCallable.onCancel();
                    return task.cancel(true);
                    task.cancel(true);
                    return true;
                }
            });
            Spanned progress = this.mCallable.requestProgress();
@@ -162,8 +163,7 @@ public abstract class ActionsPolicy {

        @Override
        protected void onCancelled() {
            //Operation complete.
            this.mCallable.onSuccess();
            this.mCallable.onCancel();
        }

        @Override
+8 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.text.Html;
import android.text.Spanned;

import com.cyanogenmod.filemanager.R;
import com.cyanogenmod.filemanager.console.CancelledOperationException;
import com.cyanogenmod.filemanager.console.Console;
import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory;
import com.cyanogenmod.filemanager.console.RelaunchableException;
@@ -303,8 +304,7 @@ public final class CopyMoveActionPolicy extends ActionsPolicy {
                return Html.fromHtml(progress);
            }

            @Override
            public void onSuccess() {
            private void refreshUIAfterCompletion() {
                // Remove orphan bookmark paths
                if (files != null) {
                    for (LinkedResource linkedFiles : files) {
@@ -317,6 +317,11 @@ public final class CopyMoveActionPolicy extends ActionsPolicy {
                  // The reference is not the same, so refresh the complete navigation view
                  this.mOnRequestRefreshListener.onRequestRefresh(null, true);
                }
            }

            @Override
            public void onSuccess() {
                refreshUIAfterCompletion();
                ActionsPolicy.showOperationSuccessMsg(ctx);
            }

@@ -351,6 +356,7 @@ public final class CopyMoveActionPolicy extends ActionsPolicy {
                if (mDstConsole != null) {
                    mDstConsole.onCancel();
                }
                refreshUIAfterCompletion();
            }

            // Handles required for issuing command death to the consoles
+3 −0
Original line number Diff line number Diff line
@@ -1162,6 +1162,9 @@ public final class FileHelper {
            if (e.getCause() instanceof ErrnoException
                        && ((ErrnoException)e.getCause()).errno == OsConstants.ENOSPC) {
                throw new ExecutionException(R.string.msgs_no_disk_space);
            } if (e instanceof CancelledOperationException) {
                // If the user cancelled this operation, let it through.
                throw (CancelledOperationException)e;
            }

            return false;