save room and player names if leaving simple config dialog via the

advanced config button (but still drop if back button hit.)
This commit is contained in:
Andy2 2010-12-03 06:44:34 -08:00
parent 426f990156
commit fda21e8d15

View file

@ -88,20 +88,16 @@ public class RelayGameActivity extends XWActivity
@Override
public void onClick( View view )
{
if ( view == m_playButton ) {
String room = Utils.getText( this, R.id.room_edit ).trim();
if ( view == m_playButton ) {
if ( room.length() == 0 ) {
showOKOnlyDialog( R.string.no_empty_rooms );
} else {
m_car.ip_relay_invite = room;
String name = Utils.getText( this, R.id.local_name_edit );
if ( name.length() > 0 ) {
m_gi.setFirstLocalName( name );
}
GameUtils.applyChanges( this, m_gi, m_car, m_path, false );
saveRoomAndName( room );
GameUtils.launchGame( this, m_path );
}
} else if ( view == m_configButton ) {
saveRoomAndName( room );
GameUtils.doConfig( this, m_path, GameConfig.class );
finish();
}
@ -112,4 +108,14 @@ public class RelayGameActivity extends XWActivity
return summary.nPlayers == 2;
}
private void saveRoomAndName( String room )
{
String name = Utils.getText( this, R.id.local_name_edit );
if ( name.length() > 0 ) { // don't wipe existing
m_gi.setFirstLocalName( name );
}
m_car.ip_relay_invite = room;
GameUtils.applyChanges( this, m_gi, m_car, m_path, false );
}
} // class RelayGameActivity