Include possibility of umounted sd card in missing dict

explanation. Name of game too.  Use single-selectable list and
Substitute button instead of expecting user to tap once to select
(which confused me.)
This commit is contained in:
Andy2 2011-08-18 06:26:43 -07:00
parent 0c29a4c1ca
commit 455cb9a4c4
2 changed files with 31 additions and 25 deletions

View file

@ -389,11 +389,13 @@
<string name="subst_dict_title">Substitute dictionary (wordcount)</string> <string name="subst_dict_title">Substitute dictionary (wordcount)</string>
<string name="button_substdict">Substitute</string> <string name="button_substdict">Substitute</string>
<string name="no_dictf">Unable to open game because no %s <string name="no_dictf">Unable to open game \"%1$s\" because no
dictionary found.</string> %2$s dictionary found. (It may have been deleted, or stored on
<string name="no_dict_substf">Unable to open game because an an SD card that\'s been unmounted.)</string>
dictionary %1$s not found. You can download a replacement or <string name="no_dict_substf">Unable to open game \"%1$s\" because
substitute another %2$s dictionary.</string> dictionary %2$s not found. (It may have been deleted, or stored
on an an SD card that\'s been unmounted.) You can download a
replacement or substitute another %3$s dictionary.</string>
<string name="msg_ask_password">Password for \"%s\":</string> <string name="msg_ask_password">Password for \"%s\":</string>

View file

@ -97,14 +97,16 @@ public class GamesList extends XWListActivity
} }
}; };
String message; String message;
String langName = DictLangCache.getLangName( this, String langName =
m_missingDictLang ); DictLangCache.getLangName( this, m_missingDictLang );
String gameName = GameUtils.getName( this, m_rowid );
if ( WARN_NODICT == id ) { if ( WARN_NODICT == id ) {
message = String.format( getString(R.string.no_dictf), message = String.format( getString( R.string.no_dictf ),
langName ); gameName, langName );
} else { } else {
message = String.format( getString(R.string.no_dict_substf), message = String.format( getString(R.string.no_dict_substf),
m_missingDictNames[0], langName ); gameName, m_missingDictNames[0],
langName );
} }
ab = new AlertDialog.Builder( this ) ab = new AlertDialog.Builder( this )
@ -127,24 +129,26 @@ public class GamesList extends XWListActivity
case SHOW_SUBST: case SHOW_SUBST:
m_sameLangDicts = m_sameLangDicts =
DictLangCache.getHaveLangCounts( this, m_missingDictLang ); DictLangCache.getHaveLangCounts( this, m_missingDictLang );
ab = new AlertDialog.Builder( this ) lstnr = new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg,
int which ) {
int pos = ((AlertDialog)dlg).getListView().
getCheckedItemPosition();
String dict = m_sameLangDicts[pos];
dict = DictLangCache.stripCount( dict );
GameUtils.replaceDicts( GamesList.this,
m_missingDictRowId,
m_missingDictNames[0],
dict );
}
};
dialog = new AlertDialog.Builder( this )
.setTitle( R.string.subst_dict_title ) .setTitle( R.string.subst_dict_title )
.setPositiveButton( R.string.button_substdict, lstnr )
.setNegativeButton( R.string.button_cancel, null ) .setNegativeButton( R.string.button_cancel, null )
.setItems( m_sameLangDicts, .setSingleChoiceItems( m_sameLangDicts, 0, null )
new DialogInterface.OnClickListener() { .create();
public void onClick( DialogInterface dlg,
int which ) {
String dict = m_sameLangDicts[which];
dict = DictLangCache.stripCount( dict );
GameUtils.
replaceDicts( GamesList.this,
m_missingDictRowId,
m_missingDictNames[0],
dict );
}
})
; ;
dialog = ab.create();
// Force destruction so onCreateDialog() will get // Force destruction so onCreateDialog() will get
// called next time and we can insert a different // called next time and we can insert a different
// list. There seems to be no way to change the list // list. There seems to be no way to change the list