From 28c78a0a6a5c9167b0e30fa64bf2ed1e7dce9a42 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Sat, 20 Aug 2011 14:16:38 -0700 Subject: [PATCH 1/7] dictionary->wordlist --- .../android/XWords4/res/values/strings.xml | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index ebd8ed481..05ad8c121 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -25,10 +25,10 @@ Play game Crosswords - Dictionaries + Installed Crosswords Wordlists Languages (based on installed - dictionaries) + wordlists) Game language %s settings %s settings (networked) @@ -143,7 +143,7 @@ The hint feature is disabled for this game. Enable it for a new game using the Settings dialog. No peeking at remote players\' tiles! Refused attempt to register unexpected user[s] - Conflict between Host and Guest dictionaries; Host wins. + Conflict between Host and Guest wordlists; Host wins. At least one player must be marked \"Remote\" for a game started as Host. Off-device player @@ -161,18 +161,18 @@ Add player Shuffle players - Move dictionary + Move wordlist Make default Details - Move dictionary %1$s from %2$s to %3$s? + Move wordlist %1$s from %2$s to %3$s? For what players should this - dictionary (and the language %s) be the default for new - games? + wordlist be the default for new games? (The language %s will be + the default for both.) Human Robot Both - Dictionary (in %s) + Wordlist (in %s) Connection (via internet) Make new room public Join public room @@ -213,10 +213,10 @@ Are you sure you want to delete %s? \u0020It is the only %s - dictionary installed. One or more games will be unopenable + wordlist installed. One or more games will be unopenable without it. \u0020One game (at least) - is using it (but there is another %s dictionary installed that + is using it (but there is another %s wordlist installed that can replace it.) Allow hints @@ -254,8 +254,8 @@ Tapping on scoreboard name shows that player\'s tiles - Dictionary storage - Store downloaded dictionaries using + Wordlist storage + Store downloaded wordlists using internal or external (SD card) memory? (You can always move them later.) Internal @@ -270,7 +270,7 @@ Smartest robot Settings - Dictionaries + Wordlists Restore all Restore colors Are you sure you want to @@ -299,14 +299,14 @@ Fourth player Not used yet... - Dictionaries - Default dictionaries - Dictionary for humans - Dictionary for robots + Wordlists + Default wordlists + Wordlist for humans + Wordlist for robots Handle phonies How to handle \"phonies\" - (words not in dictionary) + (words not in wordlist) Board size Individual colors @@ -349,7 +349,7 @@ another device. You will not be able to play any further. - Word[s] %s not found in dictionary. + Word[s] %s not found in wordlist. Do you still want to accept this move? Turn lost. Illegal word[s] @@ -383,24 +383,24 @@ credits pending permission. Downloading Crosswords - dictionary %s... - Dictionary not found + wordlist %s... + Wordlist not found Download - Substitute dictionary (wordcount) + Substitute wordlist (wordcount) Substitute Close game - A dictionary this game is using has + A wordlist this game is using has disappeared. (Usually this means it\'s on an external card that is no longer available.) Unable to open game \"%1$s\" because no - %2$s dictionary found. (It may have been deleted, or stored on + %2$s wordlist found. (It may have been deleted, or stored on an external card that is no longer available.) Unable to open game \"%1$s\" because - dictionary %2$s not found. (It may have been deleted, or stored + wordlist %2$s not found. (It may have been deleted, or stored on an external card that is no longer available.) You can download a replacement or substitute another %3$s - dictionary. + wordlist. Password for \"%s\": @@ -513,12 +513,12 @@ game on the relay. You will be notified when the remaining device[s] have joined your room and play can begin. - Crosswords dictionaries, which are + Crosswords wordlists, which are just compressed lists of words plus tile information, determine - what language a game is played in and how \"smart\" the robot is. - You can download different sized dictionaries in many languages - here. Email me at eehouse@eehouse.org for information on building - and installing your own dictionaries. + what language a game is played in and how \"smart\" the robot + is. You can download different sized wordlists in many + languages here. Email me at eehouse@eehouse.org for information + on building and installing your own wordlists. Moving tiles to the board:\nYou can drag tiles between the rack and the board, or you can tap an From 47bdec4eda2503b2346dae32549b901833d6e60c Mon Sep 17 00:00:00 2001 From: Andy2 Date: Sat, 20 Aug 2011 21:51:57 -0700 Subject: [PATCH 2/7] pass context into GameSummary constructor rather than into methods that need it. No behavior change. --- .../src/org/eehouse/android/xw4/DBUtils.java | 4 +-- .../eehouse/android/xw4/GameListAdapter.java | 6 ++--- .../org/eehouse/android/xw4/GameUtils.java | 4 +-- .../eehouse/android/xw4/jni/GameSummary.java | 26 ++++++++++--------- .../eehouse/android/xw4/jni/JNIThread.java | 2 +- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java index 9e82f1c59..ca17f6a0a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java @@ -107,7 +107,7 @@ public class DBUtils { Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns, selection, null, null, null, null ); if ( 1 == cursor.getCount() && cursor.moveToFirst() ) { - summary = new GameSummary(); + summary = new GameSummary( context ); summary.nMoves = cursor.getInt(cursor. getColumnIndex(DBHelper.NUM_MOVES)); summary.nPlayers = @@ -223,7 +223,7 @@ public class DBUtils { values.put( DBHelper.TURN, summary.turn ); values.put( DBHelper.GIFLAGS, summary.giflags() ); values.put( DBHelper.PLAYERS, - summary.summarizePlayers(context) ); + summary.summarizePlayers() ); values.put( DBHelper.DICTLANG, summary.dictLang ); values.put( DBHelper.GAME_OVER, summary.gameOver ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java index 1bc3b3f14..a8eb2d1dc 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java @@ -118,7 +118,7 @@ public class GameListAdapter extends XWListAdapter { } else { //Assert.assertNotNull( summary ); - String state = summary.summarizeState( m_context ); + String state = summary.summarizeState(); TextView view = (TextView)layout.findViewById( R.id.game_name ); if ( hideTitle ) { @@ -168,7 +168,7 @@ public class GameListAdapter extends XWListAdapter { View tmp = m_factory.inflate( R.layout.player_list_elem, null ); view = (TextView)tmp.findViewById( R.id.item_name ); - view.setText( summary.summarizePlayer( m_context, ii ) ); + view.setText( summary.summarizePlayer( ii ) ); view = (TextView)tmp.findViewById( R.id.item_score ); view.setText( String.format( " %d", summary.scores[ii] ) ); if ( summary.isNextToPlay( ii ) ) { @@ -200,7 +200,7 @@ public class GameListAdapter extends XWListAdapter { marker.setImageResource( iconID ); view = (TextView)layout.findViewById( R.id.role ); - String roleSummary = summary.summarizeRole( m_context ); + String roleSummary = summary.summarizeRole(); if ( null != roleSummary ) { view.setText( roleSummary ); } else { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index 60e392920..5eeec93a6 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -258,7 +258,7 @@ public class GameUtils { int gamePtr, CurGameInfo gi, FeedUtilsImpl feedImpl ) { - GameSummary summary = new GameSummary( gi ); + GameSummary summary = new GameSummary( context, gi ); XwJNI.game_summarize( gamePtr, summary ); if ( null != feedImpl ) { @@ -984,7 +984,7 @@ public class GameUtils { saveGame( context, gamePtr, gi, lock, false ); - GameSummary summary = new GameSummary( gi ); + GameSummary summary = new GameSummary( context, gi ); XwJNI.game_summarize( gamePtr, summary ); DBUtils.saveSummary( context, lock, summary ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java index 27b783dad..fc27bf958 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java @@ -59,14 +59,16 @@ public class GameSummary { private int m_giFlags; private String m_playersSummary; private CurGameInfo m_gi; + private Context m_context; - public GameSummary(){ + public GameSummary( Context context ) { + m_context = context; pendingMsgLevel = 0; } - public GameSummary( CurGameInfo gi ) + public GameSummary( Context context, CurGameInfo gi ) { - this(); + this( context ); nPlayers = gi.nPlayers; dictLang = gi.dictLang; serverRole = gi.serverRole; @@ -78,7 +80,7 @@ public class GameSummary { return null != relayID; } - public String summarizePlayers( Context context ) + public String summarizePlayers() { String result; if ( null == m_gi ) { @@ -110,25 +112,25 @@ public class GameSummary { m_playersSummary = summary; } - public String summarizeState( Context context ) + public String summarizeState() { String result = null; if ( gameOver ) { - result = context.getString( R.string.gameOver ); + result = m_context.getString( R.string.gameOver ); } else { - result = String.format( context.getString(R.string.movesf), + result = String.format( m_context.getString(R.string.movesf), nMoves ); } return result; } - public String summarizeRole( Context context ) + public String summarizeRole() { String result = null; if ( isRelayGame() ) { Assert.assertTrue( CommsAddrRec.CommsConnType.COMMS_CONN_RELAY == conType ); - String fmt = context.getString( R.string.summary_fmt_relay ); + String fmt = m_context.getString( R.string.summary_fmt_relay ); result = String.format( fmt, roomName ); } return result; @@ -175,14 +177,14 @@ public class GameSummary { m_giFlags = flags; } - public String summarizePlayer( Context context, int indx ) + public String summarizePlayer( int indx ) { String player = players[indx]; int formatID = 0; if ( !isLocal(indx) ) { boolean isMissing = 0 != ((1 << indx) & missingPlayers); if ( isMissing ) { - player = context.getString( R.string.missing_player ); + player = m_context.getString( R.string.missing_player ); } else { formatID = R.string.str_nonlocal_namef; } @@ -191,7 +193,7 @@ public class GameSummary { } if ( 0 != formatID ) { - String format = context.getString( formatID ); + String format = m_context.getString( formatID ); player = String.format( format, player ); } return player; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java index cd733cfef..e9241c973 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java @@ -264,7 +264,7 @@ public class JNIThread extends Thread { XwJNI.server_do( m_jniGamePtr ); XwJNI.game_getGi( m_jniGamePtr, m_gi ); - GameSummary summary = new GameSummary( m_gi ); + GameSummary summary = new GameSummary( m_context, m_gi ); XwJNI.game_summarize( m_jniGamePtr, summary ); byte[] state = XwJNI.game_saveToStream( m_jniGamePtr, null ); GameUtils.saveGame( m_context, state, m_lock, false ); From c41af221b74ca0f3ff959f2146d1e6d239efd33f Mon Sep 17 00:00:00 2001 From: Andy2 Date: Tue, 16 Aug 2011 19:17:47 -0700 Subject: [PATCH 3/7] fix non-debug compile warning --- xwords4/android/XWords4/jni/anddict.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/jni/anddict.c b/xwords4/android/XWords4/jni/anddict.c index b4bfb7ba8..1e6ffe3c7 100644 --- a/xwords4/android/XWords4/jni/anddict.c +++ b/xwords4/android/XWords4/jni/anddict.c @@ -398,7 +398,10 @@ and_dictionary_destroy( DictionaryCtxt* dict ) XP_FREEP( ctxt->super.mpool, &ctxt->super.langName ); if ( NULL == ctxt->byteArray ) { /* mmap case */ - int err = munmap( ctxt->bytes, ctxt->bytesSize ); +#ifdef DEBUG + int err = +#endif + munmap( ctxt->bytes, ctxt->bytesSize ); XP_ASSERT( 0 == err ); } else { (*env)->ReleaseByteArrayElements( env, ctxt->byteArray, ctxt->bytes, 0 ); From c38e3593fbdf3d5c80405b2df1d232e329118eef Mon Sep 17 00:00:00 2001 From: Andy2 Date: Sun, 21 Aug 2011 11:39:38 -0700 Subject: [PATCH 4/7] replace hard-coded placeholder names for optional top-line of games list item display with real "aa vs. bb vs..." consed up in GameSummary, and set field to singleline so doesn't wrap when names get too long. --- .../XWords4/res/layout/game_list_item.xml | 1 + .../android/XWords4/res/values/strings.xml | 1 + .../eehouse/android/xw4/GameListAdapter.java | 2 +- .../eehouse/android/xw4/jni/GameSummary.java | 38 +++++++++++-------- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/xwords4/android/XWords4/res/layout/game_list_item.xml b/xwords4/android/XWords4/res/layout/game_list_item.xml index 500669081..62555d926 100644 --- a/xwords4/android/XWords4/res/layout/game_list_item.xml +++ b/xwords4/android/XWords4/res/layout/game_list_item.xml @@ -38,6 +38,7 @@ android:layout_height="wrap_content" android:gravity="center" android:layout_weight="1" + android:singleLine="true" android:textAppearance="?android:attr/textAppearanceMedium" /> diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 05ad8c121..8cb0be23e 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -124,6 +124,7 @@ %s (remote) %s (remote) + \u0020vs.\u0020 %1$s (%2$s) Bonus for using all tiles: 50\n Score for turn: %d\n diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java index a8eb2d1dc..fbf0d3577 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java @@ -134,7 +134,7 @@ public class GameListAdapter extends XWListAdapter { summary.dictLang ); break; case R.string.game_summary_field_opponents: - value = "vs Kati +2"; + value = summary.playerNames(); break; case R.string.game_summary_field_state: value = state; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java index fc27bf958..51296432a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java @@ -21,6 +21,7 @@ package org.eehouse.android.xw4.jni; import android.content.Context; +import android.text.TextUtils; import junit.framework.Assert; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.Utils; @@ -86,22 +87,11 @@ public class GameSummary { if ( null == m_gi ) { result = m_playersSummary; } else { - StringBuffer sb = new StringBuffer(); - for ( int ii = 0; ; ) { - - int score = 0; - try { - // scores can be null, but I've seen array OOB too. - score = scores[ii]; - } catch ( Exception ex ){} - - sb.append( m_gi.players[ii].name ); - if ( ++ii >= nPlayers ) { - break; - } - sb.append( "\n" ); + String[] names = new String[nPlayers]; + for ( int ii = 0; ii < nPlayers; ++ii ) { + names[ii] = m_gi.players[ii].name; } - result = sb.toString(); + result = TextUtils.join( "\n", names ); m_playersSummary = result; } return result; @@ -199,6 +189,24 @@ public class GameSummary { return player; } + public String playerNames() + { + String[] names = null; + if ( null != m_gi ) { + names = m_gi.visibleNames() + } else if ( null != m_playersSummary ) { + names = TextUtils.split( m_playersSummary, "\n" ); + } + + String result = null; + if ( null != names && 0 < names.length ) { + String joiner = m_context.getString( R.string.vs_join ); + result = TextUtils.join( joiner, names ); + } + + return result; + } + public boolean isNextToPlay( int indx ) { return indx == turn && isLocal(indx); } From 56fd01a05b9d66e624eb0cb0d812e5ae3eb9d088 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Sun, 21 Aug 2011 12:07:21 -0700 Subject: [PATCH 5/7] oops -- missing semicolon. --- .../XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java index 51296432a..6a2dee187 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java @@ -193,7 +193,7 @@ public class GameSummary { { String[] names = null; if ( null != m_gi ) { - names = m_gi.visibleNames() + names = m_gi.visibleNames(); } else if ( null != m_playersSummary ) { names = TextUtils.split( m_playersSummary, "\n" ); } From 5c8afa06ce2bae947435ca849216876f88eec974 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Sun, 21 Aug 2011 12:07:45 -0700 Subject: [PATCH 6/7] version string and changelog for beta 33 --- xwords4/android/XWords4/AndroidManifest.xml | 2 +- xwords4/android/XWords4/res/raw/changes | 32 +++++++++++-------- .../XWords4/res/values/common_rsrc.xml | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/xwords4/android/XWords4/AndroidManifest.xml b/xwords4/android/XWords4/AndroidManifest.xml index b3b869dde..3067e89a4 100644 --- a/xwords4/android/XWords4/AndroidManifest.xml +++ b/xwords4/android/XWords4/AndroidManifest.xml @@ -22,7 +22,7 @@ to come from a domain that you own or have control over. --> diff --git a/xwords4/android/XWords4/res/raw/changes b/xwords4/android/XWords4/res/raw/changes index bb4d2bccd..7ef1b14a2 100644 --- a/xwords4/android/XWords4/res/raw/changes +++ b/xwords4/android/XWords4/res/raw/changes @@ -6,27 +6,33 @@ -Crosswords 4.4 beta 32 release - -

32's a quickie to fix a crash introduced in 31. So I'll leave the -older changes in place

+Crosswords 4.4 beta 33 release
    -
  • Give choice between sending invites as TEXT or HTML, then format - differently depending
  • +
  • Use the term "wordlist" instead of "dictionary" to not imply that + there are definitions provided.
  • -
  • include link in invites to install Crosswords
  • +
  • Change how downloaded wordlists are opened to consume much less + Java memory. Downside: wordlists on external storage are not + available when that storage is mounted on a computer over USB.
  • -
  • Add expand/contract buttons to games list
  • +
  • In the Wordlists screen, hide wordlists stored on external media + when the media's not available. Notice when it becomes available + and redraw the list.
  • + +
  • Make a game's language one of several configurable attributes + that can be displayed along with the game
  • + +
  • Fix rename of games to work when keyboard opened while dialog + up.
  • + +
  • Add icons to games list display so it's easier to tell networked + from standalone. These are placeholders until I can get an artist + to help out. :-)
  • -
  • Add ability to rename games
  • - -
  • Don't crash when user chooses "Copy"
  • -
-

Please remember that this is beta software. Please let me know (at eehouse@eehouse.org) what's broken and what features you'd most like to see.

diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 89f7ac356..0b8d1ba2b 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -78,7 +78,7 @@ http://eehouse.org/and_dicts_hh - 4.4 beta 32 + 4.4 beta 33 //%1$s/redir.php From c0dae019d590a5fba4bd2dd892d7a53994a8443f Mon Sep 17 00:00:00 2001 From: Andy2 Date: Sun, 21 Aug 2011 12:19:58 -0700 Subject: [PATCH 7/7] use same context menu header, including wordlist name, as for game list items. --- .../XWords4/src/org/eehouse/android/xw4/DictsActivity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java index 3cf294cf9..45aabc836 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java @@ -377,6 +377,9 @@ public class DictsActivity extends ExpandableListActivity || ! GameUtils.haveWriteableSD() ) { menu.removeItem( R.id.dicts_item_move ); } + + String fmt = getString(R.string.game_item_menu_titlef ); + menu.setHeaderTitle( String.format( fmt, row.getText() ) ); } }