add and connect values button. It's visible when there are any tiles

at all on the board.
This commit is contained in:
Andy2 2010-07-08 06:39:48 -07:00
parent 40323b03d2
commit 567d5f4d70
5 changed files with 37 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -41,18 +41,22 @@
style="@style/toolbar_button" style="@style/toolbar_button"
android:src="@drawable/shuffle" android:src="@drawable/shuffle"
/> />
<ImageButton android:id="@+id/flip_button_horizontal" <ImageButton android:id="@+id/flip_button_horizontal"
style="@style/toolbar_button" style="@style/toolbar_button"
android:src="@drawable/flip" android:src="@drawable/flip"
/> />
<ImageButton android:id="@+id/zoom_button_horizontal" <ImageButton android:id="@+id/zoom_button_horizontal"
style="@style/toolbar_button" style="@style/toolbar_button"
android:src="@drawable/zoom" android:src="@drawable/zoom"
/> />
<ImageButton android:id="@+id/undo_button_horizontal" <ImageButton android:id="@+id/undo_button_horizontal"
style="@style/toolbar_button" style="@style/toolbar_button"
android:src="@drawable/undo" android:src="@drawable/undo"
/> />
<ImageButton android:id="@+id/values_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/values"
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -85,6 +89,10 @@
style="@style/toolbar_button" style="@style/toolbar_button"
android:src="@drawable/flip" android:src="@drawable/flip"
/> />
<ImageButton android:id="@+id/values_button_vertical"
style="@style/toolbar_button"
android:src="@drawable/values"
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -773,6 +773,14 @@ public class BoardActivity extends Activity implements UtilCtxt {
.CMD_UNDO_CUR ); .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 } // populateToolbar
private DialogInterface.OnDismissListener makeODLforBlocking() private DialogInterface.OnDismissListener makeODLforBlocking()

View file

@ -47,6 +47,7 @@ public class Toolbar {
public static final int BUTTON_JUGGLE = 3; public static final int BUTTON_JUGGLE = 3;
public static final int BUTTON_ZOOM = 4; public static final int BUTTON_ZOOM = 4;
public static final int BUTTON_UNDO = 5; public static final int BUTTON_UNDO = 5;
public static final int BUTTON_VALUES = 6;
private static TBButtonInfo[] s_buttonInfo = { private static TBButtonInfo[] s_buttonInfo = {
// BUTTON_HINT_PREV // BUTTON_HINT_PREV
@ -67,6 +68,9 @@ public class Toolbar {
// BUTTON_UNDO // BUTTON_UNDO
new TBButtonInfo( R.id.undo_button_horizontal, new TBButtonInfo( R.id.undo_button_horizontal,
R.id.undo_button_vertical ), R.id.undo_button_vertical ),
// BUTTON_VALUES
new TBButtonInfo( R.id.values_button_horizontal,
R.id.values_button_vertical ),
}; };
private Activity m_activity; private Activity m_activity;

View file

@ -252,9 +252,13 @@ public class JNIThread extends Thread {
private void checkButtons() 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, Message.obtain( m_handler, TOOLBAR_STATES, Toolbar.BUTTON_FLIP,
canFlip ).sendToTarget(); 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; int canShuffle = XwJNI.board_canShuffle( m_jniGamePtr ) ? 1 : 0;
Message.obtain( m_handler, TOOLBAR_STATES, Toolbar.BUTTON_JUGGLE, Message.obtain( m_handler, TOOLBAR_STATES, Toolbar.BUTTON_JUGGLE,