mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
Fix problem with entries in summary db outlasting their games and
getting applied to new games created with old name: add deleteGame method that removes summary and file at same time.
This commit is contained in:
parent
5542350094
commit
8e6c3c7533
2 changed files with 9 additions and 8 deletions
|
@ -74,7 +74,7 @@ public class GamesList extends ListActivity implements View.OnClickListener {
|
|||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int item ) {
|
||||
for( String game : Utils.gamesList( GamesList.this ) ) {
|
||||
deleteFile( game );
|
||||
Utils.deleteGame( GamesList.this, game );
|
||||
}
|
||||
m_adapter = new GameListAdapter( GamesList.this );
|
||||
setListAdapter( m_adapter );
|
||||
|
@ -158,10 +158,7 @@ public class GamesList extends ListActivity implements View.OnClickListener {
|
|||
int id = item.getItemId();
|
||||
|
||||
if ( R.id.list_item_delete == id ) {
|
||||
Utils.saveSummary( path, null );
|
||||
if ( ! deleteFile( path ) ) {
|
||||
Utils.logf( "unable to delete " + path );
|
||||
}
|
||||
Utils.deleteGame( this, path );
|
||||
} else {
|
||||
String[] missingName = new String[1];
|
||||
boolean hasDict = Utils.gameDictHere( this, path, missingName );
|
||||
|
@ -174,9 +171,7 @@ public class GamesList extends ListActivity implements View.OnClickListener {
|
|||
doConfig( path );
|
||||
break;
|
||||
case R.id.list_item_delete:
|
||||
if ( ! deleteFile( path ) ) {
|
||||
Utils.logf( "unable to delete " + path );
|
||||
}
|
||||
Utils.deleteGame( this, path );
|
||||
break;
|
||||
|
||||
case R.id.list_item_reset:
|
||||
|
|
|
@ -184,6 +184,12 @@ public class Utils {
|
|||
return newName;
|
||||
}
|
||||
|
||||
public static void deleteGame( Context context, String path )
|
||||
{
|
||||
context.deleteFile( path );
|
||||
saveSummary( path, null );
|
||||
}
|
||||
|
||||
public static void loadMakeGame( Context context, int gamePtr,
|
||||
CurGameInfo gi, String path )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue