close InviteChoicesAlert when game connects

That'll happen if QR code is used in its current location.
This commit is contained in:
Eric House 2020-10-04 21:35:56 -07:00
parent 359e1d12d1
commit 4f17c64301
2 changed files with 24 additions and 0 deletions

View file

@ -2553,6 +2553,8 @@ public class BoardDelegate extends DelegateBase
runOnUiThread( new Runnable() {
@Override
public void run() {
InviteChoicesAlert.dismissAny();
if ( m_relayMissing && connected ) {
m_relayMissing = false;
}

View file

@ -26,6 +26,7 @@ import android.content.DialogInterface;
import android.widget.Button;
import android.widget.RadioGroup;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
@ -40,15 +41,36 @@ import org.eehouse.android.xw4.loc.LocUtils;
public class InviteChoicesAlert extends DlgDelegateAlert
implements InviteView.ItemClicked {
private static WeakReference<InviteChoicesAlert> sSelf;
public static InviteChoicesAlert newInstance( DlgState state )
{
InviteChoicesAlert result = new InviteChoicesAlert();
result.addStateArgument( state );
sSelf = new WeakReference<>(result);
return result;
}
public static void dismissAny()
{
WeakReference<InviteChoicesAlert> ref = sSelf;
if ( null != ref ) {
InviteChoicesAlert self = ref.get();
if ( null != self ) {
self.dismiss();
}
}
}
public InviteChoicesAlert() {}
@Override
public void onDestroy()
{
sSelf = null;
super.onDestroy();
}
@Override
public void populateBuilder( final Context context, final DlgState state,
AlertDialog.Builder builder )