- String confirmationTarget = getArguments().getString(ARG_CONF_TARGET);
- if (confirmationTarget == null)
- confirmationTarget = "";
-
- return new AlertDialog.Builder(getActivity())
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setMessage(String.format(getString(R.string.confirmation_alert), confirmationTarget))
- .setPositiveButton(R.string.common_ok,
+ Object[] confirmationTarget = getArguments().getStringArray(ARG_CONF_ARGUMENTS);
+ int resourceId = getArguments().getInt(ARG_CONF_RESOURCE_ID, -1);
+ int posBtn = getArguments().getInt(ARG_POSITIVE_BTN_RES, -1);
+ int neuBtn = getArguments().getInt(ARG_NEUTRAL_BTN_RES, -1);
+ int negBtn = getArguments().getInt(ARG_NEGATIVE_BTN_RES, -1);
+
+ if (confirmationTarget == null || resourceId == -1) {
+ Log.wtf(getTag(), "Calling confirmation dialog without resource or arguments");
+ return null;
+ }
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setMessage(String.format(getString(resourceId), confirmationTarget))
+ .setTitle(android.R.string.dialog_alert_title);
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
+ builder.setIconAttribute(android.R.attr.alertDialogIcon);
+ }
+
+ if (posBtn != -1)
+ builder.setPositiveButton(posBtn,