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 <!-- Text of confirmation dialog posted when list_item_reset menu
is selected --> is selected -->
<string name="confirm_reset">Are you sure you want to reset this <string name="confirm_reset">Are you sure you want to reset the
game? Resetting erases all moves and any connection selected game[s]? (Resetting erases all moves and any connection
information.</string> information.)</string>
<!-- <!--
############################################################ ############################################################
@ -2156,7 +2156,7 @@
<string name="square_tiles">Square rack tiles</string> <string name="square_tiles">Square rack tiles</string>
<string name="square_tiles_summary">Even if they can be taller</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> <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 final String ALERT_MSG = "alert_msg";
private static enum GamesActions { NEW_NET_GAME, private static enum GamesActions { NEW_NET_GAME,
RESET_GAME, RESET_GAMES,
SYNC_MENU, SYNC_MENU,
NEW_FROM, NEW_FROM,
DELETE_GAMES, DELETE_GAMES,
@ -569,8 +569,11 @@ public class GamesList extends XWExpandableListActivity
makeNewNetGameIf(); makeNewNetGameIf();
} }
break; break;
case RESET_GAME: case RESET_GAMES:
GameUtils.resetGame( this, m_rowid ); long[] rowids = (long[])params[0];
for ( long rowid : rowids ) {
GameUtils.resetGame( this, rowid );
}
onContentChanged(); // required because position may change onContentChanged(); // required because position may change
break; break;
case SYNC_MENU: case SYNC_MENU:
@ -694,7 +697,7 @@ public class GamesList extends XWExpandableListActivity
Utils.setItemVisible( menu, R.id.list_item_move, Utils.setItemVisible( menu, R.id.list_item_move,
(1 < m_adapter.getGroupCount() (1 < m_adapter.getGroupCount()
&& 0 < nGamesSelected) ); && 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 ); m_menuPrepared = super.onPrepareOptionsMenu( menu );
} else { } else {
@ -803,10 +806,8 @@ public class GamesList extends XWExpandableListActivity
break; break;
case R.id.list_item_reset: case R.id.list_item_reset:
m_rowid = selRowIDs[0]; showConfirmThen( R.string.confirm_reset, R.string.button_reset,
showConfirmThen( R.string.confirm_reset, GamesActions.RESET_GAMES.ordinal(), selRowIDs );
R.string.button_reset,
GamesActions.RESET_GAME.ordinal() );
break; break;
case R.id.list_item_rename: case R.id.list_item_rename: