mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +01:00
don't set as selected a game inside a collapsed group
This commit is contained in:
parent
55ea4d7a04
commit
69889c4382
2 changed files with 37 additions and 1 deletions
|
@ -182,6 +182,19 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
removeChildren( makeChildTestFor( rowID ) );
|
||||
}
|
||||
|
||||
protected boolean inExpandedGroup( long rowID )
|
||||
{
|
||||
boolean expanded = false;
|
||||
GroupRec rec = (GroupRec)
|
||||
findParent( makeChildTestFor( rowID ) );
|
||||
if ( null != rec ) {
|
||||
GameGroupInfo ggi =
|
||||
DBUtils.getGroups( m_activity ).get( rec.m_groupID );
|
||||
expanded = ggi.m_expanded;
|
||||
}
|
||||
return expanded;
|
||||
}
|
||||
|
||||
protected GameListItem reloadGame( long rowID )
|
||||
{
|
||||
GameListItem item = null;
|
||||
|
@ -850,8 +863,13 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
|
||||
if ( 0 != m_launchedGames.size() ) {
|
||||
long rowid = m_launchedGames.iterator().next();
|
||||
setSelGame( rowid );
|
||||
m_launchedGames.remove( rowid );
|
||||
|
||||
if ( m_adapter.inExpandedGroup( rowid ) ) {
|
||||
setSelGame( rowid );
|
||||
} else {
|
||||
clearSelections();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,6 +187,24 @@ abstract class XWExpListAdapter extends XWListAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
protected Object findParent( ChildTest test )
|
||||
{
|
||||
Object result = null;
|
||||
Object curParent = null;
|
||||
for ( int ii = 0; ii < m_listObjs.length; ++ii ) {
|
||||
Object obj = m_listObjs[ii];
|
||||
if ( obj.getClass() == m_groupClass ) {
|
||||
curParent = obj;
|
||||
} else if ( test.isTheChild( obj ) ) {
|
||||
result = curParent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// DbgUtils.logf( "findParent() => %H (class %s)", result,
|
||||
// null == result ? "null" : result.getClass().getName() );
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void swapGroups( int groupPosn1, int groupPosn2 )
|
||||
{
|
||||
// switch if needed so we know the direction
|
||||
|
|
Loading…
Add table
Reference in a new issue