1 package com.android.gallery3d.photoeditor; 2 3 import android.app.AlertDialog; 4 import android.content.Context; 5 import android.content.DialogInterface; 6 7 import com.android.gallery3d.R; 8 9 /** 10 * Alert dialog builder that builds a simple Yes/Cancel dialog. 11 */ 12 public class YesCancelDialogBuilder extends AlertDialog.Builder { 13 YesCancelDialogBuilder(Context context, final Runnable yes, int messageId)14 public YesCancelDialogBuilder(Context context, final Runnable yes, int messageId) { 15 super(context); 16 setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { 17 18 @Override 19 public void onClick(DialogInterface dialog, int which) { 20 yes.run(); 21 } 22 }) 23 .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { 24 25 @Override 26 public void onClick(DialogInterface dialog, int which) { 27 // no-op 28 } 29 }).setMessage(messageId); 30 } 31 } 32