close game when invite dialog dismissed via back button

Catch the onCancelled event, and treat as "close" button tap. Also
disable cancel via taps outside the alert, which I think is less
confusing than leaving the unplayable game up without the alert or
closing it without explanation.
This commit is contained in:
Eric House 2020-11-28 10:29:32 -08:00
parent 437aef5ed5
commit 386cfbda71

View file

@ -33,7 +33,7 @@ import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.Perms23.Perm;
import org.eehouse.android.xw4.loc.LocUtils;
class InvitesNeededAlert implements DialogInterface.OnDismissListener {
class InvitesNeededAlert {
private static final String TAG = InvitesNeededAlert.class.getSimpleName();
private DelegateBase mDelegate;
@ -116,16 +116,6 @@ class InvitesNeededAlert implements DialogInterface.OnDismissListener {
void onInfoClicked();
}
////////////////////////////////////////
// DialogInterface.OnDismissListener
////////////////////////////////////////
@Override
public void onDismiss( DialogInterface dialog )
{
Log.d( TAG, "onDismiss()" );
close();
}
private void close()
{
DbgUtils.assertOnUIThread();
@ -209,8 +199,17 @@ class InvitesNeededAlert implements DialogInterface.OnDismissListener {
}
} );
alert.setOnCancelListener( new XWDialogFragment.OnCancelListener() {
@Override
public void onCancelled( XWDialogFragment frag ) {
// Log.d( TAG, "onCancelled(frag=%s)", frag );
callbacks.onCloseClicked();
close();
}
} );
result = ab.create();
result.setOnDismissListener( this );
result.setCanceledOnTouchOutside( false );
return result;
}
}