summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gardiner <paul@glidos.net>2012-02-27 14:59:54 +0000
committerPaul Gardiner <paul@glidos.net>2012-03-15 11:37:49 +0000
commit150e7f9781cd67c9bf00dd24188cd8052fe5c0c3 (patch)
tree1bce8f0e374ee90c2966d3d28a0ece51091c642e
parentf6ec243a4a629913419a739a25199ec8a28bab65 (diff)
downloadmupdf-150e7f9781cd67c9bf00dd24188cd8052fe5c0c3.tar.xz
Handle view requests from the Transformer Prime's file manager
-rw-r--r--android/src/com/artifex/mupdf/MuPDFActivity.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/android/src/com/artifex/mupdf/MuPDFActivity.java b/android/src/com/artifex/mupdf/MuPDFActivity.java
index 051c2740..7b100050 100644
--- a/android/src/com/artifex/mupdf/MuPDFActivity.java
+++ b/android/src/com/artifex/mupdf/MuPDFActivity.java
@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.database.Cursor;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
@@ -103,8 +104,19 @@ public class MuPDFActivity extends Activity
}
if (core == null) {
Intent intent = getIntent();
- if (Intent.ACTION_VIEW.equals(intent.getAction()))
- core = openFile(Uri.decode(intent.getData().getEncodedPath()));
+ if (Intent.ACTION_VIEW.equals(intent.getAction())) {
+ Uri uri = intent.getData();
+ if (uri.toString().startsWith("content://media/external/file")) {
+ // Handle view requests from the Transformer Prime's file manager
+ // Hopefully other file managers will use this same scheme, if not
+ // using explicit paths.
+ Cursor cursor = getContentResolver().query(uri, new String[]{"_data"}, null, null, null);
+ if (cursor.moveToFirst()) {
+ uri = Uri.parse(cursor.getString(0));
+ }
+ }
+ core = openFile(Uri.decode(uri.getEncodedPath()));
+ }
if (core != null && core.needsPassword()) {
requestPassword(savedInstanceState);
return;