diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java index 206ed5a2b..2eb7c5094 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java @@ -383,14 +383,19 @@ public class DelegateBase implements DlgClickNotify, m_activity.runOnUiThread( runnable ); } - public void setText( int id, String value ) + public void setText( View parent, int id, String value ) { - EditText editText = (EditText)findViewById( id ); + EditText editText = (EditText)parent.findViewById( id ); if ( null != editText ) { editText.setText( value, TextView.BufferType.EDITABLE ); } } + public void setText( int id, String value ) + { + setText( m_rootView, id, value ); + } + public String getText( View parent, int id ) { EditText editText = (EditText)parent.findViewById( id ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java index cda514131..8a463545e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameConfigDelegate.java @@ -413,6 +413,7 @@ public class GameConfigDelegate extends DelegateBase public void onCheckedChanged( CompoundButton buttonView, boolean checked ) { lp.setIsRobot( checked ); + setPlayerName( playerView, lp ); checkShowPassword( playerView, lp ); } }; @@ -424,6 +425,14 @@ public class GameConfigDelegate extends DelegateBase Log.d( TAG, "setPlayerSettings() DONE" ); } + private void setPlayerName( View playerView, LocalPlayer lp ) + { + String name = lp.isRobot() + ? CommonPrefs.getDefaultRobotName( m_activity ) + : CommonPrefs.getDefaultPlayerName( m_activity, m_whichPlayer ); + setText( playerView, R.id.player_name_edit, name ); + } + // We show the password stuff only if: non-robot player AND there's more // than one local non-robot OR there's already a password set. private void checkShowPassword( View playerView, LocalPlayer lp )