mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-16 15:41:16 +01:00
cleanup; do formatting inside DictLangCache
This commit is contained in:
parent
40e266dda0
commit
092236b0dd
2 changed files with 12 additions and 11 deletions
|
@ -28,10 +28,17 @@ import org.eehouse.android.xw4.jni.JNIUtilsImpl;
|
|||
import org.eehouse.android.xw4.jni.XwJNI;
|
||||
|
||||
public class DictLangCache {
|
||||
private static HashMap<String,Integer> s_nameToLang;
|
||||
private static final HashMap<String,Integer> s_nameToLang =
|
||||
new HashMap<String,Integer>();
|
||||
private static String[] s_langNames;
|
||||
|
||||
public static String getLangName( Context context, String name )
|
||||
public static String annotatedDictName( Context context,
|
||||
String name )
|
||||
{
|
||||
return name + " (" + getLangName( context, name ) + ")";
|
||||
}
|
||||
|
||||
private static String getLangName( Context context, String name )
|
||||
{
|
||||
int code = getLangCode( context, name );
|
||||
if ( null == s_langNames ) {
|
||||
|
@ -43,10 +50,6 @@ public class DictLangCache {
|
|||
|
||||
public static int getLangCode( Context context, String name )
|
||||
{
|
||||
if ( null == s_nameToLang ) {
|
||||
s_nameToLang = new HashMap<String,Integer>();
|
||||
}
|
||||
|
||||
int code;
|
||||
if ( s_nameToLang.containsKey( name ) ) {
|
||||
code = s_nameToLang.get( name );
|
||||
|
|
|
@ -62,11 +62,9 @@ public class DictsActivity extends ListActivity
|
|||
view.setPosition( position );
|
||||
|
||||
// append language name
|
||||
view.setText( m_dicts[position] + " (" +
|
||||
DictLangCache.getLangName( DictsActivity.this,
|
||||
m_dicts[position] )
|
||||
+ ")" );
|
||||
|
||||
view.setText( DictLangCache.
|
||||
annotatedDictName( DictsActivity.this,
|
||||
m_dicts[position] ) );
|
||||
if ( !GameUtils.dictIsBuiltin( DictsActivity.this,
|
||||
m_dicts[position] ) ) {
|
||||
view.setDeleteCallback( DictsActivity.this );
|
||||
|
|
Loading…
Reference in a new issue