diff --git a/xwords4/android/XWords4/jni/Android.mk b/xwords4/android/XWords4/jni/Android.mk
index b60f6f5eb..c99c35a1e 100644
--- a/xwords4/android/XWords4/jni/Android.mk
+++ b/xwords4/android/XWords4/jni/Android.mk
@@ -37,6 +37,7 @@ LOCAL_DEFINES += \
-DHASH_STREAM \
-DXWFEATURE_BASE64 \
-DXWFEATURE_DEVID \
+ -DCOMMON_LAYOUT \
-DINITIAL_CLIENT_VERS=${INITIAL_CLIENT_VERS} \
-DRELAY_ROOM_DEFAULT=\"\" \
-D__LITTLE_ENDIAN \
diff --git a/xwords4/android/XWords4/jni/andutils.c b/xwords4/android/XWords4/jni/andutils.c
index c3530ce08..f9c45c288 100644
--- a/xwords4/android/XWords4/jni/andutils.c
+++ b/xwords4/android/XWords4/jni/andutils.c
@@ -107,7 +107,7 @@ getInts( JNIEnv* env, void* cobj, jobject jobj, const SetInfo* sis, XP_U16 nSis
*ptr = val;
break;
}
- /* XP_LOGF( "%s: wrote int %s of size %dwith val %d at offset %d", */
+ /* XP_LOGF( "%s: wrote int %s of size %d with val %d at offset %d", */
/* __func__, si->name, si->siz, val, si->offset ); */
}
}
diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c
index 4aae6f509..0d365d5db 100644
--- a/xwords4/android/XWords4/jni/xwjni.c
+++ b/xwords4/android/XWords4/jni/xwjni.c
@@ -158,6 +158,36 @@ setJGI( JNIEnv* env, jobject jgi, const CurGameInfo* gi )
}
} /* setJGI */
+#ifdef COMMON_LAYOUT
+static const SetInfo bd_ints[] = {
+ ARR_MEMBER( BoardDims, left )
+ ,ARR_MEMBER( BoardDims, top )
+ ,ARR_MEMBER( BoardDims, width )
+ ,ARR_MEMBER( BoardDims, height )
+ ,ARR_MEMBER( BoardDims, scoreHt )
+ ,ARR_MEMBER( BoardDims, boardHt )
+ ,ARR_MEMBER( BoardDims, trayTop )
+ ,ARR_MEMBER( BoardDims, trayHt )
+ ,ARR_MEMBER( BoardDims, cellSize )
+ ,ARR_MEMBER( BoardDims, maxCellSize )
+ ,ARR_MEMBER( BoardDims, timerWidth )
+};
+
+static void
+dimsJToC( JNIEnv* env, BoardDims* out, jobject jdims )
+{
+ getInts( env, (void*)out, jdims, bd_ints, VSIZE(bd_ints) );
+}
+
+static void
+dimsCtoJ( JNIEnv* env, jobject jdims, const BoardDims* in )
+{
+ LOG_FUNC();
+ setInts( env, jdims, (void*)in, bd_ints, VSIZE(bd_ints) );
+ LOG_RETURN_VOID();
+}
+#endif
+
static void
destroyGI( MPFORMAL CurGameInfo** gip )
{
@@ -601,6 +631,47 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1draw
return result;
}
+#ifdef COMMON_LAYOUT
+JNIEXPORT void JNICALL
+Java_org_eehouse_android_xw4_jni_XwJNI_board_1figureLayout
+( JNIEnv* env, jclass C, jint gamePtr, jobject jgi, jint fontHt, jint fontWidth,
+ jboolean squareTiles, jobject jbounds, jobject jdims )
+{
+ LOG_FUNC();
+ XWJNI_START();
+ CurGameInfo* gi = makeGI( MPPARM(mpool) env, jgi );
+
+ XP_Rect bounds;
+ bounds.left = getInt( env, jbounds, "left" );
+ bounds.top = getInt( env, jbounds, "top" );
+ bounds.width = getInt( env, jbounds, "right" ) - bounds.left;
+ bounds.height = getInt( env, jbounds, "bottom" ) - bounds.top;
+
+ BoardDims dims;
+ board_figureLayout( state->game.board, gi, fontHt, fontWidth,
+ squareTiles, &bounds, ((!!jdims) ? &dims : NULL) );
+
+ destroyGI( MPPARM(mpool) &gi );
+
+ if ( !!jdims ) {
+ dimsCtoJ( env, jdims, &dims );
+ }
+ XWJNI_END();
+ LOG_RETURN_VOID();
+}
+
+JNIEXPORT void JNICALL
+Java_org_eehouse_android_xw4_jni_XwJNI_board_1applyLayout
+( JNIEnv* env, jclass C, jint gamePtr, jobject jdims )
+{
+ XWJNI_START();
+ BoardDims dims;
+ dimsJToC( env, &dims, jdims );
+ board_applyLayout( state->game.board, &dims );
+ XWJNI_END();
+}
+#endif
+
JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1setPos
(JNIEnv *env, jclass C, jint gamePtr, jint left, jint top, jint width,
diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml
index f7af55629..f89799cb7 100644
--- a/xwords4/android/XWords4/res/values/common_rsrc.xml
+++ b/xwords4/android/XWords4/res/values/common_rsrc.xml
@@ -103,6 +103,7 @@
key_na_browseall
key_na_values
key_enable_debug
+ key_enable_commlayt
key_download_path
diff --git a/xwords4/android/XWords4/res/xml/xwprefs.xml b/xwords4/android/XWords4/res/xml/xwprefs.xml
index fb690b6e7..c384a57dc 100644
--- a/xwords4/android/XWords4/res/xml/xwprefs.xml
+++ b/xwords4/android/XWords4/res/xml/xwprefs.xml
@@ -299,6 +299,11 @@
android:summary="Menuitems etc."
android:defaultValue="false"
/>
+