diff options
Diffstat (limited to 'platform/android/src/com')
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java | 6 | ||||
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java | 7 |
2 files changed, 6 insertions, 7 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java index bf652d92..062bb03b 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java @@ -223,12 +223,12 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp return core; } - private MuPDFCore openBuffer(byte buffer[]) + private MuPDFCore openBuffer(byte buffer[], String magic) { System.out.println("Trying to open byte buffer"); try { - core = new MuPDFCore(this, buffer); + core = new MuPDFCore(this, buffer, magic); // New file: drop the old outline data OutlineActivityData.set(null); } @@ -314,7 +314,7 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp } } if (buffer != null) { - core = openBuffer(buffer); + core = openBuffer(buffer, intent.getType()); } else { core = openFile(Uri.decode(uri.getEncodedPath())); } diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java index 68aed29e..0532b61d 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java @@ -25,7 +25,7 @@ public class MuPDFCore /* The native functions */ private native long openFile(String filename); - private native long openBuffer(); + private native long openBuffer(String magic); private native String fileFormatInternal(); private native boolean isUnencryptedPDFInternal(); private native int countPagesInternal(); @@ -114,10 +114,9 @@ public class MuPDFCore isUnencryptedPDF = isUnencryptedPDFInternal(); } - public MuPDFCore(Context context, byte buffer[]) throws Exception - { + public MuPDFCore(Context context, byte buffer[], String magic) throws Exception { fileBuffer = buffer; - globals = openBuffer(); + globals = openBuffer(magic != null ? magic : ""); if (globals == 0) { throw new Exception(context.getString(R.string.cannot_open_buffer)); |