don't show trade buttons when have actionbar since they're redundant

and the AB icons are visible; hide resign menuitem when in trade mode.
This commit is contained in:
Eric House 2013-11-13 19:00:34 -08:00
parent 3b5bc3a786
commit e9bdf3c4f8

View file

@ -558,14 +558,8 @@ public class BoardActivity extends XWActivity
// XWTimerReason // XWTimerReason
m_view = (BoardView)findViewById( R.id.board_view ); m_view = (BoardView)findViewById( R.id.board_view );
m_tradeButtons = findViewById( R.id.exchange_buttons ); m_tradeButtons = findViewById( R.id.exchange_buttons );
m_exchCommmitButton = (Button)findViewById( R.id.exchange_commit ); m_exchCommmitButton = setListenerOrHide( R.id.exchange_commit );
if ( null != m_exchCommmitButton ) { m_exchCancelButton = setListenerOrHide( R.id.exchange_cancel );
m_exchCommmitButton.setOnClickListener( this );
}
m_exchCancelButton = (Button)findViewById( R.id.exchange_cancel );
if ( null != m_exchCancelButton ) {
m_exchCancelButton.setOnClickListener( this );
}
m_volKeysZoom = XWPrefs.getVolKeysZoom( this ); m_volKeysZoom = XWPrefs.getVolKeysZoom( this );
Intent intent = getIntent(); Intent intent = getIntent();
@ -755,6 +749,8 @@ public class BoardActivity extends XWActivity
inTrade && m_gsi.tradeTilesSelected ); inTrade && m_gsi.tradeTilesSelected );
Utils.setItemVisible( menu, R.id.board_menu_trade, Utils.setItemVisible( menu, R.id.board_menu_trade,
!m_gameOver && !inTrade ); !m_gameOver && !inTrade );
Utils.setItemVisible( menu, R.id.board_menu_game_resign, !inTrade );
if ( !inTrade ) { if ( !inTrade ) {
boolean enabled = null == m_gsi || m_gsi.curTurnSelected; boolean enabled = null == m_gsi || m_gsi.curTurnSelected;
item = menu.findItem( R.id.board_menu_done ); item = menu.findItem( R.id.board_menu_done );
@ -767,13 +763,12 @@ public class BoardActivity extends XWActivity
} }
item.setTitle( strId ); item.setTitle( strId );
} }
}
if ( m_gameOver || DBUtils.gameOver( this, m_rowid ) ) { if ( m_gameOver || DBUtils.gameOver( this, m_rowid ) ) {
m_gameOver = true; m_gameOver = true;
item = menu.findItem( R.id.board_menu_game_resign ); item = menu.findItem( R.id.board_menu_game_resign );
item.setTitle( R.string.board_menu_game_final ); item.setTitle( R.string.board_menu_game_final );
} }
}
if ( null != m_gi && DeviceRole.SERVER_STANDALONE == m_gi.serverRole ) { if ( null != m_gi && DeviceRole.SERVER_STANDALONE == m_gi.serverRole ) {
Utils.setItemVisible( menu, R.id.board_menu_game_resend, false ); Utils.setItemVisible( menu, R.id.board_menu_game_resend, false );
@ -2251,4 +2246,17 @@ public class BoardActivity extends XWActivity
finish(); finish();
} }
private Button setListenerOrHide( int id )
{
Button button = (Button)findViewById( id );
if ( null != button ) {
if ( ABUtils.haveActionBar() ) {
button.setVisibility( View.GONE );
} else {
button.setOnClickListener( this );
}
}
return button;
}
} // class BoardActivity } // class BoardActivity