mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-22 07:28:16 +01:00
game config changes
get rid of password; disable, not hide, stuff that's irrelevant for a non-local player
This commit is contained in:
parent
8d800d4307
commit
e3ebea29c7
3 changed files with 26 additions and 9 deletions
|
@ -104,6 +104,7 @@ android {
|
||||||
buildConfigField "boolean", "NON_RELEASE", "DEBUG || !IS_TAGGED_BUILD"
|
buildConfigField "boolean", "NON_RELEASE", "DEBUG || !IS_TAGGED_BUILD"
|
||||||
buildConfigField "boolean", "HAVE_KNOWN_PLAYERS", "false"
|
buildConfigField "boolean", "HAVE_KNOWN_PLAYERS", "false"
|
||||||
buildConfigField "boolean", "FOR_FDROID", "false"
|
buildConfigField "boolean", "FOR_FDROID", "false"
|
||||||
|
buildConfigField "boolean", "HAVE_PASSWORD", "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
xw4NoSMS {
|
xw4NoSMS {
|
||||||
|
|
|
@ -365,7 +365,11 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
// Hide remote option if in standalone mode...
|
// Hide remote option if in standalone mode...
|
||||||
final LocalPlayer lp = m_gi.players[m_whichPlayer];
|
final LocalPlayer lp = m_gi.players[m_whichPlayer];
|
||||||
Utils.setText( playerView, R.id.player_name_edit, lp.name );
|
Utils.setText( playerView, R.id.player_name_edit, lp.name );
|
||||||
|
if ( BuildConfig.HAVE_PASSWORD ) {
|
||||||
Utils.setText( playerView, R.id.password_edit, lp.password );
|
Utils.setText( playerView, R.id.password_edit, lp.password );
|
||||||
|
} else {
|
||||||
|
playerView.findViewById(R.id.password_set).setVisibility( View.GONE );
|
||||||
|
}
|
||||||
|
|
||||||
// Dicts spinner with label
|
// Dicts spinner with label
|
||||||
TextView dictLabel = (TextView)playerView
|
TextView dictLabel = (TextView)playerView
|
||||||
|
@ -396,8 +400,7 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
public void onCheckedChanged( CompoundButton buttonView,
|
public void onCheckedChanged( CompoundButton buttonView,
|
||||||
boolean checked ) {
|
boolean checked ) {
|
||||||
lp.isLocal = !checked;
|
lp.isLocal = !checked;
|
||||||
localSet.setVisibility( checked ?
|
Utils.setEnabled( localSet, !checked );
|
||||||
View.GONE : View.VISIBLE );
|
|
||||||
checkShowPassword( playerView, lp );
|
checkShowPassword( playerView, lp );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -405,7 +408,7 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
check.setVisibility( View.VISIBLE );
|
check.setVisibility( View.VISIBLE );
|
||||||
} else {
|
} else {
|
||||||
check.setVisibility( View.GONE );
|
check.setVisibility( View.GONE );
|
||||||
localSet.setVisibility( View.VISIBLE );
|
Utils.setEnabled( localSet, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
check = (CheckBox)playerView.findViewById( R.id.robot_check );
|
check = (CheckBox)playerView.findViewById( R.id.robot_check );
|
||||||
|
@ -440,7 +443,7 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
{
|
{
|
||||||
boolean isRobotChecked = lp.isRobot();
|
boolean isRobotChecked = lp.isRobot();
|
||||||
// Log.d( TAG, "checkShowPassword(isRobotChecked=%b)", isRobotChecked );
|
// Log.d( TAG, "checkShowPassword(isRobotChecked=%b)", isRobotChecked );
|
||||||
boolean showPassword = !isRobotChecked;
|
boolean showPassword = !isRobotChecked && BuildConfig.HAVE_PASSWORD;
|
||||||
|
|
||||||
if ( showPassword ) {
|
if ( showPassword ) {
|
||||||
String pwd = getText( playerView, R.id.password_edit );
|
String pwd = getText( playerView, R.id.password_edit );
|
||||||
|
@ -458,8 +461,8 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
View view = playerView.findViewById( R.id.password_set );
|
playerView.findViewById( R.id.password_set )
|
||||||
view.setVisibility( showPassword ? View.VISIBLE : View.GONE );
|
.setVisibility( showPassword ? View.VISIBLE : View.GONE );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getPlayerSettings( DialogInterface di )
|
private void getPlayerSettings( DialogInterface di )
|
||||||
|
@ -467,7 +470,9 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
Dialog dialog = (Dialog)di;
|
Dialog dialog = (Dialog)di;
|
||||||
LocalPlayer lp = m_gi.players[m_whichPlayer];
|
LocalPlayer lp = m_gi.players[m_whichPlayer];
|
||||||
lp.name = Utils.getText( dialog, R.id.player_name_edit );
|
lp.name = Utils.getText( dialog, R.id.player_name_edit );
|
||||||
|
if ( BuildConfig.HAVE_PASSWORD ) {
|
||||||
lp.password = Utils.getText( dialog, R.id.password_edit );
|
lp.password = Utils.getText( dialog, R.id.password_edit );
|
||||||
|
}
|
||||||
|
|
||||||
if ( localOnlyGame() ) {
|
if ( localOnlyGame() ) {
|
||||||
int position = m_playerDictSpinner.getSelectedItemPosition();
|
int position = m_playerDictSpinner.getSelectedItemPosition();
|
||||||
|
|
|
@ -521,10 +521,21 @@ public class Utils {
|
||||||
setText( parent, id, str );
|
setText( parent, id, str );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setEnabled( View view, boolean enabled )
|
||||||
|
{
|
||||||
|
view.setEnabled( enabled );
|
||||||
|
if ( view instanceof ViewGroup ) {
|
||||||
|
ViewGroup asGroup = (ViewGroup)view;
|
||||||
|
for ( int ii = 0; ii < asGroup.getChildCount(); ++ii ) {
|
||||||
|
setEnabled( asGroup.getChildAt( ii ), enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void setEnabled( View parent, int id, boolean enabled )
|
public static void setEnabled( View parent, int id, boolean enabled )
|
||||||
{
|
{
|
||||||
View view = parent.findViewById( id );
|
View view = parent.findViewById( id );
|
||||||
parent.setEnabled( enabled );
|
setEnabled( view, enabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getChecked( Dialog dialog, int id )
|
public static boolean getChecked( Dialog dialog, int id )
|
||||||
|
|
Loading…
Reference in a new issue