diff options
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/viewer/src/com/artifex/mupdfdemo/CancellableAsyncTask.java | 10 | ||||
-rw-r--r-- | platform/android/viewer/src/com/artifex/mupdfdemo/PageView.java | 14 |
2 files changed, 14 insertions, 10 deletions
diff --git a/platform/android/viewer/src/com/artifex/mupdfdemo/CancellableAsyncTask.java b/platform/android/viewer/src/com/artifex/mupdfdemo/CancellableAsyncTask.java index fcb1b744..53d16f57 100644 --- a/platform/android/viewer/src/com/artifex/mupdfdemo/CancellableAsyncTask.java +++ b/platform/android/viewer/src/com/artifex/mupdfdemo/CancellableAsyncTask.java @@ -46,10 +46,16 @@ public class CancellableAsyncTask<Params, Result> CancellableAsyncTask.this.onPostExecute(result); task.doCleanup(); } + + @Override + protected void onCancelled(Result result) + { + task.doCleanup(); + } }; } - public void cancelAndWait() + public void cancel() { this.asyncTask.cancel(true); ourTask.doCancel(); @@ -67,8 +73,6 @@ public class CancellableAsyncTask<Params, Result> catch (CancellationException e) { } - - ourTask.doCleanup(); } public void execute(Params ... params) diff --git a/platform/android/viewer/src/com/artifex/mupdfdemo/PageView.java b/platform/android/viewer/src/com/artifex/mupdfdemo/PageView.java index 502e0c2b..5f5cc638 100644 --- a/platform/android/viewer/src/com/artifex/mupdfdemo/PageView.java +++ b/platform/android/viewer/src/com/artifex/mupdfdemo/PageView.java @@ -144,12 +144,12 @@ public abstract class PageView extends ViewGroup { private void reinit() { // Cancel pending render task if (mDrawEntire != null) { - mDrawEntire.cancelAndWait(); + mDrawEntire.cancel(); mDrawEntire = null; } if (mDrawPatch != null) { - mDrawPatch.cancelAndWait(); + mDrawPatch.cancel(); mDrawPatch = null; } @@ -229,7 +229,7 @@ public abstract class PageView extends ViewGroup { public void setPage(int page, PointF size) { // Cancel pending render task if (mDrawEntire != null) { - mDrawEntire.cancelAndWait(); + mDrawEntire.cancel(); mDrawEntire = null; } @@ -603,7 +603,7 @@ public abstract class PageView extends ViewGroup { // Stop the drawing of previous patch if still going if (mDrawPatch != null) { - mDrawPatch.cancelAndWait(); + mDrawPatch.cancel(); mDrawPatch = null; } @@ -647,12 +647,12 @@ public abstract class PageView extends ViewGroup { public void update() { // Cancel pending render task if (mDrawEntire != null) { - mDrawEntire.cancelAndWait(); + mDrawEntire.cancel(); mDrawEntire = null; } if (mDrawPatch != null) { - mDrawPatch.cancelAndWait(); + mDrawPatch.cancel(); mDrawPatch = null; } @@ -673,7 +673,7 @@ public abstract class PageView extends ViewGroup { public void removeHq() { // Stop the drawing of the patch if still going if (mDrawPatch != null) { - mDrawPatch.cancelAndWait(); + mDrawPatch.cancel(); mDrawPatch = null; } |