mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
confirm single game delete.
This commit is contained in:
parent
5b6a5aafe8
commit
fd1ca2c9c5
2 changed files with 31 additions and 27 deletions
|
@ -185,6 +185,8 @@
|
|||
<string name="confirm_save">This game is in play. If you
|
||||
save these changes it must be restarted. Do you want to save
|
||||
these changes?</string>
|
||||
<string name="confirm_delete">Are you sure you want to delete this
|
||||
game?</string>
|
||||
<string name="confirm_delete_all">Are you sure you want to
|
||||
delete all games? This action cannot be undone.</string>
|
||||
<string name="confirm_reset">Are you sure you want to reset this
|
||||
|
|
|
@ -274,15 +274,32 @@ public class GamesList extends XWListActivity
|
|||
private boolean handleMenuItem( int menuID, int position )
|
||||
{
|
||||
boolean handled = true;
|
||||
byte[] stream;
|
||||
String invalPath = null;
|
||||
|
||||
String path = GameUtils.gamesList( this )[position];
|
||||
final String path = GameUtils.gamesList( this )[position];
|
||||
|
||||
if ( R.id.list_item_delete == menuID ) {
|
||||
GameUtils.deleteGame( this, path );
|
||||
invalPath = path;
|
||||
DialogInterface.OnClickListener lstnr =
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int ii ) {
|
||||
GameUtils.deleteGame( GamesList.this, path );
|
||||
m_adapter.inval( path );
|
||||
onContentChanged();
|
||||
}
|
||||
};
|
||||
showConfirmThen( R.string.confirm_delete, lstnr );
|
||||
} else if ( R.id.list_item_reset == menuID ) {
|
||||
DialogInterface.OnClickListener lstnr =
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int ii ) {
|
||||
GameUtils.resetGame( GamesList.this,
|
||||
path, path );
|
||||
m_adapter.inval( path );
|
||||
onContentChanged();
|
||||
}
|
||||
};
|
||||
showConfirmThen( R.string.confirm_reset, lstnr );
|
||||
} else {
|
||||
String invalPath = null;
|
||||
String[] missingName = new String[1];
|
||||
int[] missingLang = new int[1];
|
||||
boolean hasDict = GameUtils.gameDictHere( this, path,
|
||||
|
@ -296,20 +313,6 @@ public class GamesList extends XWListActivity
|
|||
m_invalPath = path;
|
||||
break;
|
||||
|
||||
case R.id.list_item_reset:
|
||||
// TODO confirm_data_loss();
|
||||
final String fpath = path;
|
||||
DialogInterface.OnClickListener lstnr =
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int ii ) {
|
||||
GameUtils.resetGame( GamesList.this,
|
||||
fpath, fpath );
|
||||
m_adapter.inval( fpath );
|
||||
onContentChanged();
|
||||
}
|
||||
};
|
||||
showConfirmThen( R.string.confirm_reset, lstnr );
|
||||
break;
|
||||
case R.id.list_item_new_from:
|
||||
String newName = GameUtils.resetGame( this, path );
|
||||
invalPath = newName;
|
||||
|
@ -320,7 +323,7 @@ public class GamesList extends XWListActivity
|
|||
if ( summary.inNetworkGame() ) {
|
||||
showOKOnlyDialog( R.string.no_copy_network );
|
||||
} else {
|
||||
stream = GameUtils.savedGame( this, path );
|
||||
byte[] stream = GameUtils.savedGame( this, path );
|
||||
newName = GameUtils.saveGame( this, stream );
|
||||
DBUtils.saveSummary( this, newName, summary );
|
||||
}
|
||||
|
@ -340,14 +343,13 @@ public class GamesList extends XWListActivity
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( null != invalPath ) {
|
||||
m_adapter.inval( invalPath );
|
||||
}
|
||||
|
||||
if ( handled ) {
|
||||
onContentChanged();
|
||||
if ( null != invalPath ) {
|
||||
m_adapter.inval( invalPath );
|
||||
}
|
||||
if ( handled ) {
|
||||
onContentChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return handled;
|
||||
|
|
Loading…
Add table
Reference in a new issue