diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 4b787a009..c9509fc1f 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -52,6 +52,7 @@ No Save Discard + Retry Name: Open diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 0292ae324..f656fde7a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -56,6 +56,7 @@ public class BoardActivity extends Activity implements UtilCtxt { private static final int PICK_TILE_REQUEST_BLK = Utils.DIALOG_LAST + 5; private static final int QUERY_ENDGAME = Utils.DIALOG_LAST + 6; private static final int ASK_PASSWORD_BLK = Utils.DIALOG_LAST + 7; + private static final int DLG_RETRY = Utils.DIALOG_LAST + 8; private BoardView m_view; private int m_jniGamePtr; @@ -110,18 +111,22 @@ public class BoardActivity extends Activity implements UtilCtxt { switch ( id ) { case DLG_OKONLY: case DLG_BADWORDS: - dialog = new AlertDialog.Builder( BoardActivity.this ) + case DLG_RETRY: + ab = new AlertDialog.Builder( BoardActivity.this ) //.setIcon( R.drawable.alert_dialog_icon ) .setTitle( m_dlgTitle ) .setMessage( m_dlgBytes ) - .setPositiveButton( R.string.button_ok, - new DialogInterface.OnClickListener() { - public void onClick( DialogInterface dlg, - int whichButton ) { - Utils.logf( "Ok clicked" ); - } - }) - .create(); + .setPositiveButton( R.string.button_ok, null ); + if ( DLG_RETRY == id ) { + lstnr = new DialogInterface.OnClickListener() { + public void onClick( DialogInterface dlg, + int whichButton ) { + m_jniThread.handle( JNIThread.JNICmd.CMD_RESET ); + } + }; + ab.setNegativeButton( R.string.button_retry, lstnr ); + } + dialog = ab.create(); break; case QUERY_REQUEST_BLK: @@ -632,9 +637,11 @@ public class BoardActivity extends Activity implements UtilCtxt { public void handleMessage( Message msg ) { switch( msg.what ) { case CommsTransport.DIALOG: + case CommsTransport.DIALOG_RETRY: m_dlgBytes = (String)msg.obj; m_dlgTitle = msg.arg1; - showDialog( DLG_OKONLY ); + showDialog( CommsTransport.DIALOG==msg.what + ? DLG_OKONLY : DLG_RETRY ); break; case CommsTransport.TOAST: Toast.makeText( BoardActivity.this, diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java index 3d955cced..1da33ed32 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java @@ -44,7 +44,8 @@ import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole; public class CommsTransport extends Thread implements TransportProcs { public static final int DIALOG = 0; - public static final int TOAST = 1; + public static final int DIALOG_RETRY = 1; + public static final int TOAST = 2; private Selector m_selector; private SocketChannel m_socketChannel; @@ -376,7 +377,7 @@ public class CommsTransport extends Thread implements TransportProcs { break; case NO_ROOM: strID = R.string.msg_no_room; - how = DIALOG; + how = DIALOG_RETRY; break; case DUP_ROOM: strID = R.string.msg_dup_room;