diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 73b348a86..09c1d9c97 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -161,6 +161,9 @@ public class BoardActivity extends Activity implements XW_UtilCtxt, Runnable { case R.id.board_menu_flip: m_jniThread.handle( JNIThread.JNICmd.CMD_FLIP ); break; + case R.id.board_menu_trade: + m_jniThread.handle( JNIThread.JNICmd.CMD_TOGGLE_TRADE ); + break; case R.id.board_menu_tray: m_jniThread.handle( JNIThread.JNICmd.CMD_TOGGLE_TRAY ); break; 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 937403b8b..8f2d5b5d2 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 @@ -23,6 +23,7 @@ public class JNIThread extends Thread { CMD_JUGGLE, CMD_FLIP, CMD_TOGGLE_TRAY, + CMD_TOGGLE_TRADE, CMD_UNDO_CUR, CMD_UNDO_LAST, CMD_HINT, @@ -132,6 +133,9 @@ public class JNIThread extends Thread { case CMD_TOGGLE_TRAY: draw = toggleTray(); break; + case CMD_TOGGLE_TRADE: + draw = XwJNI.board_beginTrade( m_jniGamePtr ); + break; case CMD_UNDO_CUR: draw = XwJNI.board_replaceTiles( m_jniGamePtr ); break; 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 1b842905e..ae17a9ddc 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 @@ -71,6 +71,7 @@ public class XwJNI { public static native void board_resetEngine( int gamePtr ); public static native boolean board_requestHint( int gamePtr, boolean useTileLimits, boolean[] workRemains ); + public static native boolean board_beginTrade( int gamePtr ); public static native void server_handleUndo( int gamePtr ); public static native boolean server_do( int gamePtr ); diff --git a/xwords4/android/xwjni.c b/xwords4/android/xwjni.c index 99894cd8f..0b5477937 100644 --- a/xwords4/android/xwjni.c +++ b/xwords4/android/xwjni.c @@ -445,6 +445,17 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1showTray return result; } +JNIEXPORT jboolean JNICALL +Java_org_eehouse_android_xw4_jni_XwJNI_board_1beginTrade +( JNIEnv* env, jclass C, jint gamePtr ) +{ + jboolean result; + XWJNI_START(); + result = board_beginTrade( state->game.board ); + XWJNI_END(); + return result; +} + JNIEXPORT jboolean JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_board_1toggle_1showValues ( JNIEnv* env, jclass C, jint gamePtr )