mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
fix NPE with empty wordlist (and add note for Greek)
This commit is contained in:
parent
f1ee8564cb
commit
411707a3a1
2 changed files with 15 additions and 9 deletions
|
@ -90,14 +90,6 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
setTitle( getString( format, m_name, m_nWords,
|
setTitle( getString( format, m_name, m_nWords,
|
||||||
m_browseState.m_minShown,
|
m_browseState.m_minShown,
|
||||||
m_browseState.m_maxShown ));
|
m_browseState.m_maxShown ));
|
||||||
|
|
||||||
String desc = XwJNI.dict_iter_getDesc( m_dictClosure );
|
|
||||||
if ( null != desc ) {
|
|
||||||
TextView view = (TextView)findViewById( R.id.desc );
|
|
||||||
Assert.assertNotNull( view );
|
|
||||||
view.setVisibility( View.VISIBLE );
|
|
||||||
view.setText( desc );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getItem( int position )
|
public Object getItem( int position )
|
||||||
|
@ -177,6 +169,15 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
m_dictClosure = XwJNI.dict_iter_init( pairs.m_bytes[0],
|
m_dictClosure = XwJNI.dict_iter_init( pairs.m_bytes[0],
|
||||||
name, pairs.m_paths[0] );
|
name, pairs.m_paths[0] );
|
||||||
|
|
||||||
|
String desc = XwJNI.dict_iter_getDesc( m_dictClosure );
|
||||||
|
Log.d( TAG, "got desc: %s", desc );
|
||||||
|
if ( null != desc ) {
|
||||||
|
TextView view = (TextView)findViewById( R.id.desc );
|
||||||
|
Assert.assertNotNull( view );
|
||||||
|
view.setVisibility( View.VISIBLE );
|
||||||
|
view.setText( desc );
|
||||||
|
}
|
||||||
|
|
||||||
m_browseState = DBUtils.dictsGetOffset( m_activity, name, m_loc );
|
m_browseState = DBUtils.dictsGetOffset( m_activity, name, m_loc );
|
||||||
boolean newState = null == m_browseState;
|
boolean newState = null == m_browseState;
|
||||||
if ( newState ) {
|
if ( newState ) {
|
||||||
|
@ -220,7 +221,8 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
|
|
||||||
protected void onPause()
|
protected void onPause()
|
||||||
{
|
{
|
||||||
if ( null != m_browseState ) { // already saved?
|
if ( null != m_browseState // already saved?
|
||||||
|
&& null != m_list ) { // there are words? (don't NPE on empty dict)
|
||||||
m_browseState.m_pos = m_list.getFirstVisiblePosition();
|
m_browseState.m_pos = m_list.getFirstVisiblePosition();
|
||||||
View view = m_list.getChildAt( 0 );
|
View view = m_list.getChildAt( 0 );
|
||||||
m_browseState.m_top = (view == null) ? 0 : view.getTop();
|
m_browseState.m_top = (view == null) ? 0 : view.getTop();
|
||||||
|
@ -274,6 +276,7 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// AdapterView.OnItemSelectedListener interface
|
// AdapterView.OnItemSelectedListener interface
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
@Override
|
||||||
public void onItemSelected( AdapterView<?> parent, View view,
|
public void onItemSelected( AdapterView<?> parent, View view,
|
||||||
int position, long id )
|
int position, long id )
|
||||||
{
|
{
|
||||||
|
@ -296,6 +299,7 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onNothingSelected( AdapterView<?> parent )
|
public void onNothingSelected( AdapterView<?> parent )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ XWLANG = Greek
|
||||||
LANGCODE = el_GK
|
LANGCODE = el_GK
|
||||||
ENC = UTF-8
|
ENC = UTF-8
|
||||||
|
|
||||||
|
DICTNOTE = "Tiles for Greek (no words, so robot and hint won't work)"
|
||||||
|
|
||||||
# DICT2DAWGARGS = -lang $(LANGCODE)
|
# DICT2DAWGARGS = -lang $(LANGCODE)
|
||||||
# DICT2DAWGARGS = -debug
|
# DICT2DAWGARGS = -debug
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue