From 36adf7f86c9268c18e9180d142da55f04fb4e1e2 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 31 Jul 2015 07:12:27 -0700 Subject: [PATCH 01/17] get rid of About menuitem in board -- in main view is enough --- xwords4/android/XWords4/res/menu-small/board_menu.xml | 5 ----- xwords4/android/XWords4/res/menu/board_menu.xml | 4 ---- .../XWords4/src/org/eehouse/android/xw4/BoardDelegate.java | 4 ---- 3 files changed, 13 deletions(-) diff --git a/xwords4/android/XWords4/res/menu-small/board_menu.xml b/xwords4/android/XWords4/res/menu-small/board_menu.xml index fe5c90f2f..f933fe7b9 100644 --- a/xwords4/android/XWords4/res/menu-small/board_menu.xml +++ b/xwords4/android/XWords4/res/menu-small/board_menu.xml @@ -93,11 +93,6 @@ android:title="@string/menu_prefs" android:alphabeticShortcut="P" /> - - diff --git a/xwords4/android/XWords4/res/menu/board_menu.xml b/xwords4/android/XWords4/res/menu/board_menu.xml index dfec84b14..65cffc8d2 100644 --- a/xwords4/android/XWords4/res/menu/board_menu.xml +++ b/xwords4/android/XWords4/res/menu/board_menu.xml @@ -65,10 +65,6 @@ android:title="@string/menu_prefs" android:alphabeticShortcut="P" /> - diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java index d11b650d8..db6f32c9e 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java @@ -920,10 +920,6 @@ public class BoardDelegate extends DelegateBase Utils.launchSettings( m_activity ); break; - case R.id.board_menu_file_about: - showAboutDialog(); - break; - default: DbgUtils.logf( "menuitem %d not handled", id ); handled = false; From 81834bcbfab89230858f13890c3f8ce68b1d1a66 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 31 Jul 2015 07:10:19 -0700 Subject: [PATCH 02/17] provide app name in variant too to fix empty substitution errors (e.g. About menutem) --- xwords4/android/XWords4-dbg/build.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xwords4/android/XWords4-dbg/build.xml b/xwords4/android/XWords4-dbg/build.xml index dd73d82c4..76facd222 100644 --- a/xwords4/android/XWords4-dbg/build.xml +++ b/xwords4/android/XWords4-dbg/build.xml @@ -54,6 +54,8 @@ + + From b56924b030e2892c92a264c74b32b3214485edfd Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 2 Aug 2015 16:29:53 -0700 Subject: [PATCH 03/17] fix off-by-one error that probably had me slowly leaking local obj references for the last few years. --- xwords4/android/XWords4/jni/andutils.c | 4 ++-- xwords4/android/XWords4/jni/andutils.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/jni/andutils.c b/xwords4/android/XWords4/jni/andutils.c index ec2c9cbe6..25ac4b227 100644 --- a/xwords4/android/XWords4/jni/andutils.c +++ b/xwords4/android/XWords4/jni/andutils.c @@ -659,10 +659,10 @@ void deleteLocalRef( JNIEnv* env, jobject jobj ) } void -deleteLocalRefs( JNIEnv* env, jobject jobj, ... ) +deleteLocalRefs( JNIEnv* env, ... ) { va_list ap; - va_start( ap, jobj ); + va_start( ap, env ); for ( ; ; ) { jobject jnext = va_arg( ap, jobject ); if ( DELETE_NO_REF == jnext ) { diff --git a/xwords4/android/XWords4/jni/andutils.h b/xwords4/android/XWords4/jni/andutils.h index 214c41022..f66af6a89 100644 --- a/xwords4/android/XWords4/jni/andutils.h +++ b/xwords4/android/XWords4/jni/andutils.h @@ -97,6 +97,6 @@ jint jEnumToInt( JNIEnv* env, jobject jenum ); XP_U32 getCurSeconds( JNIEnv* env ); void deleteLocalRef( JNIEnv* env, jobject jobj ); -void deleteLocalRefs( JNIEnv* env, jobject jobj, ... ); +void deleteLocalRefs( JNIEnv* env, ... ); # define DELETE_NO_REF ((jobject)-1) /* terminates above varargs list */ #endif From b500a4646d97b272cbc0d3b676befb0e721b770a Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 29 Jul 2015 19:48:56 -0700 Subject: [PATCH 04/17] use different uuid for dbg variant so it's not cross-sending BT messages with other variants, causing among other problems spurious "deleted on other device" warnings. --- xwords4/android/XWords4/jni/Android.mk | 1 + xwords4/android/XWords4/jni/xwjni.c | 10 ++++++++-- xwords4/android/scripts/common_targets.xml | 1 + xwords4/common/comms.h | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4/jni/Android.mk b/xwords4/android/XWords4/jni/Android.mk index 9f02d5721..b0c291a38 100644 --- a/xwords4/android/XWords4/jni/Android.mk +++ b/xwords4/android/XWords4/jni/Android.mk @@ -41,6 +41,7 @@ LOCAL_DEFINES += \ -DCOMMON_LAYOUT \ -DCOMMS_VERSION=1 \ -DINITIAL_CLIENT_VERS=${INITIAL_CLIENT_VERS} \ + -DVARIANT=\"${VARIANT}\" \ -DRELAY_ROOM_DEFAULT=\"\" \ -D__LITTLE_ENDIAN \ diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index 29ae3ea43..5248bd815 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -471,8 +471,14 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getUUID { jstring jstr = NULL; #ifdef XWFEATURE_BLUETOOTH - const char* uuid = XW_BT_UUID; - XP_LOGF( "uuid: %s", uuid ); + const char* uuid; + if ( 0 == XP_STRCMP( VARIANT, "xw4" ) ) { + uuid = XW_BT_UUID; + } else if ( 0 == XP_STRCMP( VARIANT, "xw4dbg" ) ) { + uuid = XW_BT_UUID_DBG; + } else { + XP_ASSERT(0); + } jstr = (*env)->NewStringUTF( env, uuid ); #endif return jstr; diff --git a/xwords4/android/scripts/common_targets.xml b/xwords4/android/scripts/common_targets.xml index ef91f60e6..83a1c640b 100644 --- a/xwords4/android/scripts/common_targets.xml +++ b/xwords4/android/scripts/common_targets.xml @@ -35,6 +35,7 @@ + Date: Sat, 1 Aug 2015 22:17:13 -0700 Subject: [PATCH 05/17] fix NPE reported by crittercism --- .../XWords4/src/org/eehouse/android/xw4/BoardDelegate.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java index db6f32c9e..4d3dd8de2 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java @@ -2119,7 +2119,8 @@ public class BoardDelegate extends DelegateBase private void pingBTRemotes() { - if ( m_connTypes.contains( CommsConnType.COMMS_CONN_BT ) ) { + if ( null != m_connTypes + && m_connTypes.contains( CommsConnType.COMMS_CONN_BT ) ) { CommsAddrRec[] addrs = XwJNI.comms_getAddrs( m_jniGamePtr ); for ( CommsAddrRec addr : addrs ) { if ( addr.contains( CommsConnType.COMMS_CONN_BT ) ) { From 6871ef24a6a6c65aa6bf8453dd516832f395703f Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 1 Aug 2015 22:39:00 -0700 Subject: [PATCH 06/17] move several strings, including app name, NBS port, and url prefix, into generated .xml file so Dbg and regular variants can co-exist better Conflicts: xwords4/android/XWords4/archive/R.java --- .../android/XWords4-dbg/res/values/.gitignore | 3 ++- xwords4/android/XWords4/res/values/.gitignore | 2 +- .../XWords4/res/values/common_rsrc.xml | 3 --- xwords4/android/scripts/genvers.sh | 24 +++++++++++++++++-- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/xwords4/android/XWords4-dbg/res/values/.gitignore b/xwords4/android/XWords4-dbg/res/values/.gitignore index 72e6f3e45..3347fc597 100644 --- a/xwords4/android/XWords4-dbg/res/values/.gitignore +++ b/xwords4/android/XWords4-dbg/res/values/.gitignore @@ -1,4 +1,5 @@ -git_string.xml strings.xml styles.xml common_rsrc.xml +gen_strings.xml +app_name.xml diff --git a/xwords4/android/XWords4/res/values/.gitignore b/xwords4/android/XWords4/res/values/.gitignore index 02baea630..a8f81aa73 100644 --- a/xwords4/android/XWords4/res/values/.gitignore +++ b/xwords4/android/XWords4/res/values/.gitignore @@ -1 +1 @@ -/git_string.xml +/gen_strings.xml diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 47b6085b8..ead3423ee 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -139,15 +139,12 @@ eehouse.org application/org.eehouse.android.xw4 eehouse.org - /and/ application/x-xwordsinvite http://eehouse.org/and_wordlists http://eehouse.org/xw4/info.py - 3344 - diff --git a/xwords4/android/scripts/genvers.sh b/xwords4/android/scripts/genvers.sh index 7f77f5b71..0a828d42e 100755 --- a/xwords4/android/scripts/genvers.sh +++ b/xwords4/android/scripts/genvers.sh @@ -22,6 +22,23 @@ cd ../ GITVERSION=$(../scripts/gitversion.sh) +case $VARIANT in + xw4) + APPNAME=Crosswords + SMSPORT=3344 + INVITE_PREFIX=/and/ + ;; + xw4dbg) + APPNAME=CrossDbg + SMSPORT=3345 + INVITE_PREFIX=/anddbg/ + ;; + *) + usage + ;; +esac + + # Need to verify that R.java is unmodified; otherwise we can't set # this constant!!! Shouldn't be a problem with release builds, # though. @@ -31,12 +48,15 @@ fi # TODO: deal with case where there's no hash available -- exported # code maybe? Better: gitversion.sh does that. -cat < ${BUILD_DIR}/res/values/git_string.xml +cat < ${BUILD_DIR}/res/values/gen_strings.xml - + + $APPNAME $GITVERSION + $SMSPORT + $INVITE_PREFIX EOF From a5f332dd1d814d1b833b0afad18994f3d4895e30 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 2 Aug 2015 10:29:17 -0700 Subject: [PATCH 07/17] different logging TAG for different variants --- .../android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java | 2 +- xwords4/android/scripts/genvers.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java index 971abf66a..c7c24a3dc 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java @@ -43,7 +43,7 @@ import junit.framework.Assert; import org.eehouse.android.xw4.loc.LocUtils; public class DbgUtils { - private static final String TAG = "XW4"; + private static final String TAG = BuildConstants.DBG_TAG; private static boolean s_doLog = BuildConfig.DEBUG; private static Time s_time = new Time(); diff --git a/xwords4/android/scripts/genvers.sh b/xwords4/android/scripts/genvers.sh index 0a828d42e..6a7ab7cb5 100755 --- a/xwords4/android/scripts/genvers.sh +++ b/xwords4/android/scripts/genvers.sh @@ -27,11 +27,13 @@ case $VARIANT in APPNAME=Crosswords SMSPORT=3344 INVITE_PREFIX=/and/ + DBG_TAG=XW4 ;; xw4dbg) APPNAME=CrossDbg SMSPORT=3345 INVITE_PREFIX=/anddbg/ + DBG_TAG=X4BG ;; *) usage @@ -75,6 +77,7 @@ class BuildConstants { public static final boolean CHAT_SUPPORTED = $CHAT_SUPPORTED; public static final boolean THUMBNAIL_SUPPORTED = $THUMBNAIL_SUPPORTED; public static final long BUILD_STAMP = $(date +'%s'); + public static final String DBG_TAG = "$DBG_TAG"; } EOF From 1e7f51a88d1cd2a41c36297529a86733ad74dd75 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 2 Aug 2015 14:14:19 -0700 Subject: [PATCH 08/17] move last-pressed button to bottom of screen where it's natural to look for it --- xwords4/android/XWords4/res/layout/smsinviter.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xwords4/android/XWords4/res/layout/smsinviter.xml b/xwords4/android/XWords4/res/layout/smsinviter.xml index bc8255fb7..7487a14e3 100644 --- a/xwords4/android/XWords4/res/layout/smsinviter.xml +++ b/xwords4/android/XWords4/res/layout/smsinviter.xml @@ -28,13 +28,6 @@ android:padding="20dp" /> -