summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2014-04-18 17:07:12 +0100
committerRobin Watts <robin.watts@artifex.com>2014-04-22 19:29:02 +0100
commit18357fc922e77ac671b0506b67a3e292ac34a7e9 (patch)
treec2efa0bda8d9da55087c42986d714ee4c7d8e600
parenta879f26eaf3e86183966de124f3c30ceb7e8b2e4 (diff)
downloadmupdf-18357fc922e77ac671b0506b67a3e292ac34a7e9.tar.xz
Tweak Intent usage for ChoosePDFActivity
ChoosePDFActivity can be used either to select PDF/XPS etc files, or to select key files (for digital signatures). The choice of which one to use is made according to the action string in the Intent with which the activity is invoked. Previously we would look for Intent.action.MAIN and take this to mean "Look for PDF files", and anything else to mean look for key files. Unfortunately, if you start the activity directly using adb then the action string is null, so we look for key files. The fix is to use a specific (custom) string for key files and for everything else to be treated as a request for PDF files.
-rw-r--r--platform/android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java3
-rw-r--r--platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java1
2 files changed, 3 insertions, 1 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java b/platform/android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java
index f9428dc8..4ab0618e 100644
--- a/platform/android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java
+++ b/platform/android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java
@@ -27,6 +27,7 @@ enum Purpose {
}
public class ChoosePDFActivity extends ListActivity {
+ static public final String PICK_KEY_FILE = "com.artifex.mupdfdemo.PICK_KEY_FILE";
static private File mDirectory;
static private Map<String, Integer> mPositions = new HashMap<String, Integer>();
private File mParent;
@@ -41,7 +42,7 @@ public class ChoosePDFActivity extends ListActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mPurpose = Intent.ACTION_MAIN.equals(getIntent().getAction()) ? Purpose.PickPDF : Purpose.PickKeyFile;
+ mPurpose = PICK_KEY_FILE.equals(getIntent().getAction()) ? Purpose.PickKeyFile : Purpose.PickPDF;
String storageState = Environment.getExternalStorageState();
diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
index db0bb3fb..e9922a34 100644
--- a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
+++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
@@ -1107,6 +1107,7 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp
public void performPickFor(FilePicker picker) {
mFilePicker = picker;
Intent intent = new Intent(this, ChoosePDFActivity.class);
+ intent.setAction(ChoosePDFActivity.PICK_KEY_FILE);
startActivityForResult(intent, FILEPICK_REQUEST);
}
}