mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +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;
|
import org.eehouse.android.xw4.jni.XwJNI;
|
||||||
|
|
||||||
public class DictLangCache {
|
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;
|
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 );
|
int code = getLangCode( context, name );
|
||||||
if ( null == s_langNames ) {
|
if ( null == s_langNames ) {
|
||||||
|
@ -43,10 +50,6 @@ public class DictLangCache {
|
||||||
|
|
||||||
public static int getLangCode( Context context, String name )
|
public static int getLangCode( Context context, String name )
|
||||||
{
|
{
|
||||||
if ( null == s_nameToLang ) {
|
|
||||||
s_nameToLang = new HashMap<String,Integer>();
|
|
||||||
}
|
|
||||||
|
|
||||||
int code;
|
int code;
|
||||||
if ( s_nameToLang.containsKey( name ) ) {
|
if ( s_nameToLang.containsKey( name ) ) {
|
||||||
code = s_nameToLang.get( name );
|
code = s_nameToLang.get( name );
|
||||||
|
|
|
@ -62,11 +62,9 @@ public class DictsActivity extends ListActivity
|
||||||
view.setPosition( position );
|
view.setPosition( position );
|
||||||
|
|
||||||
// append language name
|
// append language name
|
||||||
view.setText( m_dicts[position] + " (" +
|
view.setText( DictLangCache.
|
||||||
DictLangCache.getLangName( DictsActivity.this,
|
annotatedDictName( DictsActivity.this,
|
||||||
m_dicts[position] )
|
m_dicts[position] ) );
|
||||||
+ ")" );
|
|
||||||
|
|
||||||
if ( !GameUtils.dictIsBuiltin( DictsActivity.this,
|
if ( !GameUtils.dictIsBuiltin( DictsActivity.this,
|
||||||
m_dicts[position] ) ) {
|
m_dicts[position] ) ) {
|
||||||
view.setDeleteCallback( DictsActivity.this );
|
view.setDeleteCallback( DictsActivity.this );
|
||||||
|
|
Loading…
Add table
Reference in a new issue