add Rematch button to game over dialog -- which only puts up notImpl

toast so far.
This commit is contained in:
Eric House 2012-12-02 18:45:35 -08:00
parent 7621b909c3
commit bda0d51c7f
3 changed files with 26 additions and 3 deletions

View file

@ -2130,4 +2130,9 @@
<string name="group_cur_games">My games</string>
<string name="group_new_games">New games</string>
<!-- Button shown in game over dialog triggering creation of new
game with the same players and parameters as the one that
just ended. -->
<string name="button_rematch">Rematch</string>
</resources>

View file

@ -75,7 +75,7 @@ public class BoardActivity extends XWActivity
private static final int PICK_TILE_REQUESTTRAY_BLK = DLG_OKONLY + 11;
private static final int DLG_USEDICT = DLG_OKONLY + 12;
private static final int DLG_GETDICT = DLG_OKONLY + 13;
private static final int GAME_OVER = DLG_OKONLY + 14;
private static final int CHAT_REQUEST = 1;
private static final int BT_INVITE_RESULT = 2;
@ -235,6 +235,7 @@ public class BoardActivity extends XWActivity
case DLG_OKONLY:
case DLG_BADWORDS:
case DLG_RETRY:
case GAME_OVER:
ab = new AlertDialog.Builder( this )
.setTitle( m_dlgTitle )
.setMessage( m_dlgBytes )
@ -247,6 +248,15 @@ public class BoardActivity extends XWActivity
}
};
ab.setNegativeButton( R.string.button_retry, lstnr );
} else if ( GAME_OVER == id ) {
lstnr = new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg,
int whichButton ) {
Utils.notImpl( BoardActivity.this );
finish();
}
};
ab.setNegativeButton( R.string.button_rematch, lstnr );
}
dialog = ab.create();
Utils.setRemoveOnDismiss( this, dialog, id );
@ -1700,6 +1710,11 @@ public class BoardActivity extends XWActivity
launchLookup( wordsToArray((String)msg.obj),
m_gi.dictLang );
break;
case JNIThread.GAME_OVER:
m_dlgBytes = (String)msg.obj;
m_dlgTitle = msg.arg1;
showDialog( GAME_OVER );
break;
}
}
};

View file

@ -94,6 +94,7 @@ public class JNIThread extends Thread {
public static final int QUERY_ENDGAME = 4;
public static final int TOOLBAR_STATES = 5;
public static final int GOT_WORDS = 6;
public static final int GAME_OVER = 7;
public class GameStateInfo implements Cloneable {
public int visTileCount;
@ -528,8 +529,10 @@ public class JNIThread extends Thread {
((Boolean)args[0]).booleanValue();
int titleID = auto? R.string.summary_gameover
: R.string.finalscores_title;
sendForDialog( titleID,
XwJNI.server_writeFinalScores( m_jniGamePtr ) );
String text = XwJNI.server_writeFinalScores( m_jniGamePtr );
Message.obtain( m_handler, GAME_OVER, titleID, 0, text )
.sendToTarget();
}
break;