mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
Add board-size to game config. It makes no sense for it to exist in
per-game defaults but not be settable in config. But it may make more sense to remove both options/locations entirely, or hide them by default.
This commit is contained in:
parent
50a749eccc
commit
516a1800a0
2 changed files with 61 additions and 3 deletions
|
@ -246,6 +246,26 @@
|
|||
android:text="@string/pick_faceup"
|
||||
/>
|
||||
|
||||
<LinearLayout android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/board_size"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<Spinner android:id="@+id/boardsize_spinner"
|
||||
android:prompt="@string/board_size"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawSelectorOnTop="true"
|
||||
android:entries="@array/board_sizes"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
|
|
@ -96,6 +96,7 @@ public class GameConfig extends XWActivity
|
|||
// private Spinner m_roleSpinner;
|
||||
// private Spinner m_connectSpinner;
|
||||
private Spinner m_phoniesSpinner;
|
||||
private Spinner m_boardsizeSpinner;
|
||||
private Spinner m_langSpinner;
|
||||
private Spinner m_smartnessSpinner;
|
||||
private String m_browseText;
|
||||
|
@ -119,6 +120,7 @@ public class GameConfig extends XWActivity
|
|||
,R.id.refresh_button
|
||||
,R.id.hints_allowed
|
||||
,R.id.pick_faceup
|
||||
,R.id.boardsize_spinner
|
||||
,R.id.use_timer
|
||||
,R.id.timer_minutes_edit
|
||||
,R.id.smart_robot
|
||||
|
@ -416,6 +418,7 @@ public class GameConfig extends XWActivity
|
|||
m_playerLayout = (LinearLayout)findViewById( R.id.player_list );
|
||||
m_langSpinner = (Spinner)findViewById( R.id.lang_spinner );
|
||||
m_phoniesSpinner = (Spinner)findViewById( R.id.phonies_spinner );
|
||||
m_boardsizeSpinner = (Spinner)findViewById( R.id.boardsize_spinner );
|
||||
m_smartnessSpinner = (Spinner)findViewById( R.id.smart_robot );
|
||||
} // onCreate
|
||||
|
||||
|
@ -547,6 +550,8 @@ public class GameConfig extends XWActivity
|
|||
};
|
||||
check.setOnCheckedChangeListener( lstnr );
|
||||
Utils.setChecked( this, R.id.use_timer, m_gi.timerEnabled );
|
||||
|
||||
setBoardsizeSpinner();
|
||||
}
|
||||
}
|
||||
} // loadGame
|
||||
|
@ -842,6 +847,39 @@ public class GameConfig extends XWActivity
|
|||
m_smartnessSpinner.setSelection( setting );
|
||||
}
|
||||
|
||||
private int positionToSize( int position ) {
|
||||
switch( position ) {
|
||||
case 0: return 15;
|
||||
case 1: return 13;
|
||||
case 2: return 11;
|
||||
default:
|
||||
Assert.fail();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void setBoardsizeSpinner()
|
||||
{
|
||||
int size = m_gi.boardSize;
|
||||
int selection = 0;
|
||||
switch( size ) {
|
||||
case 15:
|
||||
selection = 0;
|
||||
break;
|
||||
case 13:
|
||||
selection = 1;
|
||||
break;
|
||||
case 11:
|
||||
selection = 2;
|
||||
break;
|
||||
default:
|
||||
Assert.fail();
|
||||
break;
|
||||
}
|
||||
Assert.assertTrue( size == positionToSize(selection) );
|
||||
m_boardsizeSpinner.setSelection( selection );
|
||||
}
|
||||
|
||||
// private void configConnectSpinner()
|
||||
// {
|
||||
// m_connectSpinner = (Spinner)findViewById( R.id.connect_spinner );
|
||||
|
@ -997,6 +1035,9 @@ public class GameConfig extends XWActivity
|
|||
position = m_smartnessSpinner.getSelectedItemPosition();
|
||||
m_gi.setRobotSmartness(position * 49 + 1);
|
||||
|
||||
position = m_boardsizeSpinner.getSelectedItemPosition();
|
||||
m_gi.boardSize = positionToSize( position );
|
||||
|
||||
switch( m_conType ) {
|
||||
case COMMS_CONN_RELAY:
|
||||
m_car.ip_relay_seeksPublicRoom = m_joinPublicCheck.isChecked();
|
||||
|
@ -1020,9 +1061,6 @@ public class GameConfig extends XWActivity
|
|||
// nothing to save for BT yet
|
||||
}
|
||||
|
||||
// position = m_connectSpinner.getSelectedItemPosition();
|
||||
// m_car.conType = m_types[ position ];
|
||||
|
||||
m_car.conType = m_conType;
|
||||
} // saveChanges
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue