make menu id names more consistent

This commit is contained in:
Eric House 2013-10-25 07:15:43 -07:00
parent 788102b5f6
commit 3067b5f9c1
2 changed files with 71 additions and 71 deletions

View file

@ -1,102 +1,102 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/gamel_menu_newgame" <item android:id="@+id/games_menu_newgame"
android:title="@string/button_new_game" android:title="@string/button_new_game"
android:icon="@drawable/content_new__gen" android:icon="@drawable/content_new__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/gamel_menu_newgroup" <item android:id="@+id/games_menu_newgroup"
android:title="@string/button_new_group" android:title="@string/button_new_group"
android:icon="@drawable/new_group__gen" android:icon="@drawable/new_group__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/gamel_menu_prefs" <item android:id="@+id/games_menu_prefs"
android:title="@string/menu_prefs" android:title="@string/menu_prefs"
android:icon="@drawable/prefs__gen" android:icon="@drawable/prefs__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/gamel_menu_dicts" <item android:id="@+id/games_menu_dicts"
android:title="@string/gamel_menu_dicts" android:title="@string/gamel_menu_dicts"
android:icon="@drawable/dict__gen" android:icon="@drawable/dict__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/gamel_menu_email" <item android:id="@+id/games_menu_email"
android:title="@string/board_menu_file_email" android:title="@string/board_menu_file_email"
android:icon="@drawable/email__gen" android:icon="@drawable/email__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/gamel_menu_about" <item android:id="@+id/games_menu_about"
android:title="@string/board_menu_file_about" android:title="@string/board_menu_file_about"
android:icon="@android:drawable/ic_menu_info_details" android:icon="@android:drawable/ic_menu_info_details"
/> />
<item android:id="@+id/gamel_menu_checkmoves" <item android:id="@+id/games_menu_checkmoves"
android:title="@string/gamel_menu_checkmoves" android:title="@string/gamel_menu_checkmoves"
android:icon="@drawable/stat_notify_sync" android:icon="@drawable/stat_notify_sync"
/> />
<!-- Game items --> <!-- Game items -->
<item android:id="@+id/gamel_menu_delete" <item android:id="@+id/games_game_delete"
android:title="@string/list_item_delete" android:title="@string/list_item_delete"
android:icon="@drawable/content_discard__gen" android:icon="@drawable/content_discard__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/listl_item_config" <item android:id="@+id/games_game_config"
android:title="@string/list_item_config" android:title="@string/list_item_config"
android:icon="@drawable/content_edit" android:icon="@drawable/content_edit"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/list_item_move" <item android:id="@+id/games_game_move"
android:title="@string/list_item_move" android:title="@string/list_item_move"
android:icon="@drawable/relabel__gen" android:icon="@drawable/relabel__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/list_item_reset" <item android:id="@+id/games_game_reset"
android:title="@string/list_item_reset" android:title="@string/list_item_reset"
android:icon="@drawable/reset__gen" android:icon="@drawable/reset__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/list_item_new_from" <item android:id="@+id/games_game_new_from"
android:title="@string/list_item_new_from" android:title="@string/list_item_new_from"
/> />
<item android:id="@+id/list_item_rename" <item android:id="@+id/games_game_rename"
android:title="@string/list_item_rename" android:title="@string/list_item_rename"
/> />
<item android:id="@+id/list_item_copy" <item android:id="@+id/games_game_copy"
android:title="@string/list_item_copy" android:title="@string/list_item_copy"
/> />
<!-- Group items --> <!-- Group items -->
<item android:id="@+id/list_group_moveup" <item android:id="@+id/games_group_moveup"
android:title="@string/list_group_moveup" android:title="@string/list_group_moveup"
android:icon="@drawable/up__gen" android:icon="@drawable/up__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/list_group_movedown" <item android:id="@+id/games_group_movedown"
android:title="@string/list_group_movedown" android:title="@string/list_group_movedown"
android:icon="@drawable/down__gen" android:icon="@drawable/down__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/list_group_delete" <item android:id="@+id/games_group_delete"
android:title="@string/list_group_delete" android:title="@string/list_group_delete"
android:icon="@drawable/content_discard__gen" android:icon="@drawable/content_discard__gen"
android:showAsAction="ifRoom" android:showAsAction="ifRoom"
/> />
<item android:id="@+id/list_group_default" <item android:id="@+id/games_group_default"
android:title="@string/list_group_default" android:title="@string/list_group_default"
/> />
<item android:id="@+id/list_group_rename" <item android:id="@+id/games_group_rename"
android:title="@string/list_group_rename" android:title="@string/list_group_rename"
/> />
<!-- Debug only menuitems --> <!-- Debug only menuitems -->
<item android:id="@+id/gamel_menu_checkupdates" <item android:id="@+id/games_menu_checkupdates"
android:title="@string/gamel_menu_checkupdates" android:title="@string/gamel_menu_checkupdates"
/> />
<item android:id="@+id/gamel_menu_storedb" <item android:id="@+id/games_menu_storedb"
android:title="@string/gamel_menu_storedb" android:title="@string/gamel_menu_storedb"
/> />
<item android:id="@+id/gamel_menu_loaddb" <item android:id="@+id/games_menu_loaddb"
android:title="@string/gamel_menu_loaddb" android:title="@string/gamel_menu_loaddb"
/> />

View file

@ -95,27 +95,27 @@ public class GamesList extends XWExpandableListActivity
}; };
private static final int[] DEBUGITEMS = { private static final int[] DEBUGITEMS = {
R.id.gamel_menu_loaddb, R.id.games_menu_loaddb,
R.id.gamel_menu_storedb, R.id.games_menu_storedb,
R.id.gamel_menu_checkupdates, R.id.games_menu_checkupdates,
}; };
private static final int[] NOSEL_ITEMS = { private static final int[] NOSEL_ITEMS = {
R.id.gamel_menu_newgroup, R.id.games_menu_newgroup,
R.id.gamel_menu_prefs, R.id.games_menu_prefs,
R.id.gamel_menu_dicts, R.id.games_menu_dicts,
R.id.gamel_menu_about, R.id.games_menu_about,
R.id.gamel_menu_email, R.id.games_menu_email,
R.id.gamel_menu_checkmoves, R.id.games_menu_checkmoves,
}; };
private static final int[] ONEGAME_ITEMS = { private static final int[] ONEGAME_ITEMS = {
R.id.listl_item_config, R.id.games_game_config,
R.id.list_item_rename, R.id.games_game_rename,
R.id.list_item_new_from, R.id.games_game_new_from,
R.id.list_item_copy, R.id.games_game_copy,
}; };
private static final int[] ONEGROUP_ITEMS = { private static final int[] ONEGROUP_ITEMS = {
R.id.list_group_rename, R.id.games_group_rename,
}; };
private static boolean s_firstShown = false; private static boolean s_firstShown = false;
@ -671,7 +671,7 @@ public class GamesList extends XWExpandableListActivity
} }
if ( visible && !DBUtils.gameDBExists( this ) ) { if ( visible && !DBUtils.gameDBExists( this ) ) {
Utils.setItemVisible( menu, R.id.gamel_menu_loaddb, false ); Utils.setItemVisible( menu, R.id.games_menu_loaddb, false );
} }
for ( int id : NOSEL_ITEMS ) { for ( int id : NOSEL_ITEMS ) {
@ -696,31 +696,31 @@ public class GamesList extends XWExpandableListActivity
long selID = m_adapter.getGroupIDFor( selGroupPos ); long selID = m_adapter.getGroupIDFor( selGroupPos );
defaultAvail = selID != XWPrefs.getDefaultNewGameGroup( this ); defaultAvail = selID != XWPrefs.getDefaultNewGameGroup( this );
} }
Utils.setItemVisible( menu, R.id.list_group_default, defaultAvail ); Utils.setItemVisible( menu, R.id.games_group_default, defaultAvail );
Utils.setItemVisible( menu, R.id.list_group_delete, defaultAvail ); Utils.setItemVisible( menu, R.id.games_group_delete, defaultAvail );
// Move up/down enabled for groups if not the top-most or bottommost // Move up/down enabled for groups if not the top-most or bottommost
// selected // selected
boolean enable = 0 < selGroupPos; boolean enable = 0 < selGroupPos;
Utils.setItemVisible( menu, R.id.list_group_moveup, enable ); Utils.setItemVisible( menu, R.id.games_group_moveup, enable );
enable = 0 <= selGroupPos && selGroupPos + 1 < m_adapter.getGroupCount(); enable = 0 <= selGroupPos && selGroupPos + 1 < m_adapter.getGroupCount();
Utils.setItemVisible( menu, R.id.list_group_movedown, enable ); Utils.setItemVisible( menu, R.id.games_group_movedown, enable );
// New game available when nothing selected or one group // New game available when nothing selected or one group
Utils.setItemVisible( menu, R.id.gamel_menu_newgame, Utils.setItemVisible( menu, R.id.games_menu_newgame,
nothingSelected || 1 == nGroupsSelected ); nothingSelected || 1 == nGroupsSelected );
// Multiples can be deleted // Multiples can be deleted
Utils.setItemVisible( menu, R.id.gamel_menu_delete, Utils.setItemVisible( menu, R.id.games_game_delete,
0 < nGamesSelected ); 0 < nGamesSelected );
Utils.setItemVisible( menu, R.id.list_group_delete, Utils.setItemVisible( menu, R.id.games_group_delete,
0 < nGroupsSelected ); 0 < nGroupsSelected );
// multiple games can be regrouped/reset. (Later....) // multiple games can be regrouped/reset. (Later....)
Utils.setItemVisible( menu, R.id.list_item_move, Utils.setItemVisible( menu, R.id.games_game_move,
(1 < m_adapter.getGroupCount() (1 < m_adapter.getGroupCount()
&& 0 < nGamesSelected) ); && 0 < nGamesSelected) );
Utils.setItemVisible( menu, R.id.list_item_reset, 0 < nGamesSelected ); Utils.setItemVisible( menu, R.id.games_game_reset, 0 < nGamesSelected );
m_menuPrepared = super.onPrepareOptionsMenu( menu ); m_menuPrepared = super.onPrepareOptionsMenu( menu );
} else { } else {
@ -748,20 +748,24 @@ public class GamesList extends XWExpandableListActivity
} }
switch ( item.getItemId() ) { switch ( item.getItemId() ) {
case R.id.gamel_menu_newgame: case R.id.games_menu_newgame:
startNewGameActivity( groupID ); startNewGameActivity( groupID );
break; break;
case R.id.gamel_menu_newgroup: case R.id.games_menu_newgroup:
showDialog( NEW_GROUP ); showDialog( NEW_GROUP );
break; break;
case R.id.listl_item_config: case R.id.games_game_config:
long rowid = m_selGames.iterator().next(); long rowid = m_selGames.iterator().next();
GameUtils.doConfig( this, rowid, GameConfig.class ); GameUtils.doConfig( this, rowid, GameConfig.class );
break; break;
case R.id.gamel_menu_delete: case R.id.games_menu_dicts:
DictsActivity.start( this );
break;
case R.id.games_game_delete:
keepSels = true; keepSels = true;
String msg = Utils.format( this, R.string.confirm_seldeletesf, String msg = Utils.format( this, R.string.confirm_seldeletesf,
selRowIDs.length ); selRowIDs.length );
@ -769,42 +773,38 @@ public class GamesList extends XWExpandableListActivity
GamesActions.DELETE_GAMES.ordinal(), selRowIDs ); GamesActions.DELETE_GAMES.ordinal(), selRowIDs );
break; break;
case R.id.gamel_menu_dicts: case R.id.games_menu_checkmoves:
DictsActivity.start( this );
break;
case R.id.gamel_menu_checkmoves:
showNotAgainDlgThen( R.string.not_again_sync, showNotAgainDlgThen( R.string.not_again_sync,
R.string.key_notagain_sync, R.string.key_notagain_sync,
GamesActions.SYNC_MENU.ordinal() ); GamesActions.SYNC_MENU.ordinal() );
break; break;
case R.id.gamel_menu_checkupdates: case R.id.games_menu_checkupdates:
UpdateCheckReceiver.checkVersions( this, true ); UpdateCheckReceiver.checkVersions( this, true );
break; break;
case R.id.gamel_menu_prefs: case R.id.games_menu_prefs:
Utils.launchSettings( this ); Utils.launchSettings( this );
break; break;
case R.id.gamel_menu_about: case R.id.games_menu_about:
showAboutDialog(); showAboutDialog();
break; break;
case R.id.gamel_menu_email: case R.id.games_menu_email:
Utils.emailAuthor( this ); Utils.emailAuthor( this );
break; break;
case R.id.gamel_menu_loaddb: case R.id.games_menu_loaddb:
DBUtils.loadDB( this ); DBUtils.loadDB( this );
changeContent = true; changeContent = true;
break; break;
case R.id.gamel_menu_storedb: case R.id.games_menu_storedb:
DBUtils.saveDB( this ); DBUtils.saveDB( this );
break; break;
// Game menus // Game menus
case R.id.list_item_move: case R.id.games_game_move:
keepSels = true; keepSels = true;
if ( 1 >= m_adapter.getGroupCount() ) { if ( 1 >= m_adapter.getGroupCount() ) {
showOKOnlyDialog( R.string.no_move_onegroup ); showOKOnlyDialog( R.string.no_move_onegroup );
@ -813,13 +813,13 @@ public class GamesList extends XWExpandableListActivity
showDialog( CHANGE_GROUP ); showDialog( CHANGE_GROUP );
} }
break; break;
case R.id.list_item_new_from: case R.id.games_game_new_from:
showNotAgainDlgThen( R.string.not_again_newfrom, showNotAgainDlgThen( R.string.not_again_newfrom,
R.string.key_notagain_newfrom, R.string.key_notagain_newfrom,
GamesActions.NEW_FROM.ordinal(), GamesActions.NEW_FROM.ordinal(),
selRowIDs[0] ); selRowIDs[0] );
break; break;
case R.id.list_item_copy: case R.id.games_game_copy:
GameSummary summary = DBUtils.getSummary( this, selRowIDs[0] ); GameSummary summary = DBUtils.getSummary( this, selRowIDs[0] );
if ( summary.inNetworkGame() ) { if ( summary.inNetworkGame() ) {
showOKOnlyDialog( R.string.no_copy_network ); showOKOnlyDialog( R.string.no_copy_network );
@ -832,20 +832,20 @@ public class GamesList extends XWExpandableListActivity
} }
break; break;
case R.id.list_item_reset: case R.id.games_game_reset:
keepSels = true; keepSels = true;
showConfirmThen( R.string.confirm_reset, R.string.button_reset, showConfirmThen( R.string.confirm_reset, R.string.button_reset,
GamesActions.RESET_GAMES.ordinal(), selRowIDs ); GamesActions.RESET_GAMES.ordinal(), selRowIDs );
break; break;
case R.id.list_item_rename: case R.id.games_game_rename:
keepSels = true; keepSels = true;
m_rowid = selRowIDs[0]; m_rowid = selRowIDs[0];
showDialog( RENAME_GAME ); showDialog( RENAME_GAME );
break; break;
// Group menus // Group menus
case R.id.list_group_delete: case R.id.games_group_delete:
keepSels = true; keepSels = true;
long dftGroup = XWPrefs.getDefaultNewGameGroup( this ); long dftGroup = XWPrefs.getDefaultNewGameGroup( this );
if ( m_selGroupIDs.contains( dftGroup ) ) { if ( m_selGroupIDs.contains( dftGroup ) ) {
@ -870,19 +870,19 @@ public class GamesList extends XWExpandableListActivity
groupIDs ); groupIDs );
} }
break; break;
case R.id.list_group_default: case R.id.games_group_default:
XWPrefs.setDefaultNewGameGroup( this, groupID ); XWPrefs.setDefaultNewGameGroup( this, groupID );
keepSels = true; keepSels = true;
break; break;
case R.id.list_group_rename: case R.id.games_group_rename:
m_groupid = groupID; m_groupid = groupID;
showDialog( RENAME_GROUP ); showDialog( RENAME_GROUP );
break; break;
case R.id.list_group_moveup: case R.id.games_group_moveup:
changeContent = m_adapter.moveGroup( groupID, -1 ); changeContent = m_adapter.moveGroup( groupID, -1 );
keepSels = true; keepSels = true;
break; break;
case R.id.list_group_movedown: case R.id.games_group_movedown:
changeContent = m_adapter.moveGroup( groupID, 1 ); changeContent = m_adapter.moveGroup( groupID, 1 );
keepSels = true; keepSels = true;
break; break;