add a confirmation dialog to "undo last", and remove it altogether

from networked games since as currently implemented it can quickly get
them permanently out-of-sync (and cause the jni code to assert.)  Need
to debug this....
This commit is contained in:
Andy2 2011-02-25 06:54:38 -08:00
parent 0be59d1ba7
commit 5e0f12e49d
2 changed files with 16 additions and 1 deletions

View file

@ -190,6 +190,8 @@
<string name="confirm_reset">Are you sure you want to reset this
game? Resetting erases all moves and any connection
information.</string>
<string name="confirm_undo_last">Are you sure you want to undo the
last committed turn? (There is no redo option.)</string>
<string name="confirm_delete_dictf">Are you sure you want to
delete %s? It is used by %d games, and you will not be able to

View file

@ -406,6 +406,12 @@ public class BoardActivity extends XWActivity {
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate( R.menu.board_menu, menu );
// For now undo-last can crash the app or break a game in
// networked case. Disable until this is fixed.
if ( m_gi.serverRole != DeviceRole.SERVER_STANDALONE ) {
menu.removeItem( R.id.board_menu_undo_last );
}
return true;
}
@ -442,7 +448,14 @@ public class BoardActivity extends XWActivity {
// cmd = JNIThread.JNICmd.CMD_UNDO_CUR;
// break;
case R.id.board_menu_undo_last:
cmd = JNIThread.JNICmd.CMD_UNDO_LAST;
showConfirmThen( R.string.confirm_undo_last,
new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg,
int whichButton ) {
m_jniThread.handle( JNIThread.JNICmd.
CMD_UNDO_LAST );
}
} );
break;
case R.id.board_menu_hint:
cmd = JNIThread.JNICmd.CMD_HINT;