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 286e4b7ba..c48e674a6 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java @@ -106,6 +106,7 @@ public class BoardDelegate extends DelegateBase private String[] m_texts; private CommsConnType m_connType = CommsConnType.COMMS_CONN_NONE; private String[] m_missingDevs; + private boolean m_progressShown = false; private String m_curTiles; private boolean m_canUndoTiles; private boolean m_firingPrefs; @@ -1066,7 +1067,10 @@ public class BoardDelegate extends DelegateBase break; default: - stopProgress(); // in case it's a BT invite + if ( m_progressShown ) { + m_progressShown = false; + stopProgress(); // in case it's a BT invite + } super.eventOccurred( event, args ); break; } @@ -2196,7 +2200,15 @@ public class BoardDelegate extends DelegateBase case COMMS_CONN_BT: String progMsg = BTService.nameForAddr( dev ); progMsg = getString( R.string.invite_progress_fmt, progMsg ); - startProgress( R.string.invite_progress_title, progMsg ); + m_progressShown = true; + startProgress( R.string.invite_progress_title, progMsg, + new DialogInterface.OnCancelListener() { + public void + onCancel( DialogInterface dlg ) + { + m_progressShown = false; + } + }); BTService.inviteRemote( m_activity, dev, m_gi.gameID, gameName, m_gi.dictLang, diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java index 7b74d2c0f..b17d5a138 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java @@ -415,7 +415,7 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify, protected void startProgress( int titleID, int msgID ) { - m_delegate.startProgress( titleID, msgID ); + m_delegate.startProgress( titleID, msgID, null ); } protected void startProgress( int titleID, String msg ) @@ -423,11 +423,18 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify, m_delegate.startProgress( titleID, msg, null ); } - protected void startProgress( int titleID, int msgID, OnCancelListener lstnr ) + protected void startProgress( int titleID, int msgID, + OnCancelListener lstnr ) { m_delegate.startProgress( titleID, msgID, lstnr ); } + protected void startProgress( int titleID, String msg, + OnCancelListener lstnr ) + { + m_delegate.startProgress( titleID, msg, lstnr ); + } + protected void setProgressMsg( int id ) { m_delegate.setProgressMsg( id ); 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 7d2098821..aff7164b6 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java @@ -348,24 +348,19 @@ public class DlgDelegate { } } - public void startProgress( int titleID, int msgID ) + public void startProgress( int titleID, int msgID, OnCancelListener lstnr ) { - startProgress( titleID, msgID, null ); + startProgress( titleID, getString( msgID ), lstnr ); } - public void startProgress( int titleID, int msgID, OnCancelListener canLstnr ) - { - startProgress( titleID, getString( msgID ), canLstnr ); - } - - public void startProgress( int titleID, String msg, OnCancelListener canLstnr ) + public void startProgress( int titleID, String msg, OnCancelListener lstnr ) { String title = getString( titleID ); m_progress = ProgressDialog.show( m_activity, title, msg, true, true ); - if ( null != canLstnr ) { + if ( null != lstnr ) { m_progress.setCancelable( true ); - m_progress.setOnCancelListener( canLstnr ); + m_progress.setOnCancelListener( lstnr ); } }