summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorMatt Holgate <matt@emobix.co.uk>2014-06-23 11:06:25 +0100
committerMatt Holgate <matt@emobix.co.uk>2014-06-23 11:14:52 +0100
commit5e8cbb16509767f42072739b7f13391051191f89 (patch)
tree1a393ad5514c01395f089530d176b0950a41dd24 /platform/android
parent5c72d575026723d60871a6576ca5bfb6acd0358f (diff)
downloadmupdf-5e8cbb16509767f42072739b7f13391051191f89.tar.xz
Fix crash when dismissing 'Cannot open document' dialog with back button, then pressing back button again.
I've also added an onCancel() handler, so that the back button only needs to be pressed once to return to the file picker view. Spotted while looking at bug #693719 - Attached PDF file does not display (edit)
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
index e9922a34..066b6d5f 100644
--- a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
+++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
@@ -9,6 +9,7 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
@@ -329,6 +330,13 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp
finish();
}
});
+ alert.setOnCancelListener(new OnCancelListener() {
+
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ });
alert.show();
return;
}
@@ -1083,7 +1091,7 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp
@Override
public void onBackPressed() {
- if (core.hasChanges()) {
+ if (core != null && core.hasChanges()) {
DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (which == AlertDialog.BUTTON_POSITIVE)