From d68576c3785572c1f5d41f83015b8fe6bbcbe9e8 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 30 Mar 2016 17:49:04 +0200 Subject: Reorganize java and android source. platform/java and platform/android are reorganized: platform/java The new JNI Java classes, mupdf_native.{c,h}, Makefile and Makejar. platform/java/example The example desktop viewer classes. platform/android/viewer The original demo viewer. ndk-build is used to build libmupdf_java.so, making reference to mupdf_native.{c,h} in platform/java. --- .../artifex/mupdfdemo/CancellableAsyncTask.java | 79 ---------------------- 1 file changed, 79 deletions(-) delete mode 100644 platform/android/src/com/artifex/mupdfdemo/CancellableAsyncTask.java (limited to 'platform/android/src/com/artifex/mupdfdemo/CancellableAsyncTask.java') diff --git a/platform/android/src/com/artifex/mupdfdemo/CancellableAsyncTask.java b/platform/android/src/com/artifex/mupdfdemo/CancellableAsyncTask.java deleted file mode 100644 index fcb1b744..00000000 --- a/platform/android/src/com/artifex/mupdfdemo/CancellableAsyncTask.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.artifex.mupdfdemo; - -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; - -// Ideally this would be a subclass of AsyncTask, however the cancel() method is final, and cannot -// be overridden. I felt that having two different, but similar cancel methods was a bad idea. -public class CancellableAsyncTask -{ - private final AsyncTask asyncTask; - private final CancellableTaskDefinition ourTask; - - public void onPreExecute() - { - - } - - public void onPostExecute(Result result) - { - - } - - public CancellableAsyncTask(final CancellableTaskDefinition task) - { - if (task == null) - throw new IllegalArgumentException(); - - this.ourTask = task; - asyncTask = new AsyncTask() - { - @Override - protected Result doInBackground(Params... params) - { - return task.doInBackground(params); - } - - @Override - protected void onPreExecute() - { - CancellableAsyncTask.this.onPreExecute(); - } - - @Override - protected void onPostExecute(Result result) - { - CancellableAsyncTask.this.onPostExecute(result); - task.doCleanup(); - } - }; - } - - public void cancelAndWait() - { - this.asyncTask.cancel(true); - ourTask.doCancel(); - - try - { - this.asyncTask.get(); - } - catch (InterruptedException e) - { - } - catch (ExecutionException e) - { - } - catch (CancellationException e) - { - } - - ourTask.doCleanup(); - } - - public void execute(Params ... params) - { - asyncTask.execute(params); - } - -} -- cgit v1.2.3