mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
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.
This commit is contained in:
parent
9b3463c8e0
commit
e22479ba03
3 changed files with 19 additions and 17 deletions
|
@ -1,9 +1,9 @@
|
||||||
<?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/list_item_open" -->
|
<item android:id="@+id/list_item_play"
|
||||||
<!-- android:title="@string/list_item_open" -->
|
android:title="@string/list_item_play"
|
||||||
<!-- /> -->
|
/>
|
||||||
<item android:id="@+id/list_item_config"
|
<item android:id="@+id/list_item_config"
|
||||||
android:title="@string/list_item_config"
|
android:title="@string/list_item_config"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<string name="menu_insert">Add game</string>
|
<string name="menu_insert">Add game</string>
|
||||||
<string name="button_new_game">Add game</string>
|
<string name="button_new_game">Add game</string>
|
||||||
|
|
||||||
|
<string name="list_item_play">Play game</string>
|
||||||
<string name="list_item_config">Game settings</string>
|
<string name="list_item_config">Game settings</string>
|
||||||
<string name="list_item_hide">Hide</string>
|
<string name="list_item_hide">Hide</string>
|
||||||
<string name="list_item_delete">Delete</string>
|
<string name="list_item_delete">Delete</string>
|
||||||
|
|
|
@ -177,6 +177,15 @@ public class GamesList extends ListActivity {
|
||||||
showDialog( WARN_NODICT );
|
showDialog( WARN_NODICT );
|
||||||
} else {
|
} else {
|
||||||
switch ( id ) {
|
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:
|
case R.id.list_item_config:
|
||||||
doConfig( path );
|
doConfig( path );
|
||||||
invalPath = path;
|
invalPath = path;
|
||||||
|
@ -269,21 +278,13 @@ public class GamesList extends ListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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];
|
// Might want a preference that, when set, just opens game
|
||||||
if ( ! GameUtils.gameDictHere( this, position, missingDict ) ) {
|
// instead of bringing up the list. But that shouldn't be the
|
||||||
m_missingDict = missingDict[0];
|
// default: new users don't know about long-taps.
|
||||||
showDialog( WARN_NODICT );
|
super.onListItemClick( l, v, position, id );
|
||||||
} else {
|
v.showContextMenu();
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doConfig( String path )
|
private void doConfig( String path )
|
||||||
|
|
Loading…
Reference in a new issue