mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
don't post RemoteDeleted Alert more than once
This commit is contained in:
parent
a95e761024
commit
af7f776118
1 changed files with 23 additions and 17 deletions
|
@ -263,7 +263,6 @@ public class BoardDelegate extends DelegateBase
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLG_DELETED: {
|
case DLG_DELETED: {
|
||||||
final int gameID = (Integer)params[0];
|
|
||||||
String gameName = GameUtils.getName( m_activity, m_rowid );
|
String gameName = GameUtils.getName( m_activity, m_rowid );
|
||||||
ab = ab.setTitle( R.string.query_title )
|
ab = ab.setTitle( R.string.query_title )
|
||||||
.setMessage( getString( R.string.msg_dev_deleted_fmt, gameName ) )
|
.setMessage( getString( R.string.msg_dev_deleted_fmt, gameName ) )
|
||||||
|
@ -272,7 +271,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
@Override
|
@Override
|
||||||
public void onClick( DialogInterface dlg,
|
public void onClick( DialogInterface dlg,
|
||||||
int whichButton ) {
|
int whichButton ) {
|
||||||
deleteAndClose( gameID );
|
deleteAndClose();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ab.setNegativeButton( R.string.button_delete, lstnr );
|
ab.setNegativeButton( R.string.button_delete, lstnr );
|
||||||
|
@ -430,6 +429,21 @@ public class BoardDelegate extends DelegateBase
|
||||||
return dialog;
|
return dialog;
|
||||||
} // makeDialog
|
} // makeDialog
|
||||||
|
|
||||||
|
private boolean mDeletePosted;
|
||||||
|
private void postDeleteOnce()
|
||||||
|
{
|
||||||
|
if ( !mDeletePosted ) {
|
||||||
|
// PENDING: could clear this if user says "ok" rather than "delete"
|
||||||
|
mDeletePosted = true;
|
||||||
|
post( new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
showDialogFragment( DlgID.DLG_DELETED );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class InviteAlertState implements Serializable {
|
private static class InviteAlertState implements Serializable {
|
||||||
GameSummary summary;
|
GameSummary summary;
|
||||||
CurGameInfo gi;
|
CurGameInfo gi;
|
||||||
|
@ -1180,7 +1194,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
dropConViaAndRestart( CommsConnType.COMMS_CONN_RELAY );
|
dropConViaAndRestart( CommsConnType.COMMS_CONN_RELAY );
|
||||||
break;
|
break;
|
||||||
case DELETE_AND_EXIT:
|
case DELETE_AND_EXIT:
|
||||||
deleteAndClose( m_gi.gameID );
|
deleteAndClose();
|
||||||
break;
|
break;
|
||||||
case DROP_SMS_ACTION: // do nothing; work done in onNegButton case
|
case DROP_SMS_ACTION: // do nothing; work done in onNegButton case
|
||||||
alertOrderIncrIfAt( StartAlertOrder.NBS_PERMS );
|
alertOrderIncrIfAt( StartAlertOrder.NBS_PERMS );
|
||||||
|
@ -1441,12 +1455,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
case MESSAGE_NOGAME:
|
case MESSAGE_NOGAME:
|
||||||
final int gameID = (Integer)args[0];
|
final int gameID = (Integer)args[0];
|
||||||
if ( null != m_gi && gameID == m_gi.gameID && !isFinishing() ) {
|
if ( null != m_gi && gameID == m_gi.gameID && !isFinishing() ) {
|
||||||
post( new Runnable() {
|
postDeleteOnce();
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
showDialogFragment( DlgID.DLG_DELETED, gameID );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1543,8 +1552,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
case DEADGAME:
|
case DEADGAME:
|
||||||
case DELETED:
|
case DELETED:
|
||||||
params = new Object[] { m_gi.gameID };
|
postDeleteOnce();
|
||||||
dlgID = DlgID.DLG_DELETED;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OLDFLAGS:
|
case OLDFLAGS:
|
||||||
|
@ -1682,14 +1690,12 @@ public class BoardDelegate extends DelegateBase
|
||||||
SMSInviteDelegate.launchForResult( m_activity, nMissing, info, code );
|
SMSInviteDelegate.launchForResult( m_activity, nMissing, info, code );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteAndClose( int gameID )
|
private void deleteAndClose()
|
||||||
{
|
{
|
||||||
if ( null != m_gi && gameID == m_gi.gameID ) {
|
if ( null == m_jniThread ) { // test probably no longer necessary
|
||||||
if ( null != m_jniThread ) {
|
Assert.failDbg();
|
||||||
GameUtils.deleteGame( m_activity, m_jniThread.getLock(), false, false );
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Log.e( TAG, "deleteAndClose() called with wrong gameID %d", gameID );
|
GameUtils.deleteGame( m_activity, m_jniThread.getLock(), false, false );
|
||||||
}
|
}
|
||||||
waitCloseGame( false );
|
waitCloseGame( false );
|
||||||
finish();
|
finish();
|
||||||
|
|
Loading…
Add table
Reference in a new issue