Extracted method

This commit is contained in:
Victor Hazali
2016-03-30 05:37:31 +08:00
parent 8ac7115f22
commit ce70568ff3

View File

@@ -75,22 +75,7 @@ public class EditSubkeyDialogFragment extends DialogFragment {
sendMessageToHandler(MESSAGE_REVOKE, null);
break;
case 2:
CustomAlertDialogBuilder stripAlertDialog = new CustomAlertDialogBuilder(getActivity());
stripAlertDialog.setTitle(getResources().getString(R.string.title_alert_strip)).
setMessage(R.string.alert_strip).setCancelable(true);
stripAlertDialog.setPositiveButton(R.string.strip, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
sendMessageToHandler(MESSAGE_STRIP, null);
}
});
stripAlertDialog.setNegativeButton(R.string.btn_do_not_save, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dismiss();
}
});
stripAlertDialog.show();
showAlertDialog();
break;
case 3:
sendMessageToHandler(MESSAGE_MOVE_KEY_TO_CARD, null);
@@ -110,6 +95,25 @@ public class EditSubkeyDialogFragment extends DialogFragment {
return builder.show();
}
private void showAlertDialog() {
CustomAlertDialogBuilder stripAlertDialog = new CustomAlertDialogBuilder(getActivity());
stripAlertDialog.setTitle(getResources().getString(R.string.title_alert_strip)).
setMessage(R.string.alert_strip).setCancelable(true);
stripAlertDialog.setPositiveButton(R.string.strip, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
sendMessageToHandler(MESSAGE_STRIP, null);
}
});
stripAlertDialog.setNegativeButton(R.string.btn_do_not_save, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dismiss();
}
});
stripAlertDialog.show();
}
/**
* Send message back to handler which is initialized in a activity
*