mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
add menus for small-screen devices to provide functionality others get
from toolbar.
This commit is contained in:
parent
7a6d4c870e
commit
a65e1dfa79
3 changed files with 157 additions and 9 deletions
89
xwords4/android/XWords4/res/menu-small/board_menu.xml
Normal file
89
xwords4/android/XWords4/res/menu-small/board_menu.xml
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group android:id="@+id/group_done">
|
||||
<!-- title set in BoardActivity -->
|
||||
<item android:id="@+id/board_menu_done"
|
||||
android:alphabeticShortcut="D"
|
||||
/>
|
||||
<item android:id="@+id/board_menu_trade"
|
||||
android:title="@string/board_menu_trade"
|
||||
android:alphabeticShortcut="T"
|
||||
/>
|
||||
</group>
|
||||
|
||||
<group android:id="@+id/group_exchange">
|
||||
<item android:id="@+id/board_menu_trade_commit"
|
||||
android:title="@string/button_trade_commit"
|
||||
/>
|
||||
<item android:id="@+id/board_menu_trade_cancel"
|
||||
android:title="@string/button_trade_cancel"
|
||||
/>
|
||||
</group>
|
||||
|
||||
<group android:id="@+id/group_hint">
|
||||
<item android:id="@+id/board_menu_hint_prev"
|
||||
android:title="@string/menu_hint_prev"
|
||||
/>
|
||||
<item android:id="@+id/board_menu_hint_next"
|
||||
android:title="@string/menu_hint_next"
|
||||
/>
|
||||
</group>
|
||||
|
||||
<item android:id="@+id/board_menu_tray"/>
|
||||
|
||||
<item android:id="@+id/board_menu_juggle"
|
||||
android:title="@string/menu_juggle"
|
||||
/>
|
||||
<item android:id="@+id/board_menu_flip"
|
||||
android:title="@string/menu_flip"
|
||||
/>
|
||||
|
||||
<item android:id="@+id/board_menu_undo_current"
|
||||
android:title="@string/board_menu_undo_current"
|
||||
/>
|
||||
|
||||
<item android:id="@+id/board_menu_undo_last"
|
||||
android:title="@string/board_menu_undo_last"
|
||||
/>
|
||||
|
||||
<item android:id="@+id/board_menu_zoom"
|
||||
android:title="@string/menu_zoom"
|
||||
/>
|
||||
<item android:id="@+id/board_menu_chat"
|
||||
android:title="@string/menu_chat"
|
||||
/>
|
||||
<item android:id="@+id/board_menu_toggle"
|
||||
android:title="@string/menu_toggle_values"
|
||||
/>
|
||||
|
||||
<item android:title="@string/board_submenu_game">
|
||||
<menu>
|
||||
<item android:id="@+id/board_menu_game_counts"
|
||||
android:title="@string/board_menu_game_counts" />
|
||||
<item android:id="@+id/board_menu_game_left"
|
||||
android:title="@string/board_menu_game_left" />
|
||||
<item android:id="@+id/board_menu_game_history"
|
||||
android:title="@string/board_menu_game_history" />
|
||||
<item android:id="@+id/board_menu_game_final"
|
||||
android:title="@string/board_menu_game_final" />
|
||||
<item android:id="@+id/board_menu_game_resend"
|
||||
android:title="@string/board_menu_game_resend" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item android:id="@+id/gamel_menu_checkmoves"
|
||||
android:title="@string/gamel_menu_checkmoves"
|
||||
/>
|
||||
|
||||
<item android:id="@+id/board_menu_file_prefs"
|
||||
android:title="@string/menu_prefs"
|
||||
android:alphabeticShortcut="P"
|
||||
/>
|
||||
<item android:id="@+id/board_menu_file_about"
|
||||
android:title="@string/board_menu_file_about"
|
||||
android:alphabeticShortcut="A"
|
||||
/>
|
||||
|
||||
</menu>
|
|
@ -1930,4 +1930,15 @@
|
|||
account with unlimited texting? Click cancel if you are not.</string>
|
||||
|
||||
<string name="remote_undone">Remote device undid a turn.</string>
|
||||
|
||||
<string name="menu_hint_prev">Prev hint</string>
|
||||
<string name="menu_hint_next">Next hint</string>
|
||||
<string name="board_menu_undo_current">Undo/Redo</string>
|
||||
<string name="menu_juggle">Juggle rack</string>
|
||||
<string name="menu_flip">Flip board</string>
|
||||
<string name="menu_zoom">Zoom in/out</string>
|
||||
<string name="menu_chat">Chat</string>
|
||||
<string name="menu_toggle_values">Toggle values</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -617,9 +617,12 @@ public class BoardActivity extends XWActivity
|
|||
MenuItem item;
|
||||
int strId;
|
||||
|
||||
updateMenus( menu );
|
||||
|
||||
if ( null != m_gsi ) {
|
||||
inTrade = m_gsi.inTrade;
|
||||
menu.setGroupVisible( R.id.group_done, !inTrade );
|
||||
menu.setGroupVisible( R.id.group_exchange, inTrade );
|
||||
|
||||
if ( UtilCtxt.TRAY_REVEALED == m_gsi.trayVisState ) {
|
||||
strId = R.string.board_menu_tray_hide;
|
||||
|
@ -656,12 +659,36 @@ public class BoardActivity extends XWActivity
|
|||
showNotAgainDlgThen( R.string.not_again_done,
|
||||
R.string.key_notagain_done, COMMIT_ACTION );
|
||||
break;
|
||||
// case R.id.board_menu_juggle:
|
||||
// cmd = JNIThread.JNICmd.CMD_JUGGLE;
|
||||
// break;
|
||||
// case R.id.board_menu_flip:
|
||||
// cmd = JNIThread.JNICmd.CMD_FLIP;
|
||||
// break;
|
||||
|
||||
case R.id.board_menu_trade_commit:
|
||||
cmd = JNIThread.JNICmd.CMD_COMMIT;
|
||||
break;
|
||||
case R.id.board_menu_trade_cancel:
|
||||
cmd = JNIThread.JNICmd.CMD_CANCELTRADE;
|
||||
break;
|
||||
|
||||
case R.id.board_menu_hint_prev:
|
||||
cmd = JNIThread.JNICmd.CMD_PREV_HINT;
|
||||
break;
|
||||
case R.id.board_menu_hint_next:
|
||||
cmd = JNIThread.JNICmd.CMD_NEXT_HINT;
|
||||
break;
|
||||
case R.id.board_menu_juggle:
|
||||
cmd = JNIThread.JNICmd.CMD_JUGGLE;
|
||||
break;
|
||||
case R.id.board_menu_flip:
|
||||
cmd = JNIThread.JNICmd.CMD_FLIP;
|
||||
break;
|
||||
case R.id.board_menu_zoom:
|
||||
cmd = JNIThread.JNICmd.CMD_TOGGLEZOOM;
|
||||
break;
|
||||
case R.id.board_menu_chat:
|
||||
startChatActivity();
|
||||
break;
|
||||
case R.id.board_menu_toggle:
|
||||
cmd = JNIThread.JNICmd.CMD_VALUES;
|
||||
break;
|
||||
|
||||
case R.id.board_menu_trade:
|
||||
showNotAgainDlgThen( R.string.not_again_trading,
|
||||
R.string.key_notagain_trading,
|
||||
|
@ -671,9 +698,9 @@ public class BoardActivity extends XWActivity
|
|||
case R.id.board_menu_tray:
|
||||
cmd = JNIThread.JNICmd.CMD_TOGGLE_TRAY;
|
||||
break;
|
||||
// case R.id.board_menu_undo_current:
|
||||
// cmd = JNIThread.JNICmd.CMD_UNDO_CUR;
|
||||
// break;
|
||||
case R.id.board_menu_undo_current:
|
||||
cmd = JNIThread.JNICmd.CMD_UNDO_CUR;
|
||||
break;
|
||||
case R.id.board_menu_undo_last:
|
||||
showConfirmThen( R.string.confirm_undo_last, UNDO_LAST_ACTION );
|
||||
break;
|
||||
|
@ -1825,6 +1852,27 @@ public class BoardActivity extends XWActivity
|
|||
null != m_gi.dictName( m_view.getCurPlayer() ) );
|
||||
}
|
||||
|
||||
private void hideShowItem( Menu menu, int id, boolean visible )
|
||||
{
|
||||
MenuItem item = menu.findItem( id );
|
||||
if ( null != item ) {
|
||||
item.setVisible( visible );
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMenus( Menu menu )
|
||||
{
|
||||
if ( null != m_gsi ) {
|
||||
hideShowItem( menu, R.id.board_menu_flip, m_gsi.visTileCount >= 1 );
|
||||
hideShowItem( menu, R.id.board_menu_toggle, m_gsi.visTileCount >= 1 );
|
||||
hideShowItem( menu, R.id.board_menu_juggle, m_gsi.canShuffle );
|
||||
hideShowItem( menu, R.id.board_menu_undo_current, m_gsi.canRedo );
|
||||
hideShowItem( menu, R.id.board_menu_hint_prev, m_gsi.canHint );
|
||||
hideShowItem( menu, R.id.board_menu_hint_next, m_gsi.canHint );
|
||||
hideShowItem( menu, R.id.board_menu_chat, m_gsi.gameIsConnected );
|
||||
}
|
||||
}
|
||||
|
||||
private void adjustTradeVisibility()
|
||||
{
|
||||
m_toolbar.setVisibility( m_inTrade? View.GONE : View.VISIBLE );
|
||||
|
|
Loading…
Reference in a new issue