From 1a6f5842c6d9742d8376036647fa484c61d323ec Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 30 Jun 2016 08:01:58 -0700 Subject: [PATCH] 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. --- .../src/org/eehouse/android/xw4/BoardDelegate.java | 12 +++++++----- .../src/org/eehouse/android/xw4/DlgDelegate.java | 1 + 2 files changed, 8 insertions(+), 5 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 f4c51da01..7d207229d 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java @@ -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 ( Action.ENABLE_RELAY_DO_OR == action ) { + handled = true; if ( positive ) { - handled = true; 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 ); } } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java index 8bc0e61a4..71685c353 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java @@ -122,6 +122,7 @@ public class DlgDelegate { ENABLE_SMS_DO, ENABLE_BT_DO, ENABLE_RELAY_DO, + ENABLE_RELAY_DO_OR, DISABLE_RELAY_DO, }