populate public rooms list as soon as checkbox set -- and mention

language and number of players in failure message
This commit is contained in:
Andy2 2010-10-17 21:13:14 -07:00
parent 56e83bfc1c
commit 2d66913323
2 changed files with 15 additions and 5 deletions

View file

@ -167,7 +167,7 @@
<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="room_public_prompt">Pick room to play in</string>
<string name="room_public_prompt">Select public room</string>
<string name="configure_role">Configure connection</string>
<string name="configure_rolef">Configure %s connection</string>
@ -385,8 +385,8 @@
<string name="public_names_progress">Fetching public rooms for
%d-player games in %s.</string>
<string name="no_name_found">No public rooms found. Try
refreshing or creating your own.</string>
<string name="no_name_found_f">No public rooms found for %d-player
games in %s. Try refreshing or creating your own.</string>
<string name="chat_received">Message received</string>
<string name="button_send">Send</string>

View file

@ -242,11 +242,13 @@ public class GameConfig extends XWActivity
case NO_NAME_FOUND:
dialog = new AlertDialog.Builder( this )
.setPositiveButton( R.string.button_ok, null )
.setMessage( R.string.no_name_found )
// message added below since varies with language etc.
.setMessage("") // if not set here can't change later
.create();
break;
}
return dialog;
}
} // onCreateDialog
@Override
protected void onPrepareDialog( int id, Dialog dialog )
@ -267,6 +269,12 @@ public class GameConfig extends XWActivity
ListView listview = (ListView)dialog.findViewById( R.id.players );
listview.setAdapter( new RemoteChoices() );
break;
case NO_NAME_FOUND:
String format = getString( R.string.no_name_found_f );
String msg = String.format( format, m_gi.nPlayers, DictLangCache.
getLangName( this, m_gi.dictLang ) );
((AlertDialog)dialog).setMessage( msg );
break;
}
super.onPrepareDialog( id, dialog );
}
@ -726,6 +734,8 @@ public class GameConfig extends XWActivity
private void adjustConnectStuff()
{
if ( m_joinPublicCheck.isChecked() ) {
new RefreshNamesTask( this, this, m_gi.dictLang,
m_gi.nPlayers, m_roomChoose ).execute();
m_privateRoomsSet.setVisibility( View.GONE );
m_publicRoomsSet.setVisibility( View.VISIBLE );