diff options
author | Robin Watts <robin.watts@artifex.com> | 2015-07-20 12:26:35 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-07-20 17:19:06 +0100 |
commit | 6e6250f0cfda83f8456203a7fd554977259646dd (patch) | |
tree | 28ce962fa8342c3dbb05b4d6e75cf42d9f528f1c /platform/android/src/com | |
parent | e5642ac4d5692448c9b13eb6cecb2208f72ff525 (diff) | |
download | mupdf-6e6250f0cfda83f8456203a7fd554977259646dd.tar.xz |
Tweak Android MuPDF build to respect SUPPORT_GPROOF.
MuPDFCore now supports a gprfSupported method that returns
true iff we compiled the core with SUPPORT_GPROOF and a
libgs.so is available.
Diffstat (limited to 'platform/android/src/com')
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java | 5 | ||||
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java index 172c189a..30e96ecf 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java @@ -76,6 +76,7 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp private ImageButton mSearchFwd; private EditText mSearchText; private SearchTask mSearchTask; + private ImageButton mProofButton; private AlertDialog.Builder mAlertBuilder; private boolean mLinkHighlight = false; private final Handler mHandler = new Handler(); @@ -887,10 +888,14 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText); mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton); mMoreButton = (ImageButton)mButtonsView.findViewById(R.id.moreButton); + mProofButton = (ImageButton)mButtonsView.findViewById(R.id.proofButton); mTopBarSwitcher.setVisibility(View.INVISIBLE); mPageNumberView.setVisibility(View.INVISIBLE); mInfoView.setVisibility(View.INVISIBLE); mPageSlider.setVisibility(View.INVISIBLE); + if (!core.gprfSupported()) { + mProofButton.setVisibility(View.INVISIBLE); + } } public void OnMoreButtonClick(View v) { diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java index ffab6782..5c8697fb 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java @@ -11,8 +11,19 @@ import android.content.Intent; public class MuPDFCore { /* load our native library */ + private static boolean gs_so_available = false; static { System.loadLibrary("mupdf"); + if (gprfSupportedInternal()) + { + try { + System.loadLibrary("gs"); + gs_so_available = true; + } + catch (UnsatisfiedLinkError e) { + gs_so_available = false; + } + } } /* Readable members */ @@ -26,6 +37,7 @@ public class MuPDFCore private final boolean wasOpenedFromBuffer; /* The native functions */ + private static native boolean gprfSupportedInternal(); private native long openFile(String filename); private native long openBuffer(String magic); private native String fileFormatInternal(); @@ -357,4 +369,10 @@ public class MuPDFCore public synchronized void endProof(String filename) { endProofInternal(filename); } + + public static boolean gprfSupported() { + if (gs_so_available == false) + return false; + return gprfSupportedInternal(); + } } |