From e22479ba03b5f809358278ebd06f1c08e25c5097 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Fri, 2 Jul 2010 07:04:37 -0700 Subject: [PATCH] add "play game" item to context menu, and invoke that menu on item click. This fixes problem with users apparently not knowing about long-tap and context menu and so not knowing they can configure a game. Unfortunately I can't figure out how to disable long-tap also bringing up the context menu. Yet another preference might be the fix. --- .../XWords4/res/menu/games_list_item_menu.xml | 6 ++-- .../android/XWords4/res/values/strings.xml | 1 + .../org/eehouse/android/xw4/GamesList.java | 29 ++++++++++--------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/xwords4/android/XWords4/res/menu/games_list_item_menu.xml b/xwords4/android/XWords4/res/menu/games_list_item_menu.xml index 6261d9588..874575d1a 100644 --- a/xwords4/android/XWords4/res/menu/games_list_item_menu.xml +++ b/xwords4/android/XWords4/res/menu/games_list_item_menu.xml @@ -1,9 +1,9 @@ - - - + diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index f4cefd8d5..660f9e9a7 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -19,6 +19,7 @@ Add game Add game + Play game Game settings Hide Delete diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java index 4a97f55e0..2c2036889 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -177,6 +177,15 @@ public class GamesList extends ListActivity { showDialog( WARN_NODICT ); } else { switch ( id ) { + case R.id.list_item_play: + File file = new File( path ); + Uri uri = Uri.fromFile( file ); + Intent intent = new Intent( Intent.ACTION_EDIT, uri, + this, BoardActivity.class ); + startActivity( intent ); + m_invalPath = path; + break; + case R.id.list_item_config: doConfig( path ); invalPath = path; @@ -269,21 +278,13 @@ public class GamesList extends ListActivity { } @Override - protected void onListItemClick(ListView l, View v, int position, long id) + protected void onListItemClick( ListView l, View v, int position, long id ) { - String[] missingDict = new String[1]; - if ( ! GameUtils.gameDictHere( this, position, missingDict ) ) { - m_missingDict = missingDict[0]; - showDialog( WARN_NODICT ); - } else { - String path = GameUtils.gamesList(this)[position]; - File file = new File( path ); - Uri uri = Uri.fromFile( file ); - Intent intent = new Intent( Intent.ACTION_EDIT, uri, - this, BoardActivity.class ); - startActivity( intent ); - m_invalPath = path; - } + // Might want a preference that, when set, just opens game + // instead of bringing up the list. But that shouldn't be the + // default: new users don't know about long-taps. + super.onListItemClick( l, v, position, id ); + v.showContextMenu(); } private void doConfig( String path )