diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index bb49d4665..aca260a99 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -150,8 +150,9 @@ public class GameUtils { return lockDest; } // resetGame - public static void resetGame( Context context, long rowidIn ) + public static boolean resetGame( Context context, long rowidIn ) { + boolean success = false; GameLock lock = new GameLock( rowidIn, true ).lock( 500 ); if ( null != lock ) { tellDied( context, lock, true ); @@ -159,9 +160,11 @@ public class GameUtils { lock.unlock(); Utils.cancelNotification( context, (int)rowidIn ); + success = true; } else { DbgUtils.logf( "resetGame: unable to open rowid %d", rowidIn ); } + return success; } private static int setFromFeedImpl( FeedUtilsImpl feedImpl ) 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 a38f6a1d7..f3729d4da 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java @@ -1211,10 +1211,13 @@ public class GamesListDelegate extends ListDelegateBase break; case RESET_GAMES: long[] rowids = (long[])params[0]; + boolean changed = false; for ( long rowid : rowids ) { - GameUtils.resetGame( m_activity, rowid ); + changed = GameUtils.resetGame( m_activity, rowid ) || changed; + } + if ( changed ) { + mkListAdapter(); // required because position may change } - mkListAdapter(); // required because position may change break; case SYNC_MENU: doSyncMenuitem(); @@ -1578,6 +1581,7 @@ public class GamesListDelegate extends ListDelegateBase enable = !m_launchedGames.contains( rowID ); Utils.setItemVisible( menu, R.id.games_game_delete, enable ); + Utils.setItemVisible( menu, R.id.games_game_reset, enable ); } } }