mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-24 07:58:34 +01:00
fix, by inspection, NPE reported through the Play Store.
This commit is contained in:
parent
e9059cba47
commit
f363fadf39
1 changed files with 53 additions and 49 deletions
|
@ -788,54 +788,56 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
|
|
||||||
private void loadPlayersList()
|
private void loadPlayersList()
|
||||||
{
|
{
|
||||||
m_playerLayout.removeAllViews();
|
if ( null != m_gameLock ) {
|
||||||
|
m_playerLayout.removeAllViews();
|
||||||
|
|
||||||
String[] names = m_gi.visibleNames( false );
|
String[] names = m_gi.visibleNames( false );
|
||||||
// only enable delete if one will remain (or two if networked)
|
// only enable delete if one will remain (or two if networked)
|
||||||
boolean canDelete = names.length > 2
|
boolean canDelete = names.length > 2
|
||||||
|| (localOnlyGame() && names.length > 1);
|
|| (localOnlyGame() && names.length > 1);
|
||||||
View.OnClickListener lstnr = new View.OnClickListener() {
|
View.OnClickListener lstnr = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick( View view ) {
|
public void onClick( View view ) {
|
||||||
m_whichPlayer = ((XWListItem)view).getPosition();
|
m_whichPlayer = ((XWListItem)view).getPosition();
|
||||||
showDialog( DlgID.PLAYER_EDIT );
|
showDialog( DlgID.PLAYER_EDIT );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
boolean localGame = localOnlyGame();
|
boolean localGame = localOnlyGame();
|
||||||
for ( int ii = 0; ii < names.length; ++ii ) {
|
for ( int ii = 0; ii < names.length; ++ii ) {
|
||||||
final XWListItem view = XWListItem.inflate( m_activity, null );
|
final XWListItem view = XWListItem.inflate( m_activity, null );
|
||||||
view.setPosition( ii );
|
view.setPosition( ii );
|
||||||
view.setText( names[ii] );
|
view.setText( names[ii] );
|
||||||
if ( localGame && m_gi.players[ii].isLocal ) {
|
if ( localGame && m_gi.players[ii].isLocal ) {
|
||||||
view.setComment( m_gi.dictName(ii) );
|
view.setComment( m_gi.dictName(ii) );
|
||||||
}
|
}
|
||||||
if ( canDelete ) {
|
if ( canDelete ) {
|
||||||
view.setDeleteCallback( this );
|
view.setDeleteCallback( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
view.setOnClickListener( lstnr );
|
||||||
|
m_playerLayout.addView( view );
|
||||||
|
|
||||||
|
View divider = inflate( R.layout.divider_view );
|
||||||
|
m_playerLayout.addView( divider );
|
||||||
}
|
}
|
||||||
|
|
||||||
view.setOnClickListener( lstnr );
|
m_addPlayerButton
|
||||||
m_playerLayout.addView( view );
|
.setVisibility( names.length >= CurGameInfo.MAX_NUM_PLAYERS?
|
||||||
|
View.GONE : View.VISIBLE );
|
||||||
|
m_jugglePlayersButton
|
||||||
|
.setVisibility( names.length <= 1 ?
|
||||||
|
View.GONE : View.VISIBLE );
|
||||||
|
|
||||||
View divider = inflate( R.layout.divider_view );
|
showHideRelayStuff();
|
||||||
m_playerLayout.addView( divider );
|
|
||||||
|
if ( ! localOnlyGame()
|
||||||
|
&& ((0 == m_gi.remoteCount() )
|
||||||
|
|| (m_gi.nPlayers == m_gi.remoteCount()) ) ) {
|
||||||
|
showDialog( DlgID.FORCE_REMOTE );
|
||||||
|
}
|
||||||
|
adjustPlayersLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_addPlayerButton
|
|
||||||
.setVisibility( names.length >= CurGameInfo.MAX_NUM_PLAYERS?
|
|
||||||
View.GONE : View.VISIBLE );
|
|
||||||
m_jugglePlayersButton
|
|
||||||
.setVisibility( names.length <= 1 ?
|
|
||||||
View.GONE : View.VISIBLE );
|
|
||||||
|
|
||||||
showHideRelayStuff();
|
|
||||||
|
|
||||||
if ( ! localOnlyGame()
|
|
||||||
&& ((0 == m_gi.remoteCount() )
|
|
||||||
|| (m_gi.nPlayers == m_gi.remoteCount()) ) ) {
|
|
||||||
showDialog( DlgID.FORCE_REMOTE );
|
|
||||||
}
|
|
||||||
adjustPlayersLabel();
|
|
||||||
} // loadPlayersList
|
} // loadPlayersList
|
||||||
|
|
||||||
private void configDictSpinner( Spinner dictsSpinner, int lang,
|
private void configDictSpinner( Spinner dictsSpinner, int lang,
|
||||||
|
@ -886,13 +888,15 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
public void onItemSelected(AdapterView<?> parentView,
|
public void onItemSelected(AdapterView<?> parentView,
|
||||||
View selectedItemView,
|
View selectedItemView,
|
||||||
int position, long id ) {
|
int position, long id ) {
|
||||||
String chosen =
|
if ( null != m_gameLock ) { // not on the way out?
|
||||||
(String)parentView.getItemAtPosition( position );
|
String chosen =
|
||||||
if ( chosen.equals( m_browseText ) ) {
|
(String)parentView.getItemAtPosition( position );
|
||||||
DictsDelegate.downloadForResult( m_activity, REQUEST_LANG );
|
if ( chosen.equals( m_browseText ) ) {
|
||||||
} else {
|
DictsDelegate.downloadForResult( m_activity, REQUEST_LANG );
|
||||||
String langName = adapter.getLangAtPosition( position );
|
} else {
|
||||||
selLangChanged( langName );
|
String langName = adapter.getLangAtPosition( position );
|
||||||
|
selLangChanged( langName );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue