From 7e0f41a05329eb37d2e7c3de9ceb8ac9f4472ff4 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 18 Mar 2015 18:15:02 -0700 Subject: Add ability to pass onCancel to confirm --- src/github/daneren2005/dsub/util/Util.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/github') 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(); } -- cgit v1.2.3