diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java index af76c6e83..7bf333b3f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java @@ -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 s_openStates = + new HashMap(); + // 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 ); + } } }