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="button_substdict">Substitute</string>
<string name="no_dictf">Unable to open game because no %s
dictionary found.</string>
<string name="no_dict_substf">Unable to open game because
dictionary %1$s not found. You can download a replacement or
substitute another %2$s dictionary.</string>
<string name="no_dictf">Unable to open game \"%1$s\" because no
%2$s dictionary found. (It may have been deleted, or stored on
an an SD card that\'s been unmounted.)</string>
<string name="no_dict_substf">Unable to open game \"%1$s\" because
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>

View file

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