1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Remove no longer used references on confirmation dialog disapproval

This commit is contained in:
Fiouz 2011-06-07 01:25:38 +02:00
parent fc4dd077e4
commit 9b0ce3c75a
2 changed files with 31 additions and 2 deletions

View File

@ -22,6 +22,26 @@ public class ConfirmationDialog {
public static Dialog create(final Activity activity, final int dialogId, final int title,
final String message, final int confirmButton, final int cancelButton,
final Runnable action) {
return create(activity, dialogId, title, message, confirmButton, cancelButton,
action, null);
}
/**
* Creates a customized confirmation dialog ({@link AlertDialog}).
*
* @param activity The activity this dialog is created for.
* @param dialogId The id that was used with {@link Activity#showDialog(int)}
* @param title The resource id of the text to display in the dialog title
* @param message The text to display in the main dialog area
* @param confirmButton The resource id of the text to display in the confirm button
* @param cancelButton The resource id of the text to display in the cancel button
* @param action The action to perform if the user presses the confirm button
* @param negativeAction The action to perform if the user presses the cancel button. Can be {@code null}.
* @return A confirmation dialog with the supplied arguments
*/
public static Dialog create(final Activity activity, final int dialogId, final int title,
final String message, final int confirmButton, final int cancelButton,
final Runnable action, final Runnable negativeAction) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(title);
@ -39,6 +59,9 @@ public class ConfirmationDialog {
@Override
public void onClick(DialogInterface dialog, int which) {
activity.dismissDialog(dialogId);
if (negativeAction != null) {
negativeAction.run();
}
}
});
return builder.create();
@ -55,13 +78,13 @@ public class ConfirmationDialog {
* @param cancelButton The resource id of the text to display in the cancel button
* @param action The action to perform if the user presses the confirm button
* @return A confirmation dialog with the supplied arguments
* @see #create(Activity,int,int,String,int,int,Runnable)
* @see #create(Activity,int,int,String,int,int,Runnable, Runnable)
*/
public static Dialog create(final Activity activity, final int dialogId, final int title,
final int message, final int confirmButton, final int cancelButton,
final Runnable action) {
return create(activity, dialogId, title, activity.getString(message), confirmButton,
cancelButton, action);
cancelButton, action, null);
}
}

View File

@ -1287,6 +1287,12 @@ public class MessageList
// No further need for this reference
mActiveMessages = null;
}
}, new Runnable() {
@Override
public void run() {
// event for cancel, we don't need this reference any more
mActiveMessages = null;
}
});
}