mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
use static HashMap to track what language views are open and closed.
As long as I'm not reloaded user choice will be preserved. Good enough.
This commit is contained in:
parent
72d769910b
commit
99498a8568
1 changed files with 19 additions and 5 deletions
|
@ -23,14 +23,12 @@ package org.eehouse.android.xw4;
|
|||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ListActivity;
|
||||
import android.app.ExpandableListActivity;
|
||||
import android.database.DataSetObserver;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.AdapterView;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -49,6 +47,7 @@ import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
|
|||
import android.widget.Toast;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.net.Uri;
|
||||
import java.util.HashMap;
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eehouse.android.xw4.DictUtils.DictAndLoc;
|
||||
|
@ -70,6 +69,9 @@ public class DictsActivity extends ExpandableListActivity
|
|||
private static final String MOVEFROMLOC = "movefromloc";
|
||||
private static final String MOVETOLOC = "movetoloc";
|
||||
|
||||
private static HashMap<String,Boolean> s_openStates =
|
||||
new HashMap<String,Boolean>();
|
||||
|
||||
// For new callback alternative
|
||||
private static final int DELETE_DICT_ACTION = 1;
|
||||
|
||||
|
@ -207,8 +209,13 @@ public class DictsActivity extends ExpandableListActivity
|
|||
public boolean isChildSelectable( int groupPosition,
|
||||
int childPosition ) { return true; }
|
||||
public boolean isEmpty() { return false; }
|
||||
public void onGroupCollapsed(int groupPosition){}
|
||||
public void onGroupExpanded(int groupPosition){}
|
||||
public void onGroupCollapsed(int groupPosition)
|
||||
{
|
||||
s_openStates.put( m_langs[groupPosition], false );
|
||||
}
|
||||
public void onGroupExpanded(int groupPosition){
|
||||
s_openStates.put( m_langs[groupPosition], true );
|
||||
}
|
||||
public void registerDataSetObserver( DataSetObserver obs ){}
|
||||
public void unregisterDataSetObserver( DataSetObserver obs ){}
|
||||
|
||||
|
@ -632,7 +639,14 @@ public class DictsActivity extends ExpandableListActivity
|
|||
private void expandGroups()
|
||||
{
|
||||
for ( int ii = 0; ii < m_langs.length; ++ii ) {
|
||||
m_expView.expandGroup( ii );
|
||||
boolean open = true;
|
||||
String lang = m_langs[ii];
|
||||
if ( s_openStates.containsKey( lang ) ) {
|
||||
open = s_openStates.get( lang );
|
||||
}
|
||||
if ( open ) {
|
||||
m_expView.expandGroup( ii );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue