preserve order of groups when removing one by removing it from list

rather than allowing list to be regenerated.
This commit is contained in:
Eric House 2012-12-29 09:35:44 -08:00
parent 674b6d3e8e
commit 8c4b878e21
2 changed files with 16 additions and 1 deletions

View file

@ -88,6 +88,19 @@ public class GameListAdapter implements ExpandableListAdapter {
return success;
}
public boolean removeGroup( long groupid )
{
long[] newArray = new long[m_positions.length - 1];
int destIndex = 0;
for ( long id : m_positions ) {
if ( id != groupid ) {
newArray[destIndex++] = id;
}
}
m_positions = newArray;
return true;
}
public void expandGroups( ExpandableListView view )
{
HashMap<Long,GameGroupInfo> info = gameInfo();

View file

@ -554,7 +554,9 @@ public class GamesList extends XWExpandableListActivity
case DELETE_GROUP_ACTION:
GameUtils.deleteGroup( this, m_groupid );
onContentChanged();
if ( m_adapter.removeGroup( m_groupid ) ) {
onContentChanged();
}
break;
default:
Assert.fail();