mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
check if dict missing and warn rather than do anything that will crash
if it's not there. Ideally I could open the config dialog so user could change the dict but that isn't working. Maybe just offer to open it after swapping in the default dict?
This commit is contained in:
parent
7921ddca10
commit
198534dce3
1 changed files with 20 additions and 13 deletions
|
@ -279,11 +279,13 @@ public class GamesList extends XWListActivity
|
||||||
}
|
}
|
||||||
GameUtils.doConfig( this, path, clazz );
|
GameUtils.doConfig( this, path, clazz );
|
||||||
} else {
|
} else {
|
||||||
File file = new File( path );
|
if ( checkWarnNoDict( path ) ) {
|
||||||
Uri uri = Uri.fromFile( file );
|
File file = new File( path );
|
||||||
Intent intent = new Intent( Intent.ACTION_EDIT, uri,
|
Uri uri = Uri.fromFile( file );
|
||||||
this, BoardActivity.class );
|
Intent intent = new Intent( Intent.ACTION_EDIT, uri,
|
||||||
startActivity( intent );
|
this, BoardActivity.class );
|
||||||
|
startActivity( intent );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_invalPath = path;
|
m_invalPath = path;
|
||||||
}
|
}
|
||||||
|
@ -306,13 +308,7 @@ public class GamesList extends XWListActivity
|
||||||
showConfirmThen( R.string.confirm_delete, lstnr );
|
showConfirmThen( R.string.confirm_delete, lstnr );
|
||||||
} else {
|
} else {
|
||||||
String invalPath = null;
|
String invalPath = null;
|
||||||
String[] missingName = new String[1];
|
if ( checkWarnNoDict( path ) ) {
|
||||||
int[] missingLang = new int[1];
|
|
||||||
boolean hasDict = GameUtils.gameDictHere( this, path,
|
|
||||||
missingName, missingLang );
|
|
||||||
if ( !hasDict ) {
|
|
||||||
showNoDict( missingName[0], missingLang[0] );
|
|
||||||
} else {
|
|
||||||
switch ( menuID ) {
|
switch ( menuID ) {
|
||||||
case R.id.list_item_reset:
|
case R.id.list_item_reset:
|
||||||
lstnr = new DialogInterface.OnClickListener() {
|
lstnr = new DialogInterface.OnClickListener() {
|
||||||
|
@ -371,6 +367,18 @@ public class GamesList extends XWListActivity
|
||||||
return handled;
|
return handled;
|
||||||
} // handleMenuItem
|
} // handleMenuItem
|
||||||
|
|
||||||
|
private boolean checkWarnNoDict( String path )
|
||||||
|
{
|
||||||
|
String[] missingName = new String[1];
|
||||||
|
int[] missingLang = new int[1];
|
||||||
|
boolean hasDict = GameUtils.gameDictHere( this, path,
|
||||||
|
missingName, missingLang );
|
||||||
|
if ( !hasDict ) {
|
||||||
|
showNoDict( missingName[0], missingLang[0] );
|
||||||
|
}
|
||||||
|
return hasDict;
|
||||||
|
}
|
||||||
|
|
||||||
private String saveNew( CurGameInfo gi )
|
private String saveNew( CurGameInfo gi )
|
||||||
{
|
{
|
||||||
String path = null;
|
String path = null;
|
||||||
|
@ -388,5 +396,4 @@ public class GamesList extends XWListActivity
|
||||||
onContentChanged();
|
onContentChanged();
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue