unselect any game moved into a closed group

Fixes GameOver game moved via "archive" checkbox remaining selected
This commit is contained in:
Eric House 2019-02-12 18:14:57 -08:00
parent 76957fe4eb
commit 989f7524d6
3 changed files with 21 additions and 13 deletions

View file

@ -2656,14 +2656,8 @@ public class BoardDelegate extends DelegateBase
private void archiveGame( boolean closeAfter )
{
String archiveName = LocUtils
.getString( m_activity, R.string.group_name_archive );
long archiveGroupID = DBUtils.getGroup( m_activity, archiveName );
if ( DBUtils.GROUPID_UNSPEC == archiveGroupID ) {
archiveGroupID = DBUtils.addGroup( m_activity, archiveName );
}
DBUtils.moveGame( m_activity, m_rowid, archiveGroupID );
long gid = DBUtils.getArchiveGroup( m_activity );
DBUtils.moveGame( m_activity, m_rowid, gid );
if ( closeAfter ) {
waitCloseGame( false );
finish();

View file

@ -1803,6 +1803,9 @@ public class DBUtils {
String archiveName = LocUtils
.getString( context, R.string.group_name_archive );
long archiveGroup = getGroup( context, archiveName );
if ( DBUtils.GROUPID_UNSPEC == archiveGroup ) {
archiveGroup = DBUtils.addGroup( context, archiveName );
}
return archiveGroup;
}

View file

@ -1076,18 +1076,28 @@ public class GamesListDelegate extends ListDelegateBase
boolean destOpen = DBUtils.getGroups( m_activity ).get( gid ).m_expanded;
for ( long rowid : games ) {
DBUtils.moveGame( m_activity, rowid, gid );
if ( !destOpen ) {
m_mySIS.selGames.remove( rowid );
}
unselIfHidden( rowid, gid );
}
}
// Invalidate if there could have been change
if ( ! destOpen ) {
private void unselIfHidden( long rowid, long gid )
{
boolean groupOpen = DBUtils.getGroups( m_activity )
.get( gid ).m_expanded;
if ( !groupOpen ) {
m_mySIS.selGames.remove( rowid );
// Invalidate if there could have been change
invalidateOptionsMenuIf();
setTitle();
}
}
private void unselIfHidden( long rowid )
{
long gid = DBUtils.getGroupForGame( m_activity, rowid );
unselIfHidden( rowid, gid );
}
public void invalidateOptionsMenuIf()
{
super.invalidateOptionsMenuIf();
@ -1158,6 +1168,7 @@ public class GamesListDelegate extends ListDelegateBase
setSelGame( rowid );
break;
case GAME_MOVED:
unselIfHidden( rowid );
mkListAdapter();
break;
default: