change text of menu from hide rack to show rack depending on hidden state

This commit is contained in:
Eric House 2012-06-05 22:19:44 -07:00 committed by Eric House
parent 78dfd6267c
commit 5d9381e1bc
4 changed files with 17 additions and 5 deletions

View file

@ -19,8 +19,6 @@
/> />
<item android:id="@+id/board_menu_tray" <item android:id="@+id/board_menu_tray"
android:title="@string/board_menu_tray"
android:alphabeticShortcut="H"
/> />
<item android:title="@string/board_submenu_game"> <item android:title="@string/board_submenu_game">

View file

@ -655,7 +655,8 @@
room for the full board and tray to be shown then hiding the room for the full board and tray to be shown then hiding the
tray just "turns it over", i.e. shows tiles with '?' tray just "turns it over", i.e. shows tiles with '?'
characters.--> characters.-->
<string name="board_menu_tray">Hide rack</string> <string name="board_menu_tray_hide">Hide rack</string>
<string name="board_menu_tray_show">Show rack</string>
<!-- Undos the last *committed* turn. Note that this is different <!-- Undos the last *committed* turn. Note that this is different
from the undo button that undoes or redoes an in-progress from the undo button that undoes or redoes an in-progress

View file

@ -614,15 +614,24 @@ public class BoardActivity extends XWActivity
{ {
super.onPrepareOptionsMenu( menu ); super.onPrepareOptionsMenu( menu );
boolean inTrade = false; boolean inTrade = false;
MenuItem item;
int strId;
if ( null != m_gsi ) { if ( null != m_gsi ) {
inTrade = m_gsi.inTrade; inTrade = m_gsi.inTrade;
menu.setGroupVisible( R.id.group_done, !inTrade ); menu.setGroupVisible( R.id.group_done, !inTrade );
if ( UtilCtxt.TRAY_REVEALED == m_gsi.trayVisState ) {
strId = R.string.board_menu_tray_hide;
} else {
strId = R.string.board_menu_tray_show;
}
item = menu.findItem( R.id.board_menu_tray );
item.setTitle( strId );
} }
if ( !inTrade ) { if ( !inTrade ) {
MenuItem item = menu.findItem( R.id.board_menu_done ); item = menu.findItem( R.id.board_menu_done );
int strId;
if ( 0 >= m_view.curPending() ) { if ( 0 >= m_view.curPending() ) {
strId = R.string.board_menu_pass; strId = R.string.board_menu_pass;
} else { } else {

View file

@ -27,6 +27,10 @@ public interface UtilCtxt {
static final int BONUS_TRIPLE_LETTER = 3; static final int BONUS_TRIPLE_LETTER = 3;
static final int BONUS_TRIPLE_WORD = 4; static final int BONUS_TRIPLE_WORD = 4;
public static final int TRAY_HIDDEN = 0;
public static final int TRAY_REVERSED = 1;
public static final int TRAY_REVEALED = 2;
// must match defns in util.h // must match defns in util.h
public static final int PICKER_PICKALL = -1; public static final int PICKER_PICKALL = -1;
public static final int PICKER_BACKUP = -2; public static final int PICKER_BACKUP = -2;