disable reset context menu too when game selected

This commit is contained in:
Eric House 2016-07-22 16:26:37 -07:00
parent 4d24fd38f5
commit 7a865f279b
2 changed files with 10 additions and 3 deletions

View file

@ -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 )

View file

@ -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 );
}
}
}