listen for invite alert dismiss

Because I'm doing a singleton thing, if I miss the alert going away I
won't up another up. This tries to always catch dismissal. Might still
be screwed if it's not actually put up for some reason. Needs testing.
This commit is contained in:
Eric House 2020-11-22 20:38:22 -08:00
parent 6fb3d19f03
commit 48cf291c5a
2 changed files with 20 additions and 5 deletions

View file

@ -1970,6 +1970,8 @@ public class BoardDelegate extends DelegateBase
public void informMissing( boolean isServer, CommsConnTypeSet connTypes,
int nDevs, int nMissing )
{
// Log.d( TAG, "informMissing(isServer: %b, nDevs: %d; nMissing: %d",
// isServer, nDevs, nMissing );
m_mySIS.nMissing = nMissing; // will be 0 unless isServer is true
m_mySIS.nGuestDevs = nDevs;
m_connTypes = connTypes;

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 {
class InvitesNeededAlert implements DialogInterface.OnDismissListener {
private static final String TAG = InvitesNeededAlert.class.getSimpleName();
private static InvitesNeededAlert[] sInstance = {null};
@ -118,13 +118,25 @@ class InvitesNeededAlert {
{
DbgUtils.assertOnUIThread();
Assert.assertTrueNR( self == sInstance[0] );
sInstance[0] = null;
if ( null != self.mAlert ) {
InviteChoicesAlert.dismissAny();
self.mAlert.dismiss();
if ( self == sInstance[0] ) {
sInstance[0] = null;
if ( null != self.mAlert ) {
InviteChoicesAlert.dismissAny();
self.mAlert.dismiss();
}
}
}
////////////////////////////////////////
// DialogInterface.OnDismissListener
////////////////////////////////////////
@Override
public void onDismiss( DialogInterface dialog )
{
Log.d( TAG, "onDismiss()" );
close( this );
}
private InvitesNeededAlert( Callbacks callbacks, State state )
{
mState = state;
@ -202,6 +214,7 @@ class InvitesNeededAlert {
} );
result = ab.create();
result.setOnDismissListener( this );
return result;
}