mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
unselect any game moved into a closed group
Fixes GameOver game moved via "archive" checkbox remaining selected
This commit is contained in:
parent
76957fe4eb
commit
989f7524d6
3 changed files with 21 additions and 13 deletions
|
@ -2656,14 +2656,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
private void archiveGame( boolean closeAfter )
|
private void archiveGame( boolean closeAfter )
|
||||||
{
|
{
|
||||||
String archiveName = LocUtils
|
long gid = DBUtils.getArchiveGroup( m_activity );
|
||||||
.getString( m_activity, R.string.group_name_archive );
|
DBUtils.moveGame( m_activity, m_rowid, gid );
|
||||||
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 );
|
|
||||||
if ( closeAfter ) {
|
if ( closeAfter ) {
|
||||||
waitCloseGame( false );
|
waitCloseGame( false );
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -1803,6 +1803,9 @@ public class DBUtils {
|
||||||
String archiveName = LocUtils
|
String archiveName = LocUtils
|
||||||
.getString( context, R.string.group_name_archive );
|
.getString( context, R.string.group_name_archive );
|
||||||
long archiveGroup = getGroup( context, archiveName );
|
long archiveGroup = getGroup( context, archiveName );
|
||||||
|
if ( DBUtils.GROUPID_UNSPEC == archiveGroup ) {
|
||||||
|
archiveGroup = DBUtils.addGroup( context, archiveName );
|
||||||
|
}
|
||||||
return archiveGroup;
|
return archiveGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1076,18 +1076,28 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
boolean destOpen = DBUtils.getGroups( m_activity ).get( gid ).m_expanded;
|
boolean destOpen = DBUtils.getGroups( m_activity ).get( gid ).m_expanded;
|
||||||
for ( long rowid : games ) {
|
for ( long rowid : games ) {
|
||||||
DBUtils.moveGame( m_activity, rowid, gid );
|
DBUtils.moveGame( m_activity, rowid, gid );
|
||||||
if ( !destOpen ) {
|
unselIfHidden( rowid, gid );
|
||||||
m_mySIS.selGames.remove( rowid );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// Invalidate if there could have been change
|
||||||
if ( ! destOpen ) {
|
|
||||||
invalidateOptionsMenuIf();
|
invalidateOptionsMenuIf();
|
||||||
setTitle();
|
setTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void unselIfHidden( long rowid )
|
||||||
|
{
|
||||||
|
long gid = DBUtils.getGroupForGame( m_activity, rowid );
|
||||||
|
unselIfHidden( rowid, gid );
|
||||||
|
}
|
||||||
|
|
||||||
public void invalidateOptionsMenuIf()
|
public void invalidateOptionsMenuIf()
|
||||||
{
|
{
|
||||||
super.invalidateOptionsMenuIf();
|
super.invalidateOptionsMenuIf();
|
||||||
|
@ -1158,6 +1168,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
setSelGame( rowid );
|
setSelGame( rowid );
|
||||||
break;
|
break;
|
||||||
case GAME_MOVED:
|
case GAME_MOVED:
|
||||||
|
unselIfHidden( rowid );
|
||||||
mkListAdapter();
|
mkListAdapter();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue