aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java
diff options
context:
space:
mode:
authorAdithya Abraham Philip <adithyaphilip@gmail.com>2015-07-10 08:29:29 +0530
committerAdithya Abraham Philip <adithyaphilip@gmail.com>2015-07-13 23:34:06 +0530
commit8bbc5513d447d186497023ca3f0c474541419389 (patch)
tree5ef70550f9f79818a19c84745a406833aef7c2c7 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java
parent0cec75fc9d47c4728678418727559e523295ae21 (diff)
downloadopen-keychain-8bbc5513d447d186497023ca3f0c474541419389.tar.gz
open-keychain-8bbc5513d447d186497023ca3f0c474541419389.tar.bz2
open-keychain-8bbc5513d447d186497023ca3f0c474541419389.zip
corrected DeleteKeyDialogActivity finishing on cancel
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java30
1 files changed, 21 insertions, 9 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java
index ec9d7d74c..148ca3346 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java
@@ -310,12 +310,19 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
@Override
public void onClick(DialogInterface dialog, int id) {
- getActivity().finish();
+ dialog.cancel();
}
});
return builder.show();
}
+
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ super.onCancel(dialog);
+ getActivity().setResult(RESULT_CANCELED);
+ getActivity().finish();
+ }
}
public static class RevokeDeleteDialogFragment extends DialogFragment {
@@ -343,27 +350,25 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
ContextThemeWrapper theme = new ContextThemeWrapper(activity,
R.style.Theme_AppCompat_Light_Dialog);
- CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(theme);
- alert.setTitle(getString(R.string.del_rev_dialog_title,
+ CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme);
+ builder.setTitle(getString(R.string.del_rev_dialog_title,
getArguments().get(ARG_KEY_NAME)));
LayoutInflater inflater = LayoutInflater.from(theme);
View view = inflater.inflate(R.layout.del_rev_dialog, null);
- alert.setView(view);
+ builder.setView(view);
final Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
- alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
- activity.setResult(RESULT_CANCELED);
- activity.finish();
}
});
- alert.setPositiveButton(R.string.del_rev_dialog_btn_revoke,
+ builder.setPositiveButton(R.string.del_rev_dialog_btn_revoke,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -382,7 +387,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
}
});
- final AlertDialog alertDialog = alert.show();
+ final AlertDialog alertDialog = builder.show();
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
@@ -407,6 +412,13 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
return alertDialog;
}
+
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ super.onCancel(dialog);
+ getActivity().setResult(RESULT_CANCELED);
+ getActivity().finish();
+ }
}
}