mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
substitute smaller built-in dict to save time moving bits during
development; don't hard-code name of built-in.
This commit is contained in:
parent
6dfac28b13
commit
e86d656b4a
8 changed files with 17 additions and 8 deletions
BIN
xwords4/android/XWords4/assets/BasEnglish2to8.xwd
Normal file
BIN
xwords4/android/XWords4/assets/BasEnglish2to8.xwd
Normal file
Binary file not shown.
Binary file not shown.
|
@ -113,7 +113,7 @@ public class BoardActivity extends Activity implements UtilCtxt, Runnable {
|
|||
m_handler = new Handler();
|
||||
m_timers = new TimerRunnable[4]; // needs to be in sync with
|
||||
// XWTimerReason
|
||||
m_gi = new CurGameInfo();
|
||||
m_gi = new CurGameInfo( this );
|
||||
|
||||
m_view = (BoardView)findViewById( R.id.board_view );
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public class GameConfig extends Activity implements View.OnClickListener {
|
|||
}
|
||||
|
||||
byte[] stream = Utils.savedGame( this, m_path );
|
||||
m_gi = new CurGameInfo();
|
||||
m_gi = new CurGameInfo( this );
|
||||
XwJNI.gi_from_stream( m_gi, stream );
|
||||
int curSel = listAvailableDicts( m_gi.dictName );
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class GameListAdapter implements ListAdapter {
|
|||
|
||||
byte[] stream = open( m_context.fileList()[position] );
|
||||
if ( null != stream ) {
|
||||
CurGameInfo gi = new CurGameInfo();
|
||||
CurGameInfo gi = new CurGameInfo( m_context );
|
||||
XwJNI.gi_from_stream( gi, stream );
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
|
|
@ -125,7 +125,7 @@ public class GamesList extends ListActivity implements View.OnClickListener {
|
|||
|
||||
case R.id.list_item_new_from:
|
||||
stream = Utils.savedGame( this, path );
|
||||
CurGameInfo gi = new CurGameInfo();
|
||||
CurGameInfo gi = new CurGameInfo( this );
|
||||
XwJNI.gi_from_stream( gi, stream );
|
||||
stream = XwJNI.gi_to_stream( gi );
|
||||
Utils.saveGame( this, stream );
|
||||
|
@ -195,7 +195,7 @@ public class GamesList extends ListActivity implements View.OnClickListener {
|
|||
}
|
||||
|
||||
public void onClick( View v ) {
|
||||
saveNew( new CurGameInfo() );
|
||||
saveNew( new CurGameInfo( this ) );
|
||||
onContentChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -118,6 +118,11 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static String[] listDicts( Context context )
|
||||
{
|
||||
return listDicts( context, Integer.MAX_VALUE );
|
||||
}
|
||||
|
||||
public static String[] listDicts( Context context, int enough )
|
||||
{
|
||||
ArrayList<String> al = new ArrayList<String>();
|
||||
|
||||
|
@ -133,6 +138,9 @@ public class Utils {
|
|||
|
||||
File files[] = Environment.getExternalStorageDirectory().listFiles();
|
||||
for ( File file : files ) {
|
||||
if ( al.size() >= enough ) {
|
||||
break;
|
||||
}
|
||||
if ( file.isDirectory() ) { // go down one level
|
||||
tryDir( al, file );
|
||||
} else {
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
package org.eehouse.android.xw4.jni;
|
||||
|
||||
import java.util.Random;
|
||||
import android.content.Context;
|
||||
|
||||
import org.eehouse.android.xw4.Utils;
|
||||
|
||||
public class CurGameInfo {
|
||||
|
||||
private static final String BUILTIN_DICT = "OWL2_2to9.xwd";
|
||||
public static final int MAX_NUM_PLAYERS = 4;
|
||||
|
||||
public enum XWPhoniesChoice { PHONIES_IGNORE, PHONIES_WARN, PHONIES_DISALLOW };
|
||||
|
@ -29,12 +30,12 @@ public class CurGameInfo {
|
|||
public XWPhoniesChoice phoniesAction;
|
||||
public boolean confirmBTConnect; /* only used for BT */
|
||||
|
||||
public CurGameInfo() {
|
||||
public CurGameInfo( Context context ) {
|
||||
nPlayers = 2;
|
||||
boardSize = 15;
|
||||
players = new LocalPlayer[MAX_NUM_PLAYERS];
|
||||
serverRole = DeviceRole.SERVER_STANDALONE;
|
||||
dictName = BUILTIN_DICT;
|
||||
dictName = Utils.listDicts( context, 1 )[0];
|
||||
hintsNotAllowed = false;
|
||||
phoniesAction = XWPhoniesChoice.PHONIES_IGNORE;
|
||||
timerEnabled = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue