don't show "send pending messages" menuitem when there are none

This commit is contained in:
Eric House 2014-03-01 16:15:35 -08:00
parent 386c28e596
commit 9d174740c8
5 changed files with 8 additions and 1 deletions

View file

@ -1408,6 +1408,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1getGi
static const SetInfo gsi_ints[] = {
ARR_MEMBER( GameStateInfo, visTileCount ),
ARR_MEMBER( GameStateInfo, nPendingMessages ),
ARR_MEMBER( GameStateInfo, trayVisState ),
};
static const SetInfo gsi_bools[] = {

View file

@ -805,8 +805,10 @@ public class BoardActivity extends XWActivity
boolean enable = null != m_gi
&& DeviceRole.SERVER_STANDALONE != m_gi.serverRole;
Utils.setItemVisible( menu, R.id.board_menu_game_resend, enable );
Utils.setItemVisible( menu, R.id.gamel_menu_checkmoves, enable );
Utils.setItemVisible( menu, R.id.board_menu_game_resend,
enable && null != m_gsi &&
0 < m_gsi.nPendingMessages );
enable = enable && BuildConfig.DEBUG;
Utils.setItemVisible( menu, R.id.board_menu_game_netstats, enable );

View file

@ -104,6 +104,7 @@ public class JNIThread extends Thread {
public class GameStateInfo implements Cloneable {
public int visTileCount;
public int trayVisState;
public int nPendingMessages;
public boolean canHint;
public boolean canUndo;
public boolean canRedo;

View file

@ -330,6 +330,8 @@ game_getState( const XWGame* game, GameStateInfo* gsi )
gsi->canShuffle = board_canShuffle( board );
gsi->canHideRack = board_canHideRack( board );
gsi->canTrade = board_canTrade( board );
gsi->nPendingMessages = !!game->comms ?
comms_countPendingPackets(game->comms) : 0;
}
void

View file

@ -34,6 +34,7 @@ extern "C" {
typedef struct _GameStateInfo {
XP_U16 visTileCount;
XP_U16 nPendingMessages;
XW_TrayVisState trayVisState;
XP_Bool canHint;
XP_Bool canUndo;