From 07a0e0ed93c0bef316a2b70191e72cf129e6aa65 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Wed, 27 Nov 2013 07:06:14 -0800
Subject: [PATCH 01/25] fix crash: make thumbnail BEFORE closing game
---
.../XWords4/src/org/eehouse/android/xw4/GameUtils.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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 536c8bc42..ac9d08e6c 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
@@ -746,14 +746,15 @@ public class GameUtils {
// update gi to reflect changes due to messages
XwJNI.game_getGi( gamePtr, gi );
- saveGame( context, gamePtr, gi, lock, false );
- summarizeAndClose( context, lock, gamePtr, gi, feedImpl );
if ( draw && XWPrefs.getThumbEnabled( context ) ) {
Bitmap bitmap = takeSnapshot( context, gamePtr, gi );
DBUtils.saveThumbnail( context, lock, bitmap );
}
+ saveGame( context, gamePtr, gi, lock, false );
+ summarizeAndClose( context, lock, gamePtr, gi, feedImpl );
+
int flags = setFromFeedImpl( feedImpl );
if ( GameSummary.MSG_FLAGS_NONE != flags ) {
draw = true;
From 11bde2b7fdb8482b73afaf7e821e30527c7c1dca Mon Sep 17 00:00:00 2001
From: Eric House
Date: Wed, 27 Nov 2013 07:06:27 -0800
Subject: [PATCH 02/25] remove logging
---
xwords4/android/XWords4/jni/utilwrapper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xwords4/android/XWords4/jni/utilwrapper.c b/xwords4/android/XWords4/jni/utilwrapper.c
index 1da05d0c9..d406ab7ba 100644
--- a/xwords4/android/XWords4/jni/utilwrapper.c
+++ b/xwords4/android/XWords4/jni/utilwrapper.c
@@ -536,7 +536,7 @@ static void
and_util_addrChange( XW_UtilCtxt* uc, const CommsAddrRec* oldAddr,
const CommsAddrRec* newAddr )
{
- LOG_FUNC();
+ // LOG_FUNC();
}
static void
From 69e050c8de9e6ef64dd46413fc47959784db26dc Mon Sep 17 00:00:00 2001
From: Eric House
Date: Wed, 27 Nov 2013 17:14:38 -0800
Subject: [PATCH 03/25] remove linefeeds; add synonyms
---
xwords4/dawg/German/Makefile.sf | 1 +
xwords4/dawg/German/info.txt | 60 ++++++++++++++++-----------------
2 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/xwords4/dawg/German/Makefile.sf b/xwords4/dawg/German/Makefile.sf
index 55d14e438..af4c757b6 100644
--- a/xwords4/dawg/German/Makefile.sf
+++ b/xwords4/dawg/German/Makefile.sf
@@ -31,6 +31,7 @@ $(XWLANG)Main.dict.gz: $(SOURCEDICT) $(MAKEFILE)
file -z $(SOURCEDICT) | grep -q 'UTF-8 Unicode' || exit 1
zcat $< \
| sed 's/;.*$$//' \
+ | tr -d '\r' \
| sed '/^$$/d' \
| sed 's,.,\U\0,g' \
| sed -e 's/ß/SS/g' \
diff --git a/xwords4/dawg/German/info.txt b/xwords4/dawg/German/info.txt
index 7c3ee588f..603fb9392 100644
--- a/xwords4/dawg/German/info.txt
+++ b/xwords4/dawg/German/info.txt
@@ -26,7 +26,7 @@ LANGFILTER: | sed -e 's/ß/SS/g'
# uppercase all
LANGFILTER: | tr [a-zäöü] [A-ZÄÖÜ]
# no words not containing a vowel
-LANGFILTER: | grep '[AEIOUÄÖÜ]'
+# LANGFILTER: | grep '[AEIOUÄÖÜ]'
# none with illegal chars
LANGFILTER: | grep '^[A-ZÄÖÜ]\+$'
@@ -49,34 +49,34 @@ XLOC_HEADER:0x8300
2 0 {"_"}
-5 1 'A'
-1 6 'Ä'
-2 3 'B'
-2 4 'C'
-4 1 'D'
-15 1 'E'
-2 4 'F'
-3 2 'G'
-4 2 'H'
-6 1 'I'
-1 6 'J'
-2 4 'K'
-3 2 'L'
-4 3 'M'
-9 1 'N'
-3 2 'O'
-1 8 'Ö'
-1 4 'P'
-1 10 'Q'
-6 1 'R'
-7 1 'S'
-6 1 'T'
-6 1 'U'
-1 6 'Ü'
-1 6 'V'
-1 3 'W'
-1 8 'X'
-1 10 'Y'
-1 3 'Z'
+5 1 'A|a'
+1 6 'Ä|ä'
+2 3 'B|b'
+2 4 'C|c'
+4 1 'D|d'
+15 1 'E|e'
+2 4 'F|f'
+3 2 'G|g'
+4 2 'H|h'
+6 1 'I|i'
+1 6 'J|j'
+2 4 'K|k'
+3 2 'L|l'
+4 3 'M|m'
+9 1 'N|n'
+3 2 'O|o'
+1 8 'Ö|ö'
+1 4 'P|p'
+1 10 'Q|q'
+6 1 'R|r'
+7 1 'S|s'
+6 1 'T|t'
+6 1 'U|u'
+1 6 'Ü|ü'
+1 6 'V|v'
+1 3 'W|w'
+1 8 'X|x'
+1 10 'Y|y'
+1 3 'Z|z'
# should ignore all after the above
From 6a6e5b2f4f69ea116b0706b1b07fc69ed9a78598 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Thu, 28 Nov 2013 11:42:07 -0800
Subject: [PATCH 04/25] script to ... fetch screenshots
---
xwords4/android/scripts/fetch-screenshots.sh | 49 ++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100755 xwords4/android/scripts/fetch-screenshots.sh
diff --git a/xwords4/android/scripts/fetch-screenshots.sh b/xwords4/android/scripts/fetch-screenshots.sh
new file mode 100755
index 000000000..79b6ac815
--- /dev/null
+++ b/xwords4/android/scripts/fetch-screenshots.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+set -e -u
+
+LIST=""
+ALL=""
+FILE=""
+DIR="/sdcard/Pictures/Screenshots"
+WD=$(pwd)
+
+usage() {
+ [ $# -ge 1 ] && echo "Error: $1"
+ echo "usage: $0 --help | --list | "
+ exit 1
+}
+
+pullFile() {
+ echo "pulling $1"
+ adb pull ${DIR}/$1 ${WD}/
+}
+
+[ $# -eq 1 ] || usage "Requires a single parameter"
+
+while [ $# -ge 1 ]; do
+ echo $1
+ case $1 in
+ --list)
+ LIST=1
+ ;;
+ --help)
+ usage
+ ;;
+ *)
+ FILE=$1
+ ;;
+ esac
+ shift
+done
+
+SHOTS=$(adb shell "ls $DIR")
+
+if [ -n "$FILE" ]; then
+ pullFile ${FILE}
+elif [ -n "$LIST" ]; then
+ for SHOT in $SHOTS; do
+ echo $SHOT
+ done
+fi
+
From 991c042e78d6dfa24700b3d7264a1ab694b65a07 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Thu, 28 Nov 2013 19:01:07 -0800
Subject: [PATCH 05/25] add newbie warning against using Firefox for wordlist
downloads.
---
xwords4/android/XWords4/res/values/common_rsrc.xml | 1 +
xwords4/android/XWords4/res/values/strings.xml | 5 +++++
.../src/org/eehouse/android/xw4/DictsActivity.java | 8 +++++++-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml
index 72aa19275..58b4c5fff 100644
--- a/xwords4/android/XWords4/res/values/common_rsrc.xml
+++ b/xwords4/android/XWords4/res/values/common_rsrc.xml
@@ -102,6 +102,7 @@
key_notagain_newfrom
key_notagain_trading
key_na_lookup
+ key_na_firefox
key_na_browse
key_na_browseall
key_na_values
diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml
index 7bfa92eb2..d1afc4931 100644
--- a/xwords4/android/XWords4/res/values/strings.xml
+++ b/xwords4/android/XWords4/res/values/strings.xml
@@ -2192,4 +2192,9 @@
play – if he/she is also using NFC.
\u0020pct.
+
+ If Android gives you a choice of
+ browsers for viewing the wordlists downloads page, DO NOT choose
+ Firefox. Some versions have a bug that can cause the wordlists to
+ be lost.
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 6fa149cea..e7ab1dfab 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java
@@ -79,6 +79,7 @@ public class DictsActivity extends XWExpandableListActivity
// For new callback alternative
private static final int DELETE_DICT_ACTION = 1;
+ private static final int DOWNLOAD_DICT_ACTION = 2;
private static final int MOVE_DICT = DlgDelegate.DIALOG_LAST + 1;
private static final int SET_DEFAULT = DlgDelegate.DIALOG_LAST + 2;
@@ -643,6 +644,9 @@ public class DictsActivity extends XWExpandableListActivity
clearSelections();
}
break;
+ case DOWNLOAD_DICT_ACTION:
+ startDownload( (Intent)params[0] );
+ break;
default:
Assert.fail();
}
@@ -665,7 +669,9 @@ public class DictsActivity extends XWExpandableListActivity
private void startDownload( int lang, String name )
{
Intent intent = mkDownloadIntent( this, lang, name );
- startDownload( intent );
+ showNotAgainDlgThen( R.string.not_again_firefox,
+ R.string.key_na_firefox,
+ DOWNLOAD_DICT_ACTION, intent );
}
private void startDownload( Intent downloadIntent )
From 2dd56d08afd792c468e4e852c68e8b68517b239d Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 07:15:47 -0800
Subject: [PATCH 06/25] tweak string
---
xwords4/android/XWords4/res/values/strings.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml
index d1afc4931..fa4cbbe5f 100644
--- a/xwords4/android/XWords4/res/values/strings.xml
+++ b/xwords4/android/XWords4/res/values/strings.xml
@@ -1743,7 +1743,7 @@
Welcome
Thanks for installing
- Crosswords! Feel free to enter your name here. It will be used
+ Crosswords!\n\nFeel free to enter your name here. It will be used
when creating new games. (You can change it later in the \"New
game default\" section of Settings.)
From d3ce4aa4c7c1980b8f22716882f1d4b7067f1153 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 07:26:30 -0800
Subject: [PATCH 07/25] fix NPE: jniThread gets turned to null sometimes, so
test
---
.../org/eehouse/android/xw4/BoardView.java | 82 ++++++++++---------
1 file changed, 42 insertions(+), 40 deletions(-)
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
index e2d82c187..0d3e126f3 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
@@ -81,51 +81,53 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
@Override
public boolean onTouchEvent( MotionEvent event )
{
- int action = event.getAction();
- int xx = (int)event.getX();
- int yy = (int)event.getY();
+ boolean wantMore = null != m_jniThread;
+ if ( wantMore ) {
+ int action = event.getAction();
+ int xx = (int)event.getX();
+ int yy = (int)event.getY();
- switch ( action ) {
- case MotionEvent.ACTION_DOWN:
- m_lastSpacing = MULTI_INACTIVE;
- if ( !ConnStatusHandler.handleDown( xx, yy ) ) {
- m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_DOWN, xx, yy );
- }
- break;
- case MotionEvent.ACTION_MOVE:
- if ( ConnStatusHandler.handleMove( xx, yy ) ) {
- } else if ( MULTI_INACTIVE == m_lastSpacing ) {
- m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_MOVE, xx, yy );
- } else {
- int zoomBy = figureZoom( event );
- if ( 0 != zoomBy ) {
- m_jniThread.handle( JNIThread.JNICmd.CMD_ZOOM,
- zoomBy < 0 ? -2 : 2 );
+ switch ( action ) {
+ case MotionEvent.ACTION_DOWN:
+ m_lastSpacing = MULTI_INACTIVE;
+ if ( !ConnStatusHandler.handleDown( xx, yy ) ) {
+ m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_DOWN, xx, yy );
}
- }
- break;
- case MotionEvent.ACTION_UP:
- if ( ConnStatusHandler.handleUp( xx, yy ) ) {
- // do nothing
- } else {
+ break;
+ case MotionEvent.ACTION_MOVE:
+ if ( ConnStatusHandler.handleMove( xx, yy ) ) {
+ } else if ( MULTI_INACTIVE == m_lastSpacing ) {
+ m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_MOVE, xx, yy );
+ } else {
+ int zoomBy = figureZoom( event );
+ if ( 0 != zoomBy ) {
+ m_jniThread.handle( JNIThread.JNICmd.CMD_ZOOM,
+ zoomBy < 0 ? -2 : 2 );
+ }
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ if ( ConnStatusHandler.handleUp( xx, yy ) ) {
+ // do nothing
+ } else {
+ m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_UP, xx, yy );
+ }
+ break;
+ case MotionEvent.ACTION_POINTER_DOWN:
+ case MotionEvent.ACTION_POINTER_2_DOWN:
m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_UP, xx, yy );
+ m_lastSpacing = getSpacing( event );
+ break;
+ case MotionEvent.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_POINTER_2_UP:
+ m_lastSpacing = MULTI_INACTIVE;
+ break;
+ default:
+ DbgUtils.logf( "onTouchEvent: unknown action: %d", action );
+ break;
}
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- case MotionEvent.ACTION_POINTER_2_DOWN:
- m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_UP, xx, yy );
- m_lastSpacing = getSpacing( event );
- break;
- case MotionEvent.ACTION_POINTER_UP:
- case MotionEvent.ACTION_POINTER_2_UP:
- m_lastSpacing = MULTI_INACTIVE;
- break;
- default:
- DbgUtils.logf( "onTouchEvent: unknown action: %d", action );
- break;
}
-
- return true; // required to get subsequent events
+ return wantMore; // true required to get subsequent events
}
// private void printMode( String comment, int mode )
From 08b72bbc556ac6959f6ad21f1b9919ba42758ddf Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 07:35:13 -0800
Subject: [PATCH 08/25] add asserts
---
xwords4/android/XWords4/jni/xwjni.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c
index dcb9d1e47..5682a17ad 100644
--- a/xwords4/android/XWords4/jni/xwjni.c
+++ b/xwords4/android/XWords4/jni/xwjni.c
@@ -350,7 +350,9 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1tilesAreSame
{
jboolean result;
const DictionaryCtxt* dict1 = (DictionaryCtxt*)dictPtr1;
+ XP_ASSERT( !!dict1 );
const DictionaryCtxt* dict2 = (DictionaryCtxt*)dictPtr2;
+ XP_ASSERT( !!dict2 );
result = dict_tilesAreSame( dict1, dict2 );
return result;
}
From 69285d46a94713fcaf685d6967f4dfa438e319c2 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 07:35:31 -0800
Subject: [PATCH 09/25] up version strings for release
---
xwords4/android/XWords4/AndroidManifest.xml | 2 +-
xwords4/android/XWords4/res/raw/changes | 11 +++++++----
xwords4/android/XWords4/res/values/app_name.xml | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/xwords4/android/XWords4/AndroidManifest.xml b/xwords4/android/XWords4/AndroidManifest.xml
index 1a11b34b1..7bb24bad8 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 df173bb78..b96527366 100644
--- a/xwords4/android/XWords4/res/raw/changes
+++ b/xwords4/android/XWords4/res/raw/changes
@@ -5,13 +5,16 @@
-Crosswords 4.4 beta 73 release
+Crosswords 4.4 beta 74 release
-This release adds two new features, snapshots of in-progress games
+
(Beta 74 fixes a crashing bug but adds nothing new, so the
+ previous notes remain in place.)
+
+Beta 73 adds two new features, snapshots of in-progress games
displayed as part of the main Games List screen, and the ability to
send invitations by tapping your device against the one you want to
- invite (using "Near Field Communication", or NFC, which Google
- brands "Android beaming".)
+ invite (using "Near Field Communication", or NFC, which
+ Google brands "Android beaming".)
Both features are optional. NFC is off by default, so you have to
enable it via Google's system Preferences app. And snapshots, while
diff --git a/xwords4/android/XWords4/res/values/app_name.xml b/xwords4/android/XWords4/res/values/app_name.xml
index d5d0bef2c..04d122b18 100644
--- a/xwords4/android/XWords4/res/values/app_name.xml
+++ b/xwords4/android/XWords4/res/values/app_name.xml
@@ -1,5 +1,5 @@
- 4.4 beta 73
+ 4.4 beta 74
From 26eff37c6bfd50f82f69fd6ba750976150ecda2c Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 08:43:21 -0800
Subject: [PATCH 10/25] move BoardDims into jni/
---
.../org/eehouse/android/xw4/BoardCanvas.java | 3 +-
.../eehouse/android/xw4/jni/BoardDims.java | 48 +++++++++++++++++++
.../eehouse/android/xw4/jni/JNIThread.java | 3 +-
.../eehouse/android/xw4/jni/SyncedDraw.java | 2 +-
.../org/eehouse/android/xw4/jni/XwJNI.java | 2 +-
5 files changed, 53 insertions(+), 5 deletions(-)
create mode 100644 xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardDims.java
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
index 0f26451f4..efc624162 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
@@ -32,9 +32,10 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Handler;
+import org.eehouse.android.xw4.jni.BoardDims;
+import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.DrawCtx;
import org.eehouse.android.xw4.jni.DrawScoreInfo;
-import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.jni.XwJNI;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardDims.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardDims.java
new file mode 100644
index 000000000..da2ab5dd6
--- /dev/null
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardDims.java
@@ -0,0 +1,48 @@
+/* -*- compile-command: "cd ../../../../../../; ant debug install"; -*- */
+/*
+ * Copyright 2009-2013 by Eric House (xwords@eehouse.org). All rights
+ * reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package org.eehouse.android.xw4.jni;
+
+
+// Why does this have to be its own class...
+public class BoardDims {
+ public int left, top;
+ public int width, height; // of the bitmap
+ public int scoreWidth, scoreHt;
+ public int boardWidth, boardHt;
+ public int trayTop, trayHt;
+ public int cellSize, maxCellSize;
+ public int timerWidth;
+
+ // public String toString()
+ // {
+ // return "width: " + width
+ // + " height: " + height
+ // + " left: " + left
+ // + " top: " + top
+ // + " scoreHt: " + scoreHt
+ // + " scoreWidth: " + scoreWidth
+ // + " boardHt: " + boardHt
+ // + " trayTop: " + trayTop
+ // + " trayHt: " + trayHt
+ // + " cellSize: " + cellSize
+ // + " maxCellSize: " + maxCellSize;
+ // }
+}
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 cde724d42..2e2cc560b 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
@@ -32,7 +32,6 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.concurrent.LinkedBlockingQueue;
-import org.eehouse.android.xw4.BoardDims;
import org.eehouse.android.xw4.ConnStatusHandler;
import org.eehouse.android.xw4.DBUtils;
import org.eehouse.android.xw4.DbgUtils;
@@ -352,7 +351,7 @@ public class JNIThread extends Thread {
break;
case CMD_SETDRAW:
- XwJNI.board_setDraw( m_jniGamePtr, (DrawCtx)args[0] );
+ XwJNI.board_setDraw( m_jniGamePtr, (DrawCtx)args[0] ); // here
XwJNI.board_invalAll( m_jniGamePtr );
break;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/SyncedDraw.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/SyncedDraw.java
index 12c946bb2..c473c963f 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/SyncedDraw.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/SyncedDraw.java
@@ -21,7 +21,7 @@
package org.eehouse.android.xw4.jni;
import android.graphics.Rect;
-import org.eehouse.android.xw4.BoardDims;
+import org.eehouse.android.xw4.jni.BoardDims;
public interface SyncedDraw {
void doJNIDraw();
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
index e4e4082e0..fc81da1ac 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
@@ -21,7 +21,7 @@
package org.eehouse.android.xw4.jni;
import android.graphics.Rect;
-import org.eehouse.android.xw4.BoardDims;
+import org.eehouse.android.xw4.jni.BoardDims;
// Collection of native methods
public class XwJNI {
From 60026b6ef23312c0ce9f41e7f7832deccd1e999a Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 08:43:34 -0800
Subject: [PATCH 11/25] move BoardDims into jni/
---
.../org/eehouse/android/xw4/BoardDims.java | 48 -------------------
1 file changed, 48 deletions(-)
delete mode 100644 xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDims.java
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDims.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDims.java
deleted file mode 100644
index be320f098..000000000
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDims.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- compile-command: "cd ../../../../../; ant debug install"; -*- */
-/*
- * Copyright 2009-2010 by Eric House (xwords@eehouse.org). All
- * rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-package org.eehouse.android.xw4;
-
-
-// Why does this have to be its own class...
-public class BoardDims {
- public int left, top;
- public int width, height; // of the bitmap
- public int scoreWidth, scoreHt;
- public int boardWidth, boardHt;
- public int trayTop, trayHt;
- public int cellSize, maxCellSize;
- public int timerWidth;
-
- // public String toString()
- // {
- // return "width: " + width
- // + " height: " + height
- // + " left: " + left
- // + " top: " + top
- // + " scoreHt: " + scoreHt
- // + " scoreWidth: " + scoreWidth
- // + " boardHt: " + boardHt
- // + " trayTop: " + trayTop
- // + " trayHt: " + trayHt
- // + " cellSize: " + cellSize
- // + " maxCellSize: " + maxCellSize;
- // }
-}
From 79b60ae895d0c312a8fa142f4300f2af11cb36d9 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 08:48:13 -0800
Subject: [PATCH 12/25] cleanup
---
.../XWords4/src/org/eehouse/android/xw4/jni/SyncedDraw.java | 1 -
.../XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java | 6 +-----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/SyncedDraw.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/SyncedDraw.java
index c473c963f..440e1f413 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/SyncedDraw.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/SyncedDraw.java
@@ -21,7 +21,6 @@
package org.eehouse.android.xw4.jni;
import android.graphics.Rect;
-import org.eehouse.android.xw4.jni.BoardDims;
public interface SyncedDraw {
void doJNIDraw();
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
index fc81da1ac..ee1fd64e6 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
@@ -21,16 +21,12 @@
package org.eehouse.android.xw4.jni;
import android.graphics.Rect;
-import org.eehouse.android.xw4.jni.BoardDims;
// Collection of native methods
public class XwJNI {
-
// This needs to be called before the first attempt to use the
- // jni. I figure this class has to be loaded before that cna
- // happen. Doing this in GamesList isn't enough because sometimes
- // BoardActivity is the first Activity loaded.
+ // jni.
static {
System.loadLibrary("xwjni");
}
From 9f22386bf632977041d260d4309d8d0992cc861d Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 10:15:22 -0800
Subject: [PATCH 13/25] another assert
---
xwords4/common/dictnry.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/xwords4/common/dictnry.c b/xwords4/common/dictnry.c
index edf97cb22..a33412f09 100644
--- a/xwords4/common/dictnry.c
+++ b/xwords4/common/dictnry.c
@@ -74,6 +74,7 @@ dict_getBlankTile( const DictionaryCtxt* dict )
XP_U16
dict_getTileValue( const DictionaryCtxt* dict, Tile tile )
{
+ XP_ASSERT( !!dict );
if ( (tile & TILE_VALUE_MASK) != tile ) {
XP_ASSERT( tile == 32 &&
tile == dict_getBlankTile( dict ) );
From dd5aaa41fae3508088f64c6cf7dd849a2e6c03ed Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 10:21:06 -0800
Subject: [PATCH 14/25] erase full divider rect to fix leftover tile bottom
after it's been moved.
---
.../XWords4/src/org/eehouse/android/xw4/BoardCanvas.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
index efc624162..958d5b88f 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
@@ -495,10 +495,9 @@ public class BoardCanvas extends Canvas implements DrawCtx {
boolean selected = 0 != (flags & CELL_HIGHLIGHT);
int index = isCursor? CommonPrefs.COLOR_FOCUS : CommonPrefs.COLOR_BACKGRND;
- rect.inset( 0, 1 );
fillRectOther( rect, index );
- rect.inset( rect.width()/4, 0 );
+ rect.inset( rect.width()/4, 1 );
if ( selected ) {
drawRect( rect, m_strokePaint );
} else {
From b7e44195c6401e409b865a2f336cdfde8c14c1c2 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Fri, 29 Nov 2013 16:14:18 -0800
Subject: [PATCH 15/25] replace ARGB_8888 with RGB_565 where possible to halve
memory footprint of bitmaps
---
.../XWords4/src/org/eehouse/android/xw4/BoardCanvas.java | 2 +-
.../android/XWords4/src/org/eehouse/android/xw4/BoardView.java | 2 +-
.../XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java | 2 +-
.../android/XWords4/src/org/eehouse/android/xw4/GameUtils.java | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
index 958d5b88f..0f7fca16b 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
@@ -844,7 +844,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
if ( !useDark ) {
Bitmap src = ((BitmapDrawable)arrow).getBitmap();
- Bitmap bitmap = src.copy( Bitmap.Config.ARGB_8888, true );
+ Bitmap bitmap = src.copy( Bitmap.Config.RGB_565, true );
for ( int xx = 0; xx < bitmap.getWidth(); ++xx ) {
for( int yy = 0; yy < bitmap.getHeight(); ++yy ) {
if ( BLACK == bitmap.getPixel( xx, yy ) ) {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
index 0d3e126f3..bb49895fe 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
@@ -229,7 +229,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
if ( null == s_bitmap ) {
s_bitmap = Bitmap.createBitmap( bmWidth, bmHeight,
- Bitmap.Config.ARGB_8888 );
+ Bitmap.Config.RGB_565 );
}
if ( null == m_canvas ) {
m_canvas = new BoardCanvas( m_parent, s_bitmap, m_jniThread,
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java
index 28b89470f..d9227ab4c 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java
@@ -179,7 +179,7 @@ public class ExpiringDelegate {
private Drawable mkBackground( int pct )
{
Assert.assertTrue( 0 <= pct && pct <= 100 );
- Bitmap bm = Bitmap.createBitmap( 100, 1, Bitmap.Config.ARGB_8888 );
+ Bitmap bm = Bitmap.createBitmap( 100, 1, Bitmap.Config.RGB_565 );
Canvas canvas = new Canvas(bm);
Paint paint = new Paint();
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 ac9d08e6c..646f2ccf6 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
@@ -343,7 +343,7 @@ public class GameUtils {
int size = dim - (dim % nCols);
thumb = Bitmap.createBitmap( size, size,
- Bitmap.Config.ARGB_8888 );
+ Bitmap.Config.RGB_565 );
XwJNI.board_figureLayout( gamePtr, gi, 0, 0, size, size,
0, 0, 0, 20, 20, false, null );
From 041385049d7c3fbd5aafab24abbb271d1de97b71 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Sat, 30 Nov 2013 00:28:43 -0800
Subject: [PATCH 16/25] add a bit of space separating explanatory text from
spinner
---
xwords4/android/XWords4/res/layout/confirm_sms.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/xwords4/android/XWords4/res/layout/confirm_sms.xml b/xwords4/android/XWords4/res/layout/confirm_sms.xml
index 0140c9ea6..11de98048 100644
--- a/xwords4/android/XWords4/res/layout/confirm_sms.xml
+++ b/xwords4/android/XWords4/res/layout/confirm_sms.xml
@@ -16,6 +16,7 @@
android:layout_width="fill_parent"
android:text="@string/confirm_sms_expl"
android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_marginBottom="10dip"
/>
Date: Sun, 1 Dec 2013 18:32:51 -0800
Subject: [PATCH 17/25] don't draw timer if it has an empty rect
---
xwords4/common/scorebdp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xwords4/common/scorebdp.c b/xwords4/common/scorebdp.c
index 1d0adbbc0..4e3aca1bc 100644
--- a/xwords4/common/scorebdp.c
+++ b/xwords4/common/scorebdp.c
@@ -357,7 +357,8 @@ figureSecondsLeft( BoardCtxt* board )
void
drawTimer( BoardCtxt* board )
{
- if ( board->gi->timerEnabled ) {
+ if ( board->gi->timerEnabled && 0 < board->timerBounds.width
+ && 0 < board->timerBounds.height ) {
XP_S16 secondsLeft = figureSecondsLeft( board );
draw_drawTimer( board->draw, &board->timerBounds,
From fc6d6ec70781eeaa72daaaeae894af98f69c2f34 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Sun, 1 Dec 2013 18:37:21 -0800
Subject: [PATCH 18/25] use local variable
---
xwords4/common/game.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/xwords4/common/game.c b/xwords4/common/game.c
index d35d0fb9a..4bc6259e9 100644
--- a/xwords4/common/game.c
+++ b/xwords4/common/game.c
@@ -316,15 +316,16 @@ game_getState( const XWGame* game, GameStateInfo* gsi )
{
XP_Bool gameOver = server_getGameIsOver( game->server );
- gsi->curTurnSelected = board_curTurnSelected( game->board );
- gsi->trayVisState = board_getTrayVisState( game->board );
- gsi->visTileCount = board_visTileCount( game->board );
- gsi->canHint = !gameOver && board_canHint( game->board );
- gsi->canRedo = board_canTogglePending( game->board );
- gsi->inTrade = board_inTrade( game->board, &gsi->tradeTilesSelected );
+ BoardCtxt* board = game->board;
+ gsi->curTurnSelected = board_curTurnSelected( board );
+ gsi->trayVisState = board_getTrayVisState( board );
+ gsi->visTileCount = board_visTileCount( board );
+ gsi->canHint = !gameOver && board_canHint( board );
+ gsi->canRedo = board_canTogglePending( board );
+ gsi->inTrade = board_inTrade( board, &gsi->tradeTilesSelected );
gsi->canChat = !!game->comms && comms_canChat( game->comms );
- gsi->canShuffle = board_canShuffle( game->board );
- gsi->canHideRack = board_canHideRack( game->board );
+ gsi->canShuffle = board_canShuffle( board );
+ gsi->canHideRack = board_canHideRack( board );
}
void
From 9fa9ba643f164054e08d6abfc64ffd314fc089e7 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Sun, 1 Dec 2013 18:50:18 -0800
Subject: [PATCH 19/25] fix linux crash when timers enabled: clear timer while
taking down board
---
xwords4/common/board.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/xwords4/common/board.c b/xwords4/common/board.c
index 93f6272e5..f40984bbd 100644
--- a/xwords4/common/board.c
+++ b/xwords4/common/board.c
@@ -99,6 +99,8 @@ static void invalTradeWindow( BoardCtxt* board, XP_S16 turn, XP_Bool redraw );
static XP_Bool invalCellsWithTiles( BoardCtxt* board );
static void setTimerIf( BoardCtxt* board );
+static void clearTimerIf( const BoardCtxt* board );
+
static XP_Bool p_board_timerFired( void* closure, XWTimerReason why );
static XP_Bool replaceLastTile( BoardCtxt* board );
@@ -193,6 +195,7 @@ board_make( MPFORMAL ModelCtxt* model, ServerCtxt* server, DrawCtx* draw,
void
board_destroy( BoardCtxt* board )
{
+ clearTimerIf( board );
XP_FREE( board->mpool, board );
} /* board_destroy */
@@ -1234,6 +1237,12 @@ setTimerIf( BoardCtxt* board )
}
} /* setTimerIf */
+static void
+clearTimerIf( const BoardCtxt* board )
+{
+ util_clearTimer( board->util, TIMER_TIMERTICK );
+}
+
static void
timerFiredForTimer( BoardCtxt* board )
{
From 9b6f8d18e0c2bc3f9b59679f69e74f28a741ee84 Mon Sep 17 00:00:00 2001
From: Eric House
Date: Sun, 1 Dec 2013 19:04:44 -0800
Subject: [PATCH 20/25] fix timer: don't reinit secondsUsed to 0 every time
game loaded
---
xwords4/android/XWords4/jni/xwjni.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c
index 5682a17ad..ff3d4bd56 100644
--- a/xwords4/android/XWords4/jni/xwjni.c
+++ b/xwords4/android/XWords4/jni/xwjni.c
@@ -54,6 +54,11 @@ static const SetInfo gi_bools[] = {
,ARR_MEMBER( CurGameInfo, allowHintRect )
};
+static const SetInfo pl_ints[] = {
+ ARR_MEMBER( LocalPlayer, robotIQ )
+ ,ARR_MEMBER( LocalPlayer, secondsUsed )
+};
+
static CurGameInfo*
makeGI( MPFORMAL JNIEnv* env, jobject jgi )
{
@@ -95,7 +100,8 @@ makeGI( MPFORMAL JNIEnv* env, jobject jgi )
jobject jlp = (*env)->GetObjectArrayElement( env, jplayers, ii );
XP_ASSERT( !!jlp );
- lp->robotIQ = getInt( env, jlp, "robotIQ" );
+ getInts( env, (void*)lp, jlp, pl_ints, VSIZE(pl_ints) );
+
lp->isLocal = getBool( env, jlp, "isLocal" );
getString( env, jlp, "name", buf, VSIZE(buf) );
@@ -105,8 +111,6 @@ makeGI( MPFORMAL JNIEnv* env, jobject jgi )
getString( env, jlp, "dictName", buf, VSIZE(buf) );
lp->dictName = copyString( mpool, buf );
- lp->secondsUsed = 0;
-
deleteLocalRef( env, jlp );
}
deleteLocalRef( env, jplayers );
@@ -143,12 +147,12 @@ setJGI( JNIEnv* env, jobject jgi, const CurGameInfo* gi )
jobject jlp = (*env)->GetObjectArrayElement( env, jplayers, ii );
XP_ASSERT( !!jlp );
- setInt( env, jlp, "robotIQ", lp->robotIQ );
+ setInts( env, jlp, (void*)lp, pl_ints, VSIZE(pl_ints) );
+
setBool( env, jlp, "isLocal", lp->isLocal );
setString( env, jlp, "name", lp->name );
setString( env, jlp, "password", lp->password );
setString( env, jlp, "dictName", lp->dictName );
- setInt( env, jlp, "secondsUsed", lp->secondsUsed );
deleteLocalRef( env, jlp );
}
From 968b1ba32169aeb764acbd89e1918bac5a6ddfcb Mon Sep 17 00:00:00 2001
From: Eric House
Date: Sun, 1 Dec 2013 20:31:35 -0800
Subject: [PATCH 21/25] fix crash on small-screen devices by adding missing
menuitem
---
xwords4/android/XWords4/res/menu-small/board_menu.xml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/xwords4/android/XWords4/res/menu-small/board_menu.xml b/xwords4/android/XWords4/res/menu-small/board_menu.xml
index 66746f946..4f66c163a 100644
--- a/xwords4/android/XWords4/res/menu-small/board_menu.xml
+++ b/xwords4/android/XWords4/res/menu-small/board_menu.xml
@@ -2,6 +2,10 @@