mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
change player name when [un]made a robot
This commit is contained in:
parent
12e8328e83
commit
3f92b879de
2 changed files with 16 additions and 2 deletions
|
@ -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 );
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Reference in a new issue