mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
Problem with new minimal-config relay dialog: user can accidentally
tap "play game" and wind up connecting and creating an empty-room-name game; or can dismiss the dialog and be confused because there's no way back to it. Solution: define empty-room-name as an illegal case. Check for it when "play game" is tapped in either config dialog and raise an alert. And when user wants to open a game from the GamesList activity go to the minimal config dialog if it's a relay game without a room name.
This commit is contained in:
parent
8213c9a5c1
commit
9fccbcc6b4
4 changed files with 38 additions and 14 deletions
|
@ -169,7 +169,7 @@
|
|||
<string name="connect_label">Connection (via internet)</string>
|
||||
<string name="room_public">Make new room public</string>
|
||||
<string name="join_room">Join public room</string>
|
||||
<string name="new_room_hint">New room name</string>
|
||||
<string name="new_room_hint">Room name</string>
|
||||
<string name="room_public_prompt">Select public room</string>
|
||||
|
||||
<string name="configure_role">Configure connection</string>
|
||||
|
@ -471,8 +471,8 @@
|
|||
|
||||
<string name="explain_b1">• Agree on a room name with the other
|
||||
player.</string>
|
||||
<string name="explain_b2">• Enter the new room name in the first
|
||||
box below. The room names on your two phones must be
|
||||
<string name="explain_b2">• Enter the room name in the first box
|
||||
below. The room names on your two phones must be
|
||||
identical.</string>
|
||||
<string name="explain_b3">• Optionally, enter player names in the
|
||||
second box (one per phone)</string>
|
||||
|
@ -482,4 +482,7 @@
|
|||
<string name="advanced_config">Advanced game settings</string>
|
||||
|
||||
<string name="local_name_hint">Player name</string>
|
||||
<string name="no_empty_rooms">This game cannot connect without a
|
||||
room name.</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -874,7 +874,11 @@ public class GameConfig extends XWActivity
|
|||
|
||||
private void launchGame()
|
||||
{
|
||||
GameUtils.launchGame( this, m_path );
|
||||
if ( m_car.ip_relay_invite.length() == 0 ) {
|
||||
showOKOnlyDialog( R.string.no_empty_rooms );
|
||||
} else {
|
||||
GameUtils.launchGame( this, m_path );
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshNames()
|
||||
|
|
|
@ -263,11 +263,21 @@ public class GamesList extends XWListActivity
|
|||
{
|
||||
super.onListItemClick( l, v, position, id );
|
||||
String path = GameUtils.gamesList( this )[position];
|
||||
File file = new File( path );
|
||||
Uri uri = Uri.fromFile( file );
|
||||
Intent intent = new Intent( Intent.ACTION_EDIT, uri,
|
||||
this, BoardActivity.class );
|
||||
startActivity( intent );
|
||||
|
||||
// We need a way to let the user get back to the basic-config
|
||||
// dialog in case it was dismissed. That way it to check for
|
||||
// an empty room name.
|
||||
GameSummary summary = DBUtils.getSummary( this, path );
|
||||
if ( summary.conType == CommsAddrRec.CommsConnType.COMMS_CONN_RELAY
|
||||
&& summary.roomName.length() == 0 ) {
|
||||
GameUtils.doConfig( this, path, RelayGameActivity.class );
|
||||
} else {
|
||||
File file = new File( path );
|
||||
Uri uri = Uri.fromFile( file );
|
||||
Intent intent = new Intent( Intent.ACTION_EDIT, uri,
|
||||
this, BoardActivity.class );
|
||||
startActivity( intent );
|
||||
}
|
||||
m_invalPath = path;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,11 +89,18 @@ public class RelayGameActivity extends XWActivity
|
|||
public void onClick( View view )
|
||||
{
|
||||
if ( view == m_playButton ) {
|
||||
m_car.ip_relay_invite = Utils.getText( this, R.id.room_edit ).trim();
|
||||
String name = Utils.getText( this, R.id.local_name_edit );
|
||||
m_gi.setFirstLocalName( name );
|
||||
GameUtils.applyChanges( this, m_gi, m_car, m_path, false );
|
||||
GameUtils.launchGame( this, m_path );
|
||||
String room = Utils.getText( this, R.id.room_edit ).trim();
|
||||
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 );
|
||||
GameUtils.launchGame( this, m_path );
|
||||
}
|
||||
} else if ( view == m_configButton ) {
|
||||
GameUtils.doConfig( this, m_path, GameConfig.class );
|
||||
finish();
|
||||
|
|
Loading…
Add table
Reference in a new issue