diff options
Diffstat (limited to 'platform/android/src/com/artifex')
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java | 3 | ||||
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java index 062bb03b..681ea317 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java @@ -260,6 +260,7 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp byte buffer[] = null; if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); + System.out.println("URI to open is: " + uri); if (uri.toString().startsWith("content://")) { String reason = null; try { @@ -492,7 +493,7 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp } }); - if (core.fileFormat().startsWith("PDF") && core.isUnencryptedPDF()) + if (core.fileFormat().startsWith("PDF") && core.isUnencryptedPDF() && !core.wasOpenedFromBuffer()) { mAnnotButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java index 0532b61d..750540b7 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java @@ -22,6 +22,7 @@ public class MuPDFCore private byte fileBuffer[]; private String file_format; private boolean isUnencryptedPDF; + private final boolean wasOpenedFromBuffer; /* The native functions */ private native long openFile(String filename); @@ -112,6 +113,7 @@ public class MuPDFCore } file_format = fileFormatInternal(); isUnencryptedPDF = isUnencryptedPDFInternal(); + wasOpenedFromBuffer = false; } public MuPDFCore(Context context, byte buffer[], String magic) throws Exception { @@ -123,6 +125,7 @@ public class MuPDFCore } file_format = fileFormatInternal(); isUnencryptedPDF = isUnencryptedPDFInternal(); + wasOpenedFromBuffer = true; } public int countPages() @@ -143,6 +146,11 @@ public class MuPDFCore return isUnencryptedPDF; } + public boolean wasOpenedFromBuffer() + { + return wasOpenedFromBuffer; + } + private synchronized int countPagesSynchronized() { return countPagesInternal(); } |