wait for dismissal of one alert before posting another. There really

needs to be some sort of queuing built into DlgDelegate, but for now
just handle in this one place.
This commit is contained in:
Eric House 2016-06-30 08:01:58 -07:00
parent 446663ea86
commit 1a6f5842c6
2 changed files with 8 additions and 5 deletions

View file

@ -141,6 +141,7 @@ public class BoardDelegate extends DelegateBase
private int m_nGuestDevs = -1;
private boolean m_haveInvited = false;
private boolean m_overNotShown;
private boolean m_dropOnDismiss;
public class TimerRunnable implements Runnable {
private int m_why;
@ -1038,13 +1039,13 @@ public class BoardDelegate extends DelegateBase
boolean positive = AlertDialog.BUTTON_POSITIVE == which;
DbgUtils.logdf("BoardDelegate.dlgButtonClicked(%s, %b)", action.toString(), positive );
if ( Action.ENABLE_RELAY_DO == action ) {
if ( positive ) {
if ( Action.ENABLE_RELAY_DO_OR == action ) {
handled = true;
if ( positive ) {
RelayService.setEnabled( m_activity, true );
} else if ( AlertDialog.BUTTON_NEGATIVE == which ) {
handled = true;
// Things get very confused if askDropRelay() is called here.
m_dropOnDismiss = true;
} else if ( DlgDelegate.DISMISS_BUTTON == which && m_dropOnDismiss ) {
postDelayed( new Runnable() {
public void run() {
askDropRelay();
@ -2391,11 +2392,12 @@ public class BoardDelegate extends DelegateBase
}
if ( m_connTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
if ( !RelayService.relayEnabled( m_activity ) ) {
m_dropOnDismiss = false;
String msg = getString( R.string.warn_relay_disabled )
+ "\n\n" + getString( R.string.warn_relay_remove );
showConfirmThen( msg, R.string.button_enable_relay,
R.string.newgame_drop_relay,
Action.ENABLE_RELAY_DO );
Action.ENABLE_RELAY_DO_OR );
}
}
}

View file

@ -122,6 +122,7 @@ public class DlgDelegate {
ENABLE_SMS_DO,
ENABLE_BT_DO,
ENABLE_RELAY_DO,
ENABLE_RELAY_DO_OR,
DISABLE_RELAY_DO,
}