mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
track whether invite progress is up and cancel only if it is
This commit is contained in:
parent
321a6e7e73
commit
0f90538598
3 changed files with 28 additions and 14 deletions
|
@ -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,
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue