add text to missing player alert suggesting tap-to-invite, and dismiss

it if user does so while it's still up (via a bit of a hack).
This commit is contained in:
Eric House 2014-09-12 07:10:18 -07:00
parent 94b51cf53b
commit b6f708ee75
7 changed files with 511 additions and 477 deletions

File diff suppressed because it is too large Load diff

View file

@ -526,6 +526,10 @@
player[s]. Would you like to invite someone to join -- assuming
you haven\'t already?</string>
<!-- Appended to message above if local device has NFC available -->
<string name="invite_if_nfc">(Or just Tap to Invite -- if the
other device also has Android Beaming and is nearby.)</string>
<!-- Toast shown when players are missing, same time as above
but more subtle. -->
<string name="players_miss_fmt">%1$d player[s] missing</string>

View file

@ -443,6 +443,9 @@
<string name="invite_msg_fmt">Siht emag si gnissim %1$d etomer
]s[reyalp. Dluow uoy ekil ot etivni enoemos ot nioj -- gnimussa
uoy nevah\'t ?ydaerla</string>
<!-- Appended to message above if local device has NFC available -->
<string name="invite_if_nfc">rO( tsuj Pat ot Etivni -- fi eht
rehto ecived osla sah Diordna Gnimaeb dna si ybraen.)</string>
<!-- Toast shown when players are missing, same time as above
but more subtle. -->
<string name="players_miss_fmt">%1$d ]s[reyalp gnissim</string>

View file

@ -443,6 +443,9 @@
<string name="invite_msg_fmt">THIS GAME IS MISSING %1$d REMOTE
PLAYER[S]. WOULD YOU LIKE TO INVITE SOMEONE TO JOIN -- ASSUMING
YOU HAVEN\'T ALREADY?</string>
<!-- Appended to message above if local device has NFC available -->
<string name="invite_if_nfc">(OR JUST TAP TO INVITE -- IF THE
OTHER DEVICE ALSO HAS ANDROID BEAMING AND IS NEARBY.)</string>
<!-- Toast shown when players are missing, same time as above
but more subtle. -->
<string name="players_miss_fmt">%1$d PLAYER[S] MISSING</string>

View file

@ -1179,6 +1179,7 @@ public class BoardDelegate extends DelegateBase
if ( 0 < m_nMissingPlayers ) {
data = BTLaunchInfo.makeLaunchJSON( m_gi.gameID, m_gi.dictLang,
m_gi.dictName, m_gi.nPlayers );
dismissConfirmThen();
}
break;
default:
@ -1656,15 +1657,21 @@ public class BoardDelegate extends DelegateBase
if ( null != action ) {
m_haveInvited = true;
final Action faction = action;
final String fmsg = getString( R.string.invite_msg_fmt,
nMissingPlayers );
post( new Runnable() {
public void run() {
DbgUtils.showf( m_activity,
getString( R.string.players_miss_fmt,
nMissingPlayers ) );
m_nMissingPlayers = nMissingPlayers;
showConfirmThen( fmsg, faction );
String msg = getString( R.string.invite_msg_fmt,
nMissingPlayers );
boolean[] avail = NFCUtils.nfcAvail( m_activity );
if ( avail[1] ) {
msg += "\n\n" + getString( R.string.invite_if_nfc );
}
showConfirmThen( msg, R.string.newgame_invite, faction );
}
} );
}

View file

@ -376,6 +376,11 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify,
m_delegate.showConfirmThen( msgID, action );
}
protected void dismissConfirmThen()
{
m_delegate.dismissConfirmThen();
}
protected boolean post( Runnable runnable )
{
return m_delegate.post( runnable );

View file

@ -311,6 +311,15 @@ public class DlgDelegate {
showDialog( DlgID.CONFIRM_THEN );
}
public void dismissConfirmThen()
{
try {
m_activity.dismissDialog( DlgID.CONFIRM_THEN.ordinal() );
} catch ( java.lang.IllegalArgumentException iae ) {
// Do nothing. It's ok for the thing not to be there.
}
}
public void showInviteChoicesThen( final Action action )
{
if ( Utils.deviceSupportsSMS( m_activity )