close pending game's board when invite cancelled

Add cancelled notification to invite choices dialog. Look for that in
board delegate and close the game. Makes the inviting experience more
consistent, the goal being that you never look at a game that's missing
players without some intervening dialog preventing you from trying to
play.
This commit is contained in:
Eric House 2016-12-26 16:06:44 -08:00
parent 84e8f0927c
commit f989212926
2 changed files with 12 additions and 2 deletions

View file

@ -1031,7 +1031,10 @@ public class BoardDelegate extends DelegateBase
DbgUtils.logd( TAG, "BoardDelegate.dlgButtonClicked(%s, %b)",
action.toString(), positive );
if ( Action.ENABLE_RELAY_DO_OR == action ) {
if ( Action.LAUNCH_INVITE_ACTION == action ) {
Assert.assertFalse( positive );
finish();
} else if ( Action.ENABLE_RELAY_DO_OR == action ) {
handled = true;
if ( positive ) {
RelayService.setEnabled( m_activity, true );

View file

@ -802,13 +802,20 @@ public class DlgDelegate {
}
}
};
OnClickListener cancelClicked = new OnClickListener() {
public void onClick( DialogInterface dlg, int view ) {
m_clickCallback.dlgButtonClicked( state.m_action,
AlertDialog.BUTTON_NEGATIVE,
state.m_params );
}
};
AlertDialog.Builder builder = LocUtils.makeAlertBuilder( m_activity )
.setTitle( R.string.invite_choice_title )
.setSingleChoiceItems( items.toArray( new String[items.size()] ),
sel[0], selChanged )
.setPositiveButton( android.R.string.ok, okClicked )
.setNegativeButton( android.R.string.cancel, null );
.setNegativeButton( android.R.string.cancel, cancelClicked );
return setCallbackDismissListener( builder.create(), state, dlgID );
}