change "resign" menu text once game is over

This commit is contained in:
Eric House 2012-10-08 07:09:44 -07:00
parent e64ecfb78d
commit ce58750b92
2 changed files with 13 additions and 0 deletions

View file

@ -140,6 +140,7 @@ public class BoardActivity extends XWActivity
private BoardUtilCtxt m_utils;
private int m_nMissingPlayers = -1;
private int m_invitesPending;
private boolean m_gameOver = false;
// call startActivityForResult synchronously
private Semaphore m_forResultWait = new Semaphore(0);
@ -650,6 +651,12 @@ public class BoardActivity extends XWActivity
item.setEnabled( null == m_gsi || m_gsi.curTurnSelected );
}
if ( m_gameOver || DBUtils.gameOver( this, m_rowid ) ) {
m_gameOver = true;
item = menu.findItem( R.id.board_menu_game_resign );
item.setTitle( R.string.board_menu_game_final );
}
return true;
}
@ -1494,6 +1501,7 @@ public class BoardActivity extends XWActivity
@Override
public void notifyGameOver()
{
m_gameOver = true;
m_jniThread.handle( JNIThread.JNICmd.CMD_POST_OVER );
}

View file

@ -421,6 +421,11 @@ public class DBUtils {
return 0 == getInt( context, rowid, DBHelper.CONTRACTED, 0 );
}
public static boolean gameOver( Context context, long rowid )
{
return 0 != getInt( context, rowid, DBHelper.GAME_OVER, 0 );
}
public static String getRelayID( Context context, long rowid )
{
String result = null;