put the pass/turn done menuitem in the action bar as a first cut

This commit is contained in:
Eric House 2013-10-01 07:49:33 -07:00
parent c294ad45cf
commit ec77be8a2a
2 changed files with 18 additions and 7 deletions

View file

@ -6,6 +6,7 @@
<!-- title set in BoardActivity --> <!-- title set in BoardActivity -->
<item android:id="@+id/board_menu_done" <item android:id="@+id/board_menu_done"
android:alphabeticShortcut="D" android:alphabeticShortcut="D"
android:showAsAction="ifRoom"
/> />
<item android:id="@+id/board_menu_trade" <item android:id="@+id/board_menu_trade"
android:title="@string/board_menu_trade" android:title="@string/board_menu_trade"
@ -21,7 +22,8 @@
<item android:id="@+id/board_menu_tray" <item android:id="@+id/board_menu_tray"
/> />
<item android:title="@string/board_submenu_game"> <item android:id="@+id/board_submenu_game"
android:title="@string/board_submenu_game">
<menu> <menu>
<item android:id="@+id/board_menu_game_counts" <item android:id="@+id/board_menu_game_counts"
android:title="@string/board_menu_game_counts" /> android:title="@string/board_menu_game_counts" />

View file

@ -738,15 +738,22 @@ public class BoardActivity extends XWActivity
item.setTitle( strId ); item.setTitle( strId );
} }
Utils.setItemVisible( menu, R.id.board_menu_undo_last, !inTrade );
Utils.setItemVisible( menu, R.id.board_menu_tray, !inTrade );
Utils.setItemVisible( menu, R.id.board_submenu_game, !inTrade );
if ( !inTrade ) { if ( !inTrade ) {
boolean enabled = null == m_gsi || m_gsi.curTurnSelected;
item = menu.findItem( R.id.board_menu_done ); item = menu.findItem( R.id.board_menu_done );
if ( 0 >= m_view.curPending() ) { item.setVisible( enabled );
strId = R.string.board_menu_pass; if ( enabled ) {
} else { if ( 0 >= m_view.curPending() ) {
strId = R.string.board_menu_done; strId = R.string.board_menu_pass;
} else {
strId = R.string.board_menu_done;
}
item.setTitle( strId );
} }
item.setTitle( strId );
item.setEnabled( null == m_gsi || m_gsi.curTurnSelected );
} }
if ( m_gameOver || DBUtils.gameOver( this, m_rowid ) ) { if ( m_gameOver || DBUtils.gameOver( this, m_rowid ) ) {
@ -1796,6 +1803,8 @@ public class BoardActivity extends XWActivity
m_view.setInTrade( m_inTrade ); m_view.setInTrade( m_inTrade );
} }
adjustTradeVisibility(); adjustTradeVisibility();
Activity self = BoardActivity.this;
Utils.invalidateOptionsMenuIf( self );
} }
break; break;
case JNIThread.GOT_WORDS: case JNIThread.GOT_WORDS: