mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
cache list of langs. Performance is otherwise abysmal. May need to
add mechanism to notify when the list is invalidated. (Or move caching into DictsLangCache class.)
This commit is contained in:
parent
a559fdaae9
commit
c990900913
2 changed files with 7 additions and 6 deletions
|
@ -224,7 +224,7 @@ public class DictLangCache {
|
|||
}
|
||||
}
|
||||
|
||||
private static String[] listLangs( Context context )
|
||||
public static String[] listLangs( Context context )
|
||||
{
|
||||
return listLangs( context, GameUtils.dictList( context ) );
|
||||
}
|
||||
|
|
|
@ -66,10 +66,12 @@ public class DictsActivity extends ExpandableListActivity
|
|||
|
||||
private class DictListAdapter implements ExpandableListAdapter {
|
||||
private Context m_context;
|
||||
private String[] m_langs;
|
||||
|
||||
public DictListAdapter( Context context ) {
|
||||
//super( context, m_dicts.length );
|
||||
m_context = context;
|
||||
m_langs = DictLangCache.listLangs( m_context );
|
||||
}
|
||||
|
||||
public boolean areAllItemsEnabled() { return false; }
|
||||
|
@ -129,13 +131,13 @@ public class DictsActivity extends ExpandableListActivity
|
|||
|
||||
public int getGroupCount()
|
||||
{
|
||||
return DictLangCache.getLangNames( m_context ).length;
|
||||
return m_langs.length;
|
||||
}
|
||||
|
||||
public long getGroupId( int groupPosition )
|
||||
{
|
||||
String[] langNames = DictLangCache.getLangNames( m_context );
|
||||
int lang = DictLangCache.getLangLangCode( m_context, langNames[groupPosition] );
|
||||
int lang = DictLangCache.getLangLangCode( m_context,
|
||||
m_langs[groupPosition] );
|
||||
return lang;
|
||||
}
|
||||
|
||||
|
@ -145,7 +147,7 @@ public class DictsActivity extends ExpandableListActivity
|
|||
View row = LayoutInflater.from(DictsActivity.this).
|
||||
inflate(android.R.layout.simple_expandable_list_item_1, null );
|
||||
TextView view = (TextView)row.findViewById( android.R.id.text1 );
|
||||
view.setText( DictLangCache.getLangNames(m_context)[groupPosition] );
|
||||
view.setText( m_langs[groupPosition] );
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -157,7 +159,6 @@ public class DictsActivity extends ExpandableListActivity
|
|||
public void registerDataSetObserver( DataSetObserver obs ){}
|
||||
public void unregisterDataSetObserver( DataSetObserver obs ){}
|
||||
|
||||
|
||||
// public Object getItem( int position) { return m_dicts[position]; }
|
||||
// public View getView( final int position, View convertView,
|
||||
// ViewGroup parent ) {
|
||||
|
|
Loading…
Add table
Reference in a new issue