From 5f8e5dc34367497d297ae3a6ce88e8453f2ca2e5 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 18 Jul 2016 09:19:09 -0700 Subject: [PATCH] don't dismiss alert when about to post it again On 4.2 and 4.3 at least, the dimiss comes after the second post causing that to be dismissed, leaving no alert and the app in some weird state where not even the back button works. It's been this way on those older versions since I redid invitations for beta 98. --- .../org/eehouse/android/xw4/BoardDelegate.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java index 78e5612fb..fb871d0eb 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java @@ -1570,7 +1570,7 @@ public class BoardDelegate extends DelegateBase private void handleConndMessage( String room, int devOrder, // <- hostID boolean allHere, int nMissing ) { - dismissInviteAlert( nMissing, true ); + boolean skipDismiss = false; int naMsg = 0; int naKey = 0; @@ -1598,6 +1598,7 @@ public class BoardDelegate extends DelegateBase m_room = room; showDialog( DlgID.DLG_INVITE ); invalidateOptionsMenuIf(); + skipDismiss = true; } else { toastStr = getQuantityString( R.plurals.msg_relay_waiting_fmt, nMissing, devOrder, room, nMissing ); @@ -1622,6 +1623,10 @@ public class BoardDelegate extends DelegateBase } } + if ( !skipDismiss ) { + dismissInviteAlert( nMissing, true ); // NO!!! + } + invalidateOptionsMenuIf(); } // handleConndMessage @@ -1926,26 +1931,30 @@ public class BoardDelegate extends DelegateBase public void informMissing( boolean isServer, CommsConnTypeSet connTypes, int nDevs, final int nMissing ) { + boolean doDismiss = true; m_connTypes = connTypes; Assert.assertTrue( isServer || 0 == nMissing ); // DbgUtils.logf( "BoardDelegate.informMissing(isServer=%b, nDevs=%d, nMissing=%d)", // isServer, nDevs, nMissing ); m_nGuestDevs = nDevs; - // If we might have put up an alert earlier, take it down - dismissInviteAlert( nMissing, !m_relayMissing ); - m_nMissing = nMissing; // will be 0 unless isServer is true if ( null != connTypes && 0 == connTypes.size() ) { askNoAddrsDelete(); } else if ( 0 < nMissing && isServer && !m_haveInvited ) { + doDismiss = false; post( new Runnable() { public void run() { showDialog( DlgID.DLG_INVITE ); } } ); } + + // If we might have put up an alert earlier, take it down + if ( doDismiss ) { + dismissInviteAlert( nMissing, !m_relayMissing ); + } } @Override