cleanup: use chaining everywhere building alerts

This commit is contained in:
Eric House 2016-08-19 14:44:37 -07:00
parent 78c3d4c0e9
commit f23e44c56d

View file

@ -621,21 +621,21 @@ public class DlgDelegate {
xlator.setVisibility( View.GONE ); xlator.setVisibility( View.GONE );
} }
AlertDialog.Builder builder = LocUtils.makeAlertBuilder( m_activity ); return LocUtils.makeAlertBuilder( m_activity )
builder.setIcon( R.drawable.icon48x48 ); .setIcon( R.drawable.icon48x48 )
builder.setTitle( R.string.app_name ); .setTitle( R.string.app_name )
builder.setView( view ); .setView( view )
builder.setNegativeButton( R.string.changes_button, .setNegativeButton( R.string.changes_button,
new OnClickListener() { new OnClickListener() {
@Override @Override
public void onClick( DialogInterface dlg, public void onClick( DialogInterface dlg,
int which ) int which )
{ {
FirstRunDialog.show( m_activity ); FirstRunDialog.show( m_activity );
} }
} ); } )
builder.setPositiveButton( android.R.string.ok, null ); .setPositiveButton( android.R.string.ok, null )
return builder.create(); .create();
} }
private Dialog createLookupDialog() private Dialog createLookupDialog()
@ -647,11 +647,11 @@ public class DlgDelegate {
private Dialog createOKDialog( DlgState state, DlgID dlgID ) private Dialog createOKDialog( DlgState state, DlgID dlgID )
{ {
AlertDialog.Builder builder = LocUtils.makeAlertBuilder( m_activity ); Dialog dialog = LocUtils.makeAlertBuilder( m_activity )
builder.setTitle( R.string.info_title ); .setTitle( R.string.info_title )
builder.setMessage( state.m_msg ); .setMessage( state.m_msg )
builder.setPositiveButton( android.R.string.ok, null ); .setPositiveButton( android.R.string.ok, null )
Dialog dialog = builder.create(); .create();
dialog = setCallbackDismissListener( dialog, state, dlgID ); dialog = setCallbackDismissListener( dialog, state, dlgID );
return dialog; return dialog;
@ -701,9 +701,8 @@ public class DlgDelegate {
.setView( naView ) .setView( naView )
.setPositiveButton( state.m_posButton, lstnr ) .setPositiveButton( state.m_posButton, lstnr )
.setNegativeButton( state.m_negButton, lstnr ); .setNegativeButton( state.m_negButton, lstnr );
Dialog dialog = builder.create();
return setCallbackDismissListener( dialog, state, dlgID ); return setCallbackDismissListener( builder.create(), state, dlgID );
} }
private Dialog createInviteChoicesDialog( final DlgState state, DlgID dlgID ) private Dialog createInviteChoicesDialog( final DlgState state, DlgID dlgID )
@ -809,11 +808,11 @@ public class DlgDelegate {
private Dialog createDictGoneDialog() private Dialog createDictGoneDialog()
{ {
AlertDialog.Builder builder = LocUtils.makeAlertBuilder( m_activity ); Dialog dialog = LocUtils.makeAlertBuilder( m_activity )
builder.setTitle( R.string.no_dict_title ); .setTitle( R.string.no_dict_title )
builder.setMessage( R.string.no_dict_finish ); .setMessage( R.string.no_dict_finish )
builder.setPositiveButton( R.string.button_close_game, null ); .setPositiveButton( R.string.button_close_game, null )
Dialog dialog = builder.create(); .create();
dialog.setOnDismissListener( new DialogInterface.OnDismissListener() { dialog.setOnDismissListener( new DialogInterface.OnDismissListener() {
public void onDismiss( DialogInterface di ) { public void onDismiss( DialogInterface di ) {