mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-24 07:58:34 +01:00
cleanup: switch on ids rather than test views
This commit is contained in:
parent
99664a8360
commit
69eee734e2
1 changed files with 57 additions and 55 deletions
|
@ -80,7 +80,6 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
private Button m_addPlayerButton;
|
private Button m_addPlayerButton;
|
||||||
private Button m_changeConnButton;
|
private Button m_changeConnButton;
|
||||||
private Button m_jugglePlayersButton;
|
private Button m_jugglePlayersButton;
|
||||||
private Button m_playButton;
|
|
||||||
private ImageButton m_refreshRoomsButton;
|
private ImageButton m_refreshRoomsButton;
|
||||||
private View m_connectSetRelay;
|
private View m_connectSetRelay;
|
||||||
private Spinner m_dictSpinner;
|
private Spinner m_dictSpinner;
|
||||||
|
@ -330,12 +329,6 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
case PLAYER_EDIT:
|
case PLAYER_EDIT:
|
||||||
setPlayerSettings( dialog );
|
setPlayerSettings( dialog );
|
||||||
break;
|
break;
|
||||||
// case ROLE_EDIT_RELAY:
|
|
||||||
// case ROLE_EDIT_SMS:
|
|
||||||
// case ROLE_EDIT_BT:
|
|
||||||
// setRoleHints( id, dialog );
|
|
||||||
// setRoleSettings();
|
|
||||||
// break;
|
|
||||||
case FORCE_REMOTE:
|
case FORCE_REMOTE:
|
||||||
ListView listview = (ListView)dialog.findViewById( R.id.players );
|
ListView listview = (ListView)dialog.findViewById( R.id.players );
|
||||||
listview.setAdapter( new RemoteChoices() );
|
listview.setAdapter( new RemoteChoices() );
|
||||||
|
@ -497,8 +490,7 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
m_changeConnButton.setOnClickListener( this );
|
m_changeConnButton.setOnClickListener( this );
|
||||||
m_jugglePlayersButton = (Button)findViewById(R.id.juggle_players);
|
m_jugglePlayersButton = (Button)findViewById(R.id.juggle_players);
|
||||||
m_jugglePlayersButton.setOnClickListener( this );
|
m_jugglePlayersButton.setOnClickListener( this );
|
||||||
m_playButton = (Button)findViewById( R.id.play_button );
|
findViewById( R.id.play_button ).setOnClickListener( this );
|
||||||
m_playButton.setOnClickListener( this );
|
|
||||||
|
|
||||||
m_playerLayout = (LinearLayout)findViewById( R.id.player_list );
|
m_playerLayout = (LinearLayout)findViewById( R.id.player_list );
|
||||||
m_phoniesSpinner = (Spinner)findViewById( R.id.phonies_spinner );
|
m_phoniesSpinner = (Spinner)findViewById( R.id.phonies_spinner );
|
||||||
|
@ -739,27 +731,35 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
{
|
{
|
||||||
if ( isFinishing() ) {
|
if ( isFinishing() ) {
|
||||||
// do nothing; we're on the way out
|
// do nothing; we're on the way out
|
||||||
} else if ( m_addPlayerButton == view ) {
|
} else {
|
||||||
|
switch ( view.getId() ) {
|
||||||
|
case R.id.add_player:
|
||||||
int curIndex = m_gi.nPlayers;
|
int curIndex = m_gi.nPlayers;
|
||||||
if ( curIndex < CurGameInfo.MAX_NUM_PLAYERS ) {
|
if ( curIndex < CurGameInfo.MAX_NUM_PLAYERS ) {
|
||||||
m_gi.addPlayer(); // ups nPlayers
|
m_gi.addPlayer(); // ups nPlayers
|
||||||
loadPlayersList();
|
loadPlayersList();
|
||||||
}
|
}
|
||||||
} else if ( m_jugglePlayersButton == view ) {
|
break;
|
||||||
|
case R.id.juggle_players:
|
||||||
m_gi.juggle();
|
m_gi.juggle();
|
||||||
loadPlayersList();
|
loadPlayersList();
|
||||||
} else if ( m_joinPublicCheck == view ) {
|
break;
|
||||||
|
case R.id.join_public_room_check:
|
||||||
adjustConnectStuff();
|
adjustConnectStuff();
|
||||||
} else if ( m_gameLockedCheck == view ) {
|
break;
|
||||||
|
case R.id.game_locked_check:
|
||||||
makeNotAgainBuilder( R.string.not_again_unlock,
|
makeNotAgainBuilder( R.string.not_again_unlock,
|
||||||
R.string.key_notagain_unlock,
|
R.string.key_notagain_unlock,
|
||||||
Action.LOCKED_CHANGE_ACTION )
|
Action.LOCKED_CHANGE_ACTION )
|
||||||
.show();
|
.show();
|
||||||
} else if ( m_refreshRoomsButton == view ) {
|
break;
|
||||||
|
case R.id.refresh_button:
|
||||||
refreshNames();
|
refreshNames();
|
||||||
} else if ( m_changeConnButton == view ) {
|
break;
|
||||||
|
case R.id.change_connection:
|
||||||
showConnAfterCheck();
|
showConnAfterCheck();
|
||||||
} else if ( m_playButton == view ) {
|
break;
|
||||||
|
case R.id.play_button:
|
||||||
// Launch BoardActivity for m_name, but ONLY IF user
|
// Launch BoardActivity for m_name, but ONLY IF user
|
||||||
// confirms any changes required. So we either launch
|
// confirms any changes required. So we either launch
|
||||||
// from here if there's no confirmation needed, or launch
|
// from here if there's no confirmation needed, or launch
|
||||||
|
@ -780,9 +780,11 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
} else {
|
} else {
|
||||||
finishAndLaunch();
|
finishAndLaunch();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
} else {
|
default:
|
||||||
DbgUtils.logw( TAG, "unknown v: " + view.toString() );
|
DbgUtils.logw( TAG, "unknown v: " + view.toString() );
|
||||||
|
Assert.assertFalse( BuildConfig.DEBUG );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // onClick
|
} // onClick
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue