assign dicts as soon as language is changed.

This commit is contained in:
Andy2 2011-04-27 06:39:52 -07:00
parent 399fc081d7
commit 9013897a5a
3 changed files with 12 additions and 13 deletions

View file

@ -693,9 +693,9 @@ public class GameConfig extends XWActivity
if ( chosen.equals( m_browseText ) ) { if ( chosen.equals( m_browseText ) ) {
startActivity( Utils.mkDownloadActivity(GameConfig.this) ); startActivity( Utils.mkDownloadActivity(GameConfig.this) );
} else { } else {
m_gi.dictLang = m_gi.setLang( DictLangCache.
DictLangCache.getLangLangCode( GameConfig.this, getLangLangCode( GameConfig.this,
chosen ); chosen ) );
} }
} }

View file

@ -352,7 +352,7 @@ public class GameUtils {
byte[] stream = savedGame( context, path ); byte[] stream = savedGame( context, path );
CurGameInfo gi = new CurGameInfo( context ); CurGameInfo gi = new CurGameInfo( context );
XwJNI.gi_from_stream( gi, stream ); XwJNI.gi_from_stream( gi, stream );
final String[] dictNames = gi.dictNames( false ); final String[] dictNames = gi.dictNames();
HashSet<String> missingSet; HashSet<String> missingSet;
String[] installed = dictList( context ); String[] installed = dictList( context );

View file

@ -137,6 +137,14 @@ public class CurGameInfo {
m_inProgress = inProgress; m_inProgress = inProgress;
} }
public void setLang( int lang )
{
if ( dictLang != lang ) {
dictLang = lang;
assignDicts();
}
}
public int getRobotSmartness() public int getRobotSmartness()
{ {
if ( m_smartness == 0 ) { if ( m_smartness == 0 ) {
@ -239,15 +247,6 @@ public class CurGameInfo {
public String[] dictNames() public String[] dictNames()
{ {
return dictNames( true );
}
public String[] dictNames( boolean assign )
{
if ( assign ) {
assignDicts();
}
String[] result = new String[nPlayers+1]; String[] result = new String[nPlayers+1];
result[0] = dictName; result[0] = dictName;
for ( int ii = 0; ii < nPlayers; ++ii ) { for ( int ii = 0; ii < nPlayers; ++ii ) {