diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 6feb56174..2f22d17df 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -185,6 +185,8 @@ This game is in play. If you save these changes it must be restarted. Do you want to save these changes? + Are you sure you want to delete this + game? Are you sure you want to delete all games? This action cannot be undone. Are you sure you want to reset this diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java index 5a7acee6a..4fa3ebd91 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -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;