support reset of multiple games

This commit is contained in:
Eric House 2013-10-23 07:56:36 -07:00
parent 76bbdafadd
commit ea4a2ea609
2 changed files with 13 additions and 12 deletions

View file

@ -167,9 +167,9 @@
<!-- Text of confirmation dialog posted when list_item_reset menu
is selected -->
<string name="confirm_reset">Are you sure you want to reset this
game? Resetting erases all moves and any connection
information.</string>
<string name="confirm_reset">Are you sure you want to reset the
selected game[s]? (Resetting erases all moves and any connection
information.)</string>
<!--
############################################################
@ -2156,7 +2156,7 @@
<string name="square_tiles">Square rack tiles</string>
<string name="square_tiles_summary">Even if they can be taller</string>
<string name="change_groupf">Move game %s</string>
<string name="change_group">Move games</string>
<string name="show_wordlist_browser">Wordlist browser</string>

View file

@ -85,7 +85,7 @@ public class GamesList extends XWExpandableListActivity
private static final String ALERT_MSG = "alert_msg";
private static enum GamesActions { NEW_NET_GAME,
RESET_GAME,
RESET_GAMES,
SYNC_MENU,
NEW_FROM,
DELETE_GAMES,
@ -569,8 +569,11 @@ public class GamesList extends XWExpandableListActivity
makeNewNetGameIf();
}
break;
case RESET_GAME:
GameUtils.resetGame( this, m_rowid );
case RESET_GAMES:
long[] rowids = (long[])params[0];
for ( long rowid : rowids ) {
GameUtils.resetGame( this, rowid );
}
onContentChanged(); // required because position may change
break;
case SYNC_MENU:
@ -694,7 +697,7 @@ public class GamesList extends XWExpandableListActivity
Utils.setItemVisible( menu, R.id.list_item_move,
(1 < m_adapter.getGroupCount()
&& 0 < nGamesSelected) );
Utils.setItemVisible( menu, R.id.list_item_reset, 1 == nGamesSelected );
Utils.setItemVisible( menu, R.id.list_item_reset, 0 < nGamesSelected );
m_menuPrepared = super.onPrepareOptionsMenu( menu );
} else {
@ -803,10 +806,8 @@ public class GamesList extends XWExpandableListActivity
break;
case R.id.list_item_reset:
m_rowid = selRowIDs[0];
showConfirmThen( R.string.confirm_reset,
R.string.button_reset,
GamesActions.RESET_GAME.ordinal() );
showConfirmThen( R.string.confirm_reset, R.string.button_reset,
GamesActions.RESET_GAMES.ordinal(), selRowIDs );
break;
case R.id.list_item_rename: