add title to context menu that includes game name

This commit is contained in:
Andy2 2011-08-04 18:16:32 -07:00
parent 97d5e3cc6d
commit e8b66e230c
2 changed files with 10 additions and 1 deletions

View file

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- -*- compile-command: "../../; make install"; -*- -->
<!-- -*- compile-command: "cd ../../; ant install"; -*- -->
<resources>
<string name="button_new_game">Add game</string>
<string name="game_item_menu_titlef">\"%s\" actions:</string>
<string name="list_item_config">Game settings...</string>
<string name="list_item_rename">Rename...</string>
<string name="game_rename_title">Rename game</string>

View file

@ -379,6 +379,14 @@ public class GamesList extends XWListActivity
{
MenuInflater inflater = getMenuInflater();
inflater.inflate( R.menu.games_list_item_menu, menu );
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo)menuInfo;
int position = info.position;
long rowid = DBUtils.gamesList( this )[position];
String title = GameUtils.getName( this, rowid );
String fmt = getString(R.string.game_item_menu_titlef );
menu.setHeaderTitle( String.format( fmt, title ) );
}
@Override