From 567d5f4d70d0f3f3b1c233dc7b720be36dc087a9 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Thu, 8 Jul 2010 06:39:48 -0700 Subject: [PATCH] add and connect values button. It's visible when there are any tiles at all on the board. --- .../android/XWords4/res/drawable/values.png | Bin 0 -> 1029 bytes xwords4/android/XWords4/res/layout/board.xml | 32 +++++++++++------- .../eehouse/android/xw4/BoardActivity.java | 8 +++++ .../src/org/eehouse/android/xw4/Toolbar.java | 4 +++ .../eehouse/android/xw4/jni/JNIThread.java | 6 +++- 5 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 xwords4/android/XWords4/res/drawable/values.png diff --git a/xwords4/android/XWords4/res/drawable/values.png b/xwords4/android/XWords4/res/drawable/values.png new file mode 100644 index 0000000000000000000000000000000000000000..a42f6ab6b3157e15263392b805d8e0ebdc355e8a GIT binary patch literal 1029 zcmV+g1p51lP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igY+ z4H7P-ACFl800V_dL_t(&-rZVjOWRNwe%^Q@Hmw)bA`yB4+fnJLIvmK{$Fco4|JTMg zx3Pk?RV+3X6rp16Ma0^ieK9U=PSPZ%H(v;CbCU2p=Y8JGIVo|@G0n#O+(bkc)|_)1 z2LTCFZqzTK1?fMhhOWDs{c(E1(F0~OlWMO^LUuD=&@=!*JRa|nkEUsqNF;jB9UL5x zZjv5j3`7LZIb>NzBoaY18ilH=SXx@b?CdOv#LA1sV!>pgY$Ac9O2u;iZ89mmUQrY% ziUL`dASS>ErdnfG=!{+AZ@MV9W`^rN7fh^L#9Rc&TUP%5u zJL~zqok|J82PPpm0o~-ByCq>fZYP}3` zl*{GOWg(IMJ~^=)s=j;krUf7@xQ77X@$nI|EPEs1H*oE|X6MY^OvVEKSE)qidyLO= zxr~jCjq!A&yO|6)=RL=6Cd2!|9~O($f1S|?j=i0Jzqx7tZb5WdERtP)cu^(xoA*VT z=!pau1*_kj!7y60p!`uN39KPoB$mMdj2qj5!3}nd;gmDBd8w0#y`&(N*gZX^EXMAR6 z1^{5!PDrEFd_Q=Recax*cwih^$P;)cPY)_&j_q`S1UyNxKM^?X_(_une%w2AfwbVI zr-m-@eIXyfeb2tr3eUXhEWL2HxeM^0Cs9I!q+*`2Z^I - - - + + + + @@ -85,6 +89,10 @@ style="@style/toolbar_button" android:src="@drawable/flip" /> + 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 486e9fca3..f461f0560 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -773,6 +773,14 @@ public class BoardActivity extends Activity implements UtilCtxt { .CMD_UNDO_CUR ); } }) ; + m_toolbar.setListener( Toolbar.BUTTON_VALUES, + new View.OnClickListener() { + @Override + public void onClick( View view ) { + m_jniThread.handle( JNIThread.JNICmd + .CMD_VALUES ); + } + }) ; } // populateToolbar private DialogInterface.OnDismissListener makeODLforBlocking() diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java index e5a393415..7ea5bf965 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java @@ -47,6 +47,7 @@ public class Toolbar { public static final int BUTTON_JUGGLE = 3; public static final int BUTTON_ZOOM = 4; public static final int BUTTON_UNDO = 5; + public static final int BUTTON_VALUES = 6; private static TBButtonInfo[] s_buttonInfo = { // BUTTON_HINT_PREV @@ -67,6 +68,9 @@ public class Toolbar { // BUTTON_UNDO new TBButtonInfo( R.id.undo_button_horizontal, R.id.undo_button_vertical ), + // BUTTON_VALUES + new TBButtonInfo( R.id.values_button_horizontal, + R.id.values_button_vertical ), }; private Activity m_activity; 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 ebfccd8e6..34fd03bbc 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 @@ -252,9 +252,13 @@ public class JNIThread extends Thread { private void checkButtons() { - int canFlip = XwJNI.board_canFlip( m_jniGamePtr ) ? 1 : 0; + int visTileCount = XwJNI.board_visTileCount( m_jniGamePtr ); + int canFlip = visTileCount > 1 ? 1 : 0; Message.obtain( m_handler, TOOLBAR_STATES, Toolbar.BUTTON_FLIP, canFlip ).sendToTarget(); + int canValues = visTileCount > 0 ? 1 : 0; + Message.obtain( m_handler, TOOLBAR_STATES, Toolbar.BUTTON_VALUES, + canValues ).sendToTarget(); int canShuffle = XwJNI.board_canShuffle( m_jniGamePtr ) ? 1 : 0; Message.obtain( m_handler, TOOLBAR_STATES, Toolbar.BUTTON_JUGGLE,