From 5b6a5aafe80f84c74b52bd5544d052101d3d5b74 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Fri, 29 Oct 2010 18:44:07 -0700 Subject: [PATCH] add three not-again messages displayed after connection is first made with the relay, for first-in-room, last-in-room, and the less common middle case. Add confirmation dialog for game reset. --- .../XWords4/res/values/common_rsrc.xml | 3 ++ .../android/XWords4/res/values/strings.xml | 35 +++++++++++++++---- .../eehouse/android/xw4/BoardActivity.java | 30 +++++++++++++--- .../org/eehouse/android/xw4/GamesList.java | 13 +++++-- 4 files changed, 67 insertions(+), 14 deletions(-) diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 5ecd3c3d6..8d549cc9f 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -50,6 +50,9 @@ key_notagain_undo key_notagain_done key_notagain_unlock + key_notagain_conndall + key_notagain_conndfirst + key_notagain_conndmid org.eehouse.android.xw4.relayids_extra diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index f604f8a85..6feb56174 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -186,7 +186,11 @@ save these changes it must be restarted. Do you want to save these changes? Are you sure you want to - delete all games? This action cannot be undone. + delete all games? This action cannot be undone. + Are you sure you want to reset this + game? Resetting erases all moves and any connection + information. + Are you sure you want to delete this dictionary? You will not be able to open any games that use it. @@ -293,8 +297,8 @@ SMS (broken) Bluetooth (pending) - Connected to relay in room - \"%s\". Waiting for %d player[s]. + Device %d connected to relay in + room \"%s\". Waiting for %d player[s]. All players are here in room \"%s\". Connection status. @@ -419,9 +423,15 @@ Or try joining or creating a public room. The new game you have created has - two players, the first a robot, both on this device. To play - the game, tap it; to change its configuration or for other - options, long-tap it. + two players, the first a robot, both on this device. Tap it to + play; long-tap it to change its configuration or for other + options. + The new game you have created + has two players but only one is on this device. To play the + game, tap it, and it will begin by connecting over the internet + looking for that other player in the default no-name + room. Long-tap it to configure - e.g. change the room name - or + for other options. This button shows all possible moves in ascending order (using tiles to the right of the rack @@ -439,7 +449,6 @@ This button undos or redoes the current turn. - The new game you have created The \"pts\" counter that appears at the right end of the rack is an alternative to this menu item. @@ -448,4 +457,16 @@ restarting it. When you leave this page you will have a chance to discard changes to avoid a restart. + You have connected and joined a + game on the relay; the room is now full. The device that + created the room will now assign your initial tiles and play can + begin. + You have connected and started + a game in a new room. Once the remaining devices have joined + your room and Crosswords has assigned them tiles the game can + begin. + You have connected and joined a + game on the relay. You will be notified when the remaining + device[s] have joined your room and play can begin. + 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 fb5d1b3bf..064ff8bb7 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -625,7 +625,9 @@ public class BoardActivity extends XWActivity implements UtilCtxt { { CommsTransport.ConndMsg cndmsg = (CommsTransport.ConndMsg)msg.obj; - Utils.logf( "handleConndMessage: devOrder=%d", cndmsg.m_devOrder ); + + int naMsg; + int naKey; String str = null; if ( cndmsg.m_allHere ) { // All players have now joined the game. The device that @@ -633,16 +635,34 @@ public class BoardActivity extends XWActivity implements UtilCtxt { // the first player's turn String fmt = getString( R.string.msg_relay_all_heref ); str = String.format( fmt, cndmsg.m_room ); + naMsg = R.string.not_again_conndall; + naKey = R.string.key_notagain_conndall; } else if ( cndmsg.m_nMissing > 0 ) { String fmt = getString( R.string.msg_relay_waiting ); - str = String.format( fmt, cndmsg.m_room, cndmsg.m_nMissing ); + str = String.format( fmt, cndmsg.m_devOrder, + cndmsg.m_room, cndmsg.m_nMissing ); + if ( cndmsg.m_devOrder == 1 ) { + naMsg = R.string.not_again_conndfirst; + naKey = R.string.key_notagain_conndfirst; + } else { + naMsg = R.string.not_again_conndmid; + naKey = R.string.key_notagain_conndmid; + } + } else { + naMsg = naKey = 0; // keep compiler happy } if ( null != str ) { - Toast.makeText( BoardActivity.this, str, - Toast.LENGTH_SHORT).show(); + final String fstr = str; + Runnable proc = new Runnable() { + public void run() { + Toast.makeText( BoardActivity.this, fstr, + Toast.LENGTH_SHORT).show(); + } + }; + showNotAgainDlgThen( naMsg, naKey, proc ); } - } + } // handleConndMessage ////////////////////////////////////////// // XW_UtilCtxt interface implementation // 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 2c463a474..5a7acee6a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -298,8 +298,17 @@ public class GamesList extends XWListActivity case R.id.list_item_reset: // TODO confirm_data_loss(); - GameUtils.resetGame( this, path, path ); - invalPath = path; + 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 );