mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-01 19:57:11 +01:00
when KP is deleted, remove record of its being expanded
I'm tired of having a record recreated and showing up expanded first thing. Better to save less garbage.
This commit is contained in:
parent
88e76af7ab
commit
e1712f4560
1 changed files with 19 additions and 0 deletions
|
@ -36,8 +36,10 @@ import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eehouse.android.xw4.DlgDelegate.Action;
|
import org.eehouse.android.xw4.DlgDelegate.Action;
|
||||||
import org.eehouse.android.xw4.ExpandImageButton.ExpandChangeListener;
|
import org.eehouse.android.xw4.ExpandImageButton.ExpandChangeListener;
|
||||||
|
@ -145,6 +147,7 @@ public class KnownPlayersDelegate extends DelegateBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addInOrder();
|
addInOrder();
|
||||||
|
pruneExpanded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +161,22 @@ public class KnownPlayersDelegate extends DelegateBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void pruneExpanded()
|
||||||
|
{
|
||||||
|
boolean doSave = false;
|
||||||
|
Set<String> children = mChildren.keySet();
|
||||||
|
for ( Iterator<String> iter = mExpSet.iterator(); iter.hasNext(); ) {
|
||||||
|
String child = iter.next();
|
||||||
|
if ( !children.contains(child) ) {
|
||||||
|
iter.remove();
|
||||||
|
doSave = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( doSave ) {
|
||||||
|
saveExpanded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setName( ViewGroup item, String name )
|
private void setName( ViewGroup item, String name )
|
||||||
{
|
{
|
||||||
TextView tv = (TextView)item.findViewById( R.id.player_name );
|
TextView tv = (TextView)item.findViewById( R.id.player_name );
|
||||||
|
|
Loading…
Add table
Reference in a new issue