diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-03-18 18:15:02 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-03-18 18:15:02 -0700 |
commit | 7e0f41a05329eb37d2e7c3de9ceb8ac9f4472ff4 (patch) | |
tree | a073ba97ea9f228b3ca6fc7526fe98d8e7d8052b | |
parent | f1e64f3cfb11febd1bb0e36360b834e75f9b4957 (diff) | |
download | dsub-7e0f41a05329eb37d2e7c3de9ceb8ac9f4472ff4.tar.gz dsub-7e0f41a05329eb37d2e7c3de9ceb8ac9f4472ff4.tar.bz2 dsub-7e0f41a05329eb37d2e7c3de9ceb8ac9f4472ff4.zip |
Add ability to pass onCancel to confirm
-rw-r--r-- | src/github/daneren2005/dsub/util/Util.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/util/Util.java b/src/github/daneren2005/dsub/util/Util.java index 5027e0c0..412289fc 100644 --- a/src/github/daneren2005/dsub/util/Util.java +++ b/src/github/daneren2005/dsub/util/Util.java @@ -645,18 +645,24 @@ public final class Util { } public static void confirmDialog(Context context, int action, int subject, DialogInterface.OnClickListener onClick) { - Util.confirmDialog(context, context.getResources().getString(action).toLowerCase(), context.getResources().getString(subject), onClick); + Util.confirmDialog(context, context.getResources().getString(action).toLowerCase(), context.getResources().getString(subject), onClick, null); + } + public static void confirmDialog(Context context, int action, int subject, DialogInterface.OnClickListener onClick, DialogInterface.OnClickListener onCancel) { + Util.confirmDialog(context, context.getResources().getString(action).toLowerCase(), context.getResources().getString(subject), onClick, onCancel); } public static void confirmDialog(Context context, int action, String subject, DialogInterface.OnClickListener onClick) { - Util.confirmDialog(context, context.getResources().getString(action).toLowerCase(), subject, onClick); + Util.confirmDialog(context, context.getResources().getString(action).toLowerCase(), subject, onClick, null); + } + public static void confirmDialog(Context context, int action, String subject, DialogInterface.OnClickListener onClick, DialogInterface.OnClickListener onCancel) { + Util.confirmDialog(context, context.getResources().getString(action).toLowerCase(), subject, onClick, onCancel); } - public static void confirmDialog(Context context, String action, String subject, DialogInterface.OnClickListener onClick) { + public static void confirmDialog(Context context, String action, String subject, DialogInterface.OnClickListener onClick, DialogInterface.OnClickListener onCancel) { new AlertDialog.Builder(context) .setIcon(android.R.drawable.ic_dialog_alert) .setTitle(R.string.common_confirm) .setMessage(context.getResources().getString(R.string.common_confirm_message, action, subject)) .setPositiveButton(R.string.common_ok, onClick) - .setNegativeButton(R.string.common_cancel, null) + .setNegativeButton(R.string.common_cancel, onCancel) .show(); } |