diff options
author | Robin Watts <robin.watts@artifex.com> | 2015-07-14 16:35:12 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-07-20 17:19:04 +0100 |
commit | 28432abe9a2fcdb47750c0e49cb484c615f5a883 (patch) | |
tree | fdc545552883f44558d0aea3bc2fbbfb346e455f /platform/android/src/com | |
parent | 269fdfce2527cbba02e68d658af3f4b92ef40be0 (diff) | |
download | mupdf-28432abe9a2fcdb47750c0e49cb484c615f5a883.tar.xz |
Add Proofing button to Android UI.
Hit the proofing button, and we create a new temporary .gproof file.
We invoke a new version of MuPDF on that. When that finishes control
returns to us, and we delete the .gproof file.
Currently the new version of MuPDF loads the .gproof file, but fails
to generate any pages from it, as we have no version of ghostscript
on the system. Generating this new ghostscript is the next job.
Diffstat (limited to 'platform/android/src/com')
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java | 17 | ||||
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java | 11 |
2 files changed, 28 insertions, 0 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java index 58ea1aa3..172c189a 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java @@ -50,6 +50,7 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp private final int OUTLINE_REQUEST=0; private final int PRINT_REQUEST=1; private final int FILEPICK_REQUEST=2; + private final int PROOF_REQUEST=3; private MuPDFCore core; private String mFileName; private MuPDFReaderView mDocView; @@ -83,6 +84,7 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp private AsyncTask<Void,Void,MuPDFAlert> mAlertTask; private AlertDialog mAlertDialog; private FilePicker mFilePicker; + private String mProofFile; public void createAlertWaiter() { mAlertsActive = true; @@ -621,6 +623,12 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp case FILEPICK_REQUEST: if (mFilePicker != null && resultCode == RESULT_OK) mFilePicker.onPick(data.getData()); + case PROOF_REQUEST: + if (mProofFile != null) + { + core.endProof(mProofFile); + mProofFile = null; + } } super.onActivityResult(requestCode, resultCode, data); } @@ -899,6 +907,15 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp printDoc(); } + public void OnProofButtonClick(View v) { + mProofFile = core.startProof(); + Uri uri = Uri.parse("file://"+mProofFile); + Intent intent = new Intent(this,MuPDFActivity.class); + intent.setAction(Intent.ACTION_VIEW); + intent.setData(uri); + startActivityForResult(intent, PROOF_REQUEST); + } + public void OnCopyTextButtonClick(View v) { mTopBarMode = TopBarMode.Accept; mTopBarSwitcher.setDisplayedChild(mTopBarMode.ordinal()); diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java index be6f6fbf..ffab6782 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java @@ -6,6 +6,7 @@ import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.PointF; import android.graphics.RectF; +import android.content.Intent; public class MuPDFCore { @@ -77,6 +78,8 @@ public class MuPDFCore private native long createCookie(); private native void destroyCookie(long cookie); private native void abortCookie(long cookie); + private native String startProofInternal(); + private native void endProofInternal(String filename); public native boolean javascriptSupported(); @@ -346,4 +349,12 @@ public class MuPDFCore public synchronized void save() { saveInternal(); } + + public synchronized String startProof() { + return startProofInternal(); + } + + public synchronized void endProof(String filename) { + endProofInternal(filename); + } } |