improve text around invitations

This commit is contained in:
Eric House 2016-01-13 19:51:24 -08:00
parent e98ba8d84a
commit bdafcfa916
7 changed files with 712 additions and 609 deletions

File diff suppressed because it is too large Load diff

View file

@ -549,9 +549,13 @@
</plurals>
<plurals name="invite_sent_fmt">
<item quantity="one">You have already invited a remote player to
this game. We are waiting for him/her to connect back.</item>
<item quantity="other">You have already invited %1$d players to
this game. We are waiting for them to connect back.</item>
this game. We are waiting for him/her to respond. Please
use the re-invite button if you think the invitation did not go
out.</item>
<item quantity="other">You have already sent %1$d unique
invitations for this game. We are waiting for %2$d of the
recipients to respond. Please use the re-invite button if you
think the invitations did not go out.</item>
</plurals>
<string name="invited_msg">This game was created from an
invitation you received. As soon as it is able to connect to the
@ -579,6 +583,15 @@
this alert will not be dismissed until everybody has been invited
and all invitations have been accepted.)</string>
<string name="invit_expl_sms_fmt">Invite sent via SMS to phone
number %1$s on %2$s</string>
<string name="invit_expl_bt_fmt">Invite sent via Bluetooth to
paired device %1$s on %2$s</string>
<string name="invit_expl_relay_fmt">Invite forwarded by the relay
to another device on %1$s</string>
<string name="invit_expl_notarget_fmt">Invite sent via %1$s on
%2$s. Recipient unknown.</string>
<!-- Short for "points", this is shown at the right end of the
tray in place of the first tile placed along with the points
the current move would earn if committed. -->

View file

@ -467,9 +467,13 @@
</plurals>
<plurals name="invite_sent_fmt">
<item quantity="one">Uoy evah ydaerla detivni a etomer reyalp ot
siht emag. Ew era gnitiaw rof reh/mih ot tcennoc kcab.</item>
<item quantity="other">Uoy evah ydaerla detivni %1$d sreyalp ot
siht emag. Ew era gnitiaw rof meht ot tcennoc kcab.</item>
siht emag. Ew era gnitiaw rof reh/mih ot dnopser. Esaelp
esu eht etivni-er nottub fi uoy kniht eht noitativni did ton og
tuo.</item>
<item quantity="other">Uoy evah ydaerla tnes %1$d euqinu
snoitativni rof siht emag. Ew era gnitiaw rof %2$d fo eht
stneipicer ot dnopser. Esaelp esu eht etivni-er nottub fi uoy
kniht eht snoitativni did ton og tuo.</item>
</plurals>
<string name="invited_msg">Siht emag saw detaerc morf na
noitativni uoy deviecer. Sa noos sa ti si elba ot tcennoc ot eht
@ -493,6 +497,14 @@
etomer sreyalp. Uoy nod\'t evah ot etivni meht lla ta ,ecno tub
siht trela lliw ton eb dessimsid litnu ydobyreve sah neeb detivni
dna lla snoitativni evah neeb detpecca.)</string>
<string name="invit_expl_sms_fmt">Etivni tnes aiv SMS ot enohp
rebmun %1$s no %2$s</string>
<string name="invit_expl_bt_fmt">Etivni tnes aiv Htooteulb ot
deriap ecived %1$s no %2$s</string>
<string name="invit_expl_relay_fmt">Etivni dedrawrof yb eht yaler
ot rehtona ecived no %1$s</string>
<string name="invit_expl_notarget_fmt">Etivni tnes aiv %1$s no
%2$s. Tneipicer nwonknu.</string>
<!-- Short for "points", this is shown at the right end of the
tray in place of the first tile placed along with the points
the current move would earn if committed. -->

View file

@ -467,9 +467,13 @@
</plurals>
<plurals name="invite_sent_fmt">
<item quantity="one">YOU HAVE ALREADY INVITED A REMOTE PLAYER TO
THIS GAME. WE ARE WAITING FOR HIM/HER TO CONNECT BACK.</item>
<item quantity="other">YOU HAVE ALREADY INVITED %1$d PLAYERS TO
THIS GAME. WE ARE WAITING FOR THEM TO CONNECT BACK.</item>
THIS GAME. WE ARE WAITING FOR HIM/HER TO RESPOND. PLEASE
USE THE RE-INVITE BUTTON IF YOU THINK THE INVITATION DID NOT GO
OUT.</item>
<item quantity="other">YOU HAVE ALREADY SENT %1$d UNIQUE
INVITATIONS FOR THIS GAME. WE ARE WAITING FOR %2$d OF THE
RECIPIENTS TO RESPOND. PLEASE USE THE RE-INVITE BUTTON IF YOU
THINK THE INVITATIONS DID NOT GO OUT.</item>
</plurals>
<string name="invited_msg">THIS GAME WAS CREATED FROM AN
INVITATION YOU RECEIVED. AS SOON AS IT IS ABLE TO CONNECT TO THE
@ -493,6 +497,14 @@
REMOTE PLAYERS. YOU DON\'T HAVE TO INVITE THEM ALL AT ONCE, BUT
THIS ALERT WILL NOT BE DISMISSED UNTIL EVERYBODY HAS BEEN INVITED
AND ALL INVITATIONS HAVE BEEN ACCEPTED.)</string>
<string name="invit_expl_sms_fmt">INVITE SENT VIA SMS TO PHONE
NUMBER %1$s ON %2$s</string>
<string name="invit_expl_bt_fmt">INVITE SENT VIA BLUETOOTH TO
PAIRED DEVICE %1$s ON %2$s</string>
<string name="invit_expl_relay_fmt">INVITE FORWARDED BY THE RELAY
TO ANOTHER DEVICE ON %1$s</string>
<string name="invit_expl_notarget_fmt">INVITE SENT VIA %1$s ON
%2$s. RECIPIENT UNKNOWN.</string>
<!-- Short for "points", this is shown at the right end of the
tray in place of the first tile placed along with the points
the current move would earn if committed. -->

View file

@ -449,7 +449,7 @@ public class BoardDelegate extends DelegateBase
OnClickListener lstnrMore = new OnClickListener() {
public void onClick( DialogInterface dialog,
int item ) {
showOKOnlyDialog( m_sentInfo.getAsText() );
showOKOnlyDialog( m_sentInfo.getAsText( m_activity ) );
}
};
@ -515,12 +515,12 @@ public class BoardDelegate extends DelegateBase
}
} else {
m_sentInfo = DBUtils.getInvitesFor( m_activity, m_rowid );
int nSent = m_sentInfo.getPlayerCount();
int nSent = m_sentInfo.getMinPlayerCount();
boolean haveSent = nSent >= m_nMissing;
if ( haveSent ) {
titleID = R.string.waiting_invite_title;
message = getQuantityString( R.plurals.invite_sent_fmt,
nSent, nSent );
nSent, nSent, m_nMissing );
buttonTxt = R.string.button_reinvite;
nukeNeutButton = false;
} else if ( DeviceRole.SERVER_ISCLIENT == m_gi.serverRole ) {

View file

@ -422,10 +422,10 @@ public class DBUtils {
public static class SentInvitesInfo {
public long m_rowid;
private int m_count = 0;
private ArrayList<InviteMeans> m_means;
private ArrayList<String> m_target;
private ArrayList<Timestamp> m_timestamp;
private int m_cachedCount = 0;
private SentInvitesInfo( long rowID ) {
m_rowid = rowID;
@ -436,22 +436,84 @@ public class DBUtils {
private void addEntry( InviteMeans means, String target, Timestamp ts )
{
++m_count;
m_means.add( means );
m_target.add( target );
m_timestamp.add( ts );
}
public int getPlayerCount() {
return m_count;
m_cachedCount = -1;
}
public String getAsText() {
String[] strs = new String[m_count];
for ( int ii = 0; ii < m_count; ++ii ) {
strs[ii] = String.format( "Invite sent to dev %s via %s on %s",
m_target.get(ii), m_means.get(ii).toString(),
m_timestamp.get(ii).toString() );
// There will be lots of duplicates, but we can't detect them all. BUT
// if means and target are the same it's definitely a dup. So count
// them all and return the largest number we have. 99% of the time we
// care only that it's non-0.
public int getMinPlayerCount() {
if ( -1 == m_cachedCount ) {
DbgUtils.logf( "getMinPlayerCount(%H)", this );
int count = m_timestamp.size();
Map<InviteMeans, Set<String>> hashes
= new HashMap<InviteMeans, Set<String>>();
int fakeCount = 0; // make all null-targets count for one
for ( int ii = 0; ii < count; ++ii ) {
InviteMeans means = m_means.get(ii);
Set<String> devs;
if ( ! hashes.containsKey( means ) ) {
DbgUtils.logf( "creating new hash for means %s", means.toString() );
devs = new HashSet<String>();
hashes.put( means, devs );
}
devs = hashes.get( means );
String target = m_target.get( ii );
if ( null == target ) {
target = String.format( "%d", ++fakeCount );
}
devs.add( target );
DbgUtils.logf( "added target %s for means %s", target, means.toString() );
}
// Now find the max
m_cachedCount = 0;
for ( InviteMeans means : InviteMeans.values() ) {
if ( hashes.containsKey( means ) ) {
int siz = hashes.get( means ).size();
m_cachedCount += siz;
DbgUtils.logf( "counting: means %s has unique count of %d",
means.toString(), siz );
}
}
}
DbgUtils.logf( "getMinPlayerCount(%H) => %d", this, m_cachedCount );
return m_cachedCount;
}
public String getAsText( Context context )
{
int count = m_timestamp.size();
String[] strs = new String[count];
for ( int ii = 0; ii < count; ++ii ) {
InviteMeans means = m_means.get(ii);
String target = m_target.get(ii);
String timestamp = m_timestamp.get(ii).toString();
String msg;
switch ( means ) {
case SMS:
msg = LocUtils.getString( context, R.string.invit_expl_sms_fmt,
target, timestamp );
break;
case BLUETOOTH:
msg = LocUtils.getString( context, R.string.invit_expl_bt_fmt,
target, timestamp );
break;
case RELAY:
msg = LocUtils.getString( context, R.string.invit_expl_relay_fmt,
timestamp );
break;
default:
msg = LocUtils.getString( context, R.string.invit_expl_notarget_fmt,
means.toString(), timestamp );
}
strs[ii] = msg;
}
return TextUtils.join( "\n\n", strs );
}

View file

@ -207,7 +207,7 @@ public class GameSummary {
if ( 0 < missing ) {
DBUtils.SentInvitesInfo si = DBUtils.getInvitesFor( m_context,
rowid );
if ( si.getPlayerCount() >= missing ) {
if ( si.getMinPlayerCount() >= missing ) {
result = LocUtils.getString( m_context,
R.string.summary_invites_out );
}