mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-09 22:00:39 +01:00
use new jni method and array of names to append language to name of dict
This commit is contained in:
parent
51e2c61962
commit
40d8aede88
1 changed files with 14 additions and 3 deletions
|
@ -26,6 +26,7 @@ import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
|
@ -35,20 +36,25 @@ import android.view.LayoutInflater;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.eehouse.android.xw4.jni.XwJNI;
|
||||||
|
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
|
||||||
|
|
||||||
public class DictsActivity extends ListActivity
|
public class DictsActivity extends ListActivity
|
||||||
implements View.OnClickListener,
|
implements View.OnClickListener,
|
||||||
XWListItem.DeleteCallback {
|
XWListItem.DeleteCallback {
|
||||||
String[] m_dicts;
|
String[] m_dicts;
|
||||||
|
|
||||||
private class DictListAdapter extends XWListAdapter {
|
private class DictListAdapter extends XWListAdapter {
|
||||||
Context m_context;
|
private Context m_context;
|
||||||
|
private String[] m_langNames;
|
||||||
|
|
||||||
public DictListAdapter( Context context ) {
|
public DictListAdapter( Context context ) {
|
||||||
super( context, m_dicts.length );
|
super( context, m_dicts.length );
|
||||||
m_context = context;
|
m_context = context;
|
||||||
|
Resources res = m_context.getResources();
|
||||||
|
m_langNames = res.getStringArray( R.array.language_names );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getItem( int position) { return m_dicts[position]; }
|
public Object getItem( int position) { return m_dicts[position]; }
|
||||||
|
@ -58,7 +64,12 @@ public class DictsActivity extends ListActivity
|
||||||
final XWListItem view
|
final XWListItem view
|
||||||
= (XWListItem)factory.inflate( R.layout.list_item, null );
|
= (XWListItem)factory.inflate( R.layout.list_item, null );
|
||||||
view.setPosition( position );
|
view.setPosition( position );
|
||||||
view.setText( m_dicts[position] );
|
|
||||||
|
// append language code
|
||||||
|
byte[] dict = GameUtils.openDict( DictsActivity.this,
|
||||||
|
m_dicts[position] );
|
||||||
|
int code = XwJNI.dict_getLanguageCode( dict, JNIUtilsImpl.get() );
|
||||||
|
view.setText( m_dicts[position] + " (" + m_langNames[code] + ")" );
|
||||||
|
|
||||||
if ( !GameUtils.dictIsBuiltin( DictsActivity.this,
|
if ( !GameUtils.dictIsBuiltin( DictsActivity.this,
|
||||||
m_dicts[position] ) ) {
|
m_dicts[position] ) ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue