restore some default after download cancelled

Don't leave the text "download more" as the spinner's value when
onActivityResult() is called with a cancel.
This commit is contained in:
Eric House 2020-08-24 08:52:10 -07:00
parent 99d47fd067
commit 7cb2560b2d

View file

@ -377,7 +377,8 @@ public class GameConfigDelegate extends DelegateBase
} else { } else {
dictLabel.setVisibility( View.GONE ); dictLabel.setVisibility( View.GONE );
} }
m_playerDictSpinner = ((LabeledSpinner)playerView.findViewById( R.id.player_dict_spinner )) m_playerDictSpinner = ((LabeledSpinner)playerView
.findViewById( R.id.player_dict_spinner ))
.getSpinner(); .getSpinner();
if ( localOnlyGame() ) { if ( localOnlyGame() ) {
configDictSpinner( m_playerDictSpinner, m_gi.dictLang, m_gi.dictName(lp) ); configDictSpinner( m_playerDictSpinner, m_gi.dictLang, m_gi.dictName(lp) );
@ -553,22 +554,25 @@ public class GameConfigDelegate extends DelegateBase
@Override @Override
protected void onActivityResult( RequestCode requestCode, int resultCode, Intent data ) protected void onActivityResult( RequestCode requestCode, int resultCode, Intent data )
{ {
if ( Activity.RESULT_CANCELED != resultCode ) { boolean cancelled = Activity.RESULT_CANCELED == resultCode;
loadGame();
switch( requestCode ) { loadGame();
case REQUEST_DICT: switch( requestCode ) {
String dictName = data.getStringExtra( DictsDelegate.RESULT_LAST_DICT ); case REQUEST_DICT:
configDictSpinner( m_dictSpinner, m_gi.dictLang, dictName ); String dictName = cancelled ? m_gi.dictName
configDictSpinner( m_playerDictSpinner, m_gi.dictLang, dictName ); : data.getStringExtra( DictsDelegate.RESULT_LAST_DICT );
break; configDictSpinner( m_dictSpinner, m_gi.dictLang, dictName );
case REQUEST_LANG_GC: configDictSpinner( m_playerDictSpinner, m_gi.dictLang, dictName );
String langName = data.getStringExtra( DictsDelegate.RESULT_LAST_LANG ); break;
selLangChanged( langName ); case REQUEST_LANG_GC:
setLangSpinnerSelection( langName ); String langName = cancelled
break; ? DictLangCache.getLangName( m_activity, m_gi.dictLang )
default: : data.getStringExtra( DictsDelegate.RESULT_LAST_LANG );
Assert.failDbg(); selLangChanged( langName );
} setLangSpinnerSelection( langName );
break;
default:
Assert.failDbg();
} }
} }
@ -1206,7 +1210,6 @@ public class GameConfigDelegate extends DelegateBase
private void adjustPlayersLabel() private void adjustPlayersLabel()
{ {
Log.i( TAG, "adjustPlayersLabel()" );
String label; String label;
if ( localOnlyGame() ) { if ( localOnlyGame() ) {
label = getString( R.string.players_label_standalone ); label = getString( R.string.players_label_standalone );