mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
recover from situation where game is created in response to an
invitation for a lang for which it has no dicts installed. Shouldn't happen, but on relay still can.
This commit is contained in:
parent
9659f810dc
commit
a3e0d0ca1e
1 changed files with 26 additions and 11 deletions
|
@ -80,7 +80,7 @@ public class GamesList extends XWListActivity
|
|||
|
||||
private GameListAdapter m_adapter;
|
||||
private String m_missingDict;
|
||||
private String[] m_missingDictNames;
|
||||
private String m_missingDictName;
|
||||
private long m_missingDictRowId;
|
||||
private String[] m_sameLangDicts;
|
||||
private int m_missingDictLang;
|
||||
|
@ -104,10 +104,15 @@ public class GamesList extends XWListActivity
|
|||
lstnr = new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int item ) {
|
||||
// just do one
|
||||
NetUtils.downloadDictInBack( GamesList.this,
|
||||
m_missingDictLang,
|
||||
m_missingDictNames[0],
|
||||
GamesList.this );
|
||||
if ( null == m_missingDictName ) {
|
||||
DictsActivity.launchAndDownload( GamesList.this,
|
||||
m_missingDictLang );
|
||||
} else {
|
||||
NetUtils.downloadDictInBack( GamesList.this,
|
||||
m_missingDictLang,
|
||||
m_missingDictName,
|
||||
GamesList.this );
|
||||
}
|
||||
}
|
||||
};
|
||||
String message;
|
||||
|
@ -119,7 +124,7 @@ public class GamesList extends XWListActivity
|
|||
gameName, langName );
|
||||
} else {
|
||||
message = getString( R.string.no_dict_substf,
|
||||
gameName, m_missingDictNames[0],
|
||||
gameName, m_missingDictName,
|
||||
langName );
|
||||
}
|
||||
|
||||
|
@ -152,8 +157,10 @@ public class GamesList extends XWListActivity
|
|||
dict = DictLangCache.stripCount( dict );
|
||||
GameUtils.replaceDicts( GamesList.this,
|
||||
m_missingDictRowId,
|
||||
m_missingDictNames[0],
|
||||
m_missingDictName,
|
||||
dict );
|
||||
GameUtils.launchGame( GamesList.this,
|
||||
m_missingDictRowId );
|
||||
}
|
||||
};
|
||||
dialog = new AlertDialog.Builder( this )
|
||||
|
@ -340,7 +347,7 @@ public class GamesList extends XWListActivity
|
|||
{
|
||||
super.onSaveInstanceState( outState );
|
||||
outState.putLong( SAVE_ROWID, m_rowid );
|
||||
outState.putStringArray( SAVE_DICTNAMES, m_missingDictNames );
|
||||
outState.putString( SAVE_DICTNAMES, m_missingDictName );
|
||||
if ( null != m_netLaunchInfo ) {
|
||||
m_netLaunchInfo.putSelf( outState );
|
||||
}
|
||||
|
@ -351,7 +358,7 @@ public class GamesList extends XWListActivity
|
|||
if ( null != bundle ) {
|
||||
m_rowid = bundle.getLong( SAVE_ROWID );
|
||||
m_netLaunchInfo = new NetLaunchInfo( bundle );
|
||||
m_missingDictNames = bundle.getStringArray( SAVE_DICTNAMES );
|
||||
m_missingDictName = bundle.getString( SAVE_DICTNAMES );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,13 +705,21 @@ public class GamesList extends XWListActivity
|
|||
missingNames,
|
||||
missingLang );
|
||||
if ( !hasDicts ) {
|
||||
m_missingDictNames = missingNames[0];
|
||||
m_missingDictLang = missingLang[0];
|
||||
if ( 0 < missingNames[0].length ) {
|
||||
m_missingDictName = missingNames[0][0];
|
||||
} else {
|
||||
m_missingDictName = null;
|
||||
}
|
||||
m_missingDictRowId = rowid;
|
||||
if ( 0 == DictLangCache.getLangCount( this, m_missingDictLang ) ) {
|
||||
showDialog( WARN_NODICT );
|
||||
} else {
|
||||
} else if ( null != m_missingDictName ) {
|
||||
showDialog( WARN_NODICT_SUBST );
|
||||
} else {
|
||||
String dict = DictLangCache.getHaveLang( this, m_missingDictLang)[0];
|
||||
GameUtils.replaceDicts( this, m_missingDictRowId, null, dict );
|
||||
GameUtils.launchGame( this, m_missingDictRowId );
|
||||
}
|
||||
}
|
||||
return hasDicts;
|
||||
|
|
Loading…
Add table
Reference in a new issue