From e9bdf3c4f86b47d39ece17041d866aa689617887 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 13 Nov 2013 19:00:34 -0800 Subject: [PATCH] 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. --- .../eehouse/android/xw4/BoardActivity.java | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 3351eda46..541821b14 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -558,14 +558,8 @@ public class BoardActivity extends XWActivity // XWTimerReason m_view = (BoardView)findViewById( R.id.board_view ); m_tradeButtons = findViewById( R.id.exchange_buttons ); - m_exchCommmitButton = (Button)findViewById( R.id.exchange_commit ); - if ( null != m_exchCommmitButton ) { - m_exchCommmitButton.setOnClickListener( this ); - } - m_exchCancelButton = (Button)findViewById( R.id.exchange_cancel ); - if ( null != m_exchCancelButton ) { - m_exchCancelButton.setOnClickListener( this ); - } + m_exchCommmitButton = setListenerOrHide( R.id.exchange_commit ); + m_exchCancelButton = setListenerOrHide( R.id.exchange_cancel ); m_volKeysZoom = XWPrefs.getVolKeysZoom( this ); Intent intent = getIntent(); @@ -755,6 +749,8 @@ public class BoardActivity extends XWActivity inTrade && m_gsi.tradeTilesSelected ); Utils.setItemVisible( menu, R.id.board_menu_trade, !m_gameOver && !inTrade ); + Utils.setItemVisible( menu, R.id.board_menu_game_resign, !inTrade ); + if ( !inTrade ) { boolean enabled = null == m_gsi || m_gsi.curTurnSelected; item = menu.findItem( R.id.board_menu_done ); @@ -767,12 +763,11 @@ public class BoardActivity extends XWActivity } item.setTitle( strId ); } - } - - 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 ); + 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 ); + } } if ( null != m_gi && DeviceRole.SERVER_STANDALONE == m_gi.serverRole ) { @@ -2250,5 +2245,18 @@ public class BoardActivity extends XWActivity startActivity( intent ); 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