diff --git a/xwords4/android/XWords4/res/layout/role_edit_relay.xml b/xwords4/android/XWords4/res/layout/role_edit_relay.xml index 8c291dad0..562db59c9 100644 --- a/xwords4/android/XWords4/res/layout/role_edit_relay.xml +++ b/xwords4/android/XWords4/res/layout/role_edit_relay.xml @@ -31,5 +31,20 @@ android:textAppearance="?android:attr/textAppearanceMedium" /> + + + + + + diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 36d48b210..9a4350a4b 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -163,7 +163,7 @@ Device role Connection - Configure connection + Configure %s connection Game settings Minutes in game @@ -203,6 +203,16 @@ Standalone if all players are on this device; otherwise Host a game or be a Guest. + As host, you name the room you + and your guests will use. You must connect before any guests to + establish the room on the relay. + As a guest, you enter the room + name chosen by the host. You should wait to connect until the + host has done so. + (Connecting happens + automatically when you open a game that is configured to use the + relay.) + Ignore phonies Warn if phonies Disallow phonies diff --git a/xwords4/android/XWords4/res/values/styles.xml b/xwords4/android/XWords4/res/values/styles.xml index 48f189550..7134bc3c9 100644 --- a/xwords4/android/XWords4/res/values/styles.xml +++ b/xwords4/android/XWords4/res/values/styles.xml @@ -3,8 +3,18 @@ + + + diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java index 1eb8f1fe8..0a7affc4e 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java @@ -87,6 +87,7 @@ public class GameConfig extends Activity implements View.OnClickListener { private boolean m_canDoBT = false; private int m_nMoves = 0; private CommsAddrRec.CommsConnType[] m_types; + private String[] m_connStrings; class RemoteChoices extends XWListAdapter { public RemoteChoices() { super( GameConfig.this, m_gi.nPlayers ); } @@ -222,6 +223,7 @@ public class GameConfig extends Activity implements View.OnClickListener { case ROLE_EDIT_RELAY: case ROLE_EDIT_SMS: case ROLE_EDIT_BT: + setRoleHints( id, dialog ); setRoleSettings(); break; case FORCE_REMOTE: @@ -274,6 +276,37 @@ public class GameConfig extends Activity implements View.OnClickListener { Utils.setChecked( m_curDialog, R.id.remote_check, ! lp.isLocal ); } + private void setRoleHints( int id, Dialog dialog ) + { + int[] guestHints = null; + int[] hostHints = null; + switch( id ) { + case ROLE_EDIT_RELAY: + // Can these be in an array in a resource? + guestHints = new int[] { R.id.room_edit_hint_guest }; + hostHints = new int[] { R.id.room_edit_hint_host }; + break; + case ROLE_EDIT_SMS: + case ROLE_EDIT_BT: + } + + DeviceRole role = m_gi.serverRole; + if ( null != guestHints ) { + for ( int hintID : guestHints ) { + View view = dialog.findViewById( hintID ); + view.setVisibility( DeviceRole.SERVER_ISCLIENT == role ? + View.VISIBLE : View.GONE ); + } + } + if ( null != hostHints ) { + for ( int hintID : hostHints ) { + View view = dialog.findViewById( hintID ); + view.setVisibility( DeviceRole.SERVER_ISSERVER == role ? + View.VISIBLE : View.GONE ); + } + } + } + private void setRoleSettings() { switch( m_types[m_connectSpinner.getSelectedItemPosition()] ) { @@ -606,14 +639,36 @@ public class GameConfig extends Activity implements View.OnClickListener { private void configConnectSpinner() { m_connectSpinner = (Spinner)findViewById( R.id.connect_spinner ); + m_connStrings = makeXportStrings(); ArrayAdapter adapter = new ArrayAdapter( this, android.R.layout.simple_spinner_item, - makeXportStrings() ); + m_connStrings ); adapter.setDropDownViewResource( android.R.layout .simple_spinner_dropdown_item ); m_connectSpinner.setAdapter( adapter ); m_connectSpinner.setSelection( connTypeToPos( m_car.conType ) ); + AdapterView.OnItemSelectedListener + lstnr = new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parentView, + View selectedItemView, + int position, + long id ) + { + String fmt = getString( R.string.configure_rolef ); + m_configureButton + .setText( String.format( fmt, + m_connStrings[position] )); + } + + @Override + public void onNothingSelected(AdapterView parentView) + { + } + }; + m_connectSpinner.setOnItemSelectedListener( lstnr ); + } // configConnectSpinner private void adjustVisibility()