mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
add Retry button to dialog announcing client failure to find expected
room on relay. From handler call new comms_resetSame and existing code to init client game connecion.
This commit is contained in:
parent
9f797afe73
commit
d0b9f0f7aa
3 changed files with 21 additions and 12 deletions
|
@ -52,6 +52,7 @@
|
|||
<string name="button_no">No</string>
|
||||
<string name="button_save">Save</string>
|
||||
<string name="button_discard">Discard</string>
|
||||
<string name="button_retry">Retry</string>
|
||||
|
||||
<string name="player_label">Name:</string>
|
||||
<string name="game_config_open">Open</string>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue