From 079859f5101c0a28d8ae589648c9d085290252fd Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 13 Jul 2014 09:09:48 -0700 Subject: [PATCH] fix new game creation putting list into state where games couldn't be launched: don't use m_launchedGame except to track that the UI's launched a game. --- .../android/xw4/GamesListDelegate.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java index b5955548b..d46d8432a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java @@ -161,6 +161,14 @@ public class GamesListDelegate extends ListDelegateBase return result; } + void setSelected( long rowID, boolean selected ) + { + Set games = getGamesFromElems( rowID ); + if ( 1 == games.size() ) { + games.iterator().next().setSelected( selected ); + } + } + void invalName( long rowID ) { Set games = getGamesFromElems( rowID ); @@ -838,14 +846,7 @@ public class GamesListDelegate extends ListDelegateBase updateField(); if ( DBUtils.ROWID_NOTFOUND != m_launchedGame ) { - clearSelections(); - - GameListItem item = m_adapter.reloadGame( m_launchedGame ); - if ( null != item ) { // currently visible in list? - item.setSelected( true ); - } - m_selGames.add( m_launchedGame ); - + setSelGame( m_launchedGame ); m_launchedGame = DBUtils.ROWID_NOTFOUND; } } @@ -881,7 +882,7 @@ public class GamesListDelegate extends ListDelegateBase break; case GAME_CREATED: mkListAdapter(); - m_launchedGame = rowid; + setSelGame( rowid ); break; default: Assert.fail(); @@ -1631,6 +1632,14 @@ public class GamesListDelegate extends ListDelegateBase return madeGame; } + private void setSelGame( long rowid ) + { + clearSelections(); + + m_selGames.add( rowid ); + m_adapter.setSelected( rowid, true ); + } + private void clearSelections() { boolean inval = false;