diff options
| author | Martin Brabham <optedoblivion@cyngn.com> | 2015-04-02 20:33:41 -0700 |
|---|---|---|
| committer | Matt Garnes <matt@cyngn.com> | 2015-04-09 15:48:00 -0700 |
| commit | 0d3cb22d52f479210a967fbdbf792b057f9da8fc (patch) | |
| tree | 8f047194af6dc7c0d5cc32a8200abd4ad2258052 | |
| parent | ac29bbc0809b095e4bf721cac4c03d31652695fd (diff) | |
| download | android_packages_apps_CMFileManager-0d3cb22d52f479210a967fbdbf792b057f9da8fc.tar.gz android_packages_apps_CMFileManager-0d3cb22d52f479210a967fbdbf792b057f9da8fc.tar.bz2 android_packages_apps_CMFileManager-0d3cb22d52f479210a967fbdbf792b057f9da8fc.zip | |
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
3 files changed, 14 insertions, 5 deletions
diff --git a/src/com/cyanogenmod/filemanager/ui/policy/ActionsPolicy.java b/src/com/cyanogenmod/filemanager/ui/policy/ActionsPolicy.java index b0a7cd7f..c127d3fc 100644 --- a/src/com/cyanogenmod/filemanager/ui/policy/ActionsPolicy.java +++ b/src/com/cyanogenmod/filemanager/ui/policy/ActionsPolicy.java @@ -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 diff --git a/src/com/cyanogenmod/filemanager/ui/policy/CopyMoveActionPolicy.java b/src/com/cyanogenmod/filemanager/ui/policy/CopyMoveActionPolicy.java index 15d024e5..c2dde32e 100644 --- a/src/com/cyanogenmod/filemanager/ui/policy/CopyMoveActionPolicy.java +++ b/src/com/cyanogenmod/filemanager/ui/policy/CopyMoveActionPolicy.java @@ -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 diff --git a/src/com/cyanogenmod/filemanager/util/FileHelper.java b/src/com/cyanogenmod/filemanager/util/FileHelper.java index 1349375b..381c2c95 100644 --- a/src/com/cyanogenmod/filemanager/util/FileHelper.java +++ b/src/com/cyanogenmod/filemanager/util/FileHelper.java @@ -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; |
