add extra explanatory text to phone number invite dialog

Set different expectations based on whether the invitation's by NBS or a
launch of the messaging app.
This commit is contained in:
Eric House 2019-02-26 12:25:17 -08:00
parent 13b789847c
commit 8fb1a8405a
5 changed files with 63 additions and 6 deletions

View file

@ -1068,7 +1068,8 @@ public class BoardDelegate extends DelegateBase
case INVITE_SMS_DATA:
int nMissing = (Integer)params[0];
SentInvitesInfo info = (SentInvitesInfo)params[1];
launchPhoneNumberInvite( nMissing, info, RequestCode.SMS_DATA_INVITE_RESULT );
launchPhoneNumberInvite( nMissing, info, InviteMeans.SMS_DATA,
RequestCode.SMS_DATA_INVITE_RESULT );
break;
case ASKED_PHONE_STATE:
@ -1227,7 +1228,7 @@ public class BoardDelegate extends DelegateBase
Action.INVITE_SMS_DATA, m_mySIS.nMissing, info );
break;
case SMS_USER: // like an email invite, but we want the phone #
launchPhoneNumberInvite( m_mySIS.nMissing, info,
launchPhoneNumberInvite( m_mySIS.nMissing, info, means,
RequestCode.SMS_USER_INVITE_RESULT );
break;
case RELAY:
@ -1505,9 +1506,10 @@ public class BoardDelegate extends DelegateBase
}
private void launchPhoneNumberInvite( int nMissing, SentInvitesInfo info,
RequestCode code )
InviteMeans means, RequestCode code )
{
SMSInviteDelegate.launchForResult( m_activity, nMissing, info, code );
SMSInviteDelegate.launchForResult( m_activity, nMissing, info,
means, code );
}
private void deleteAndClose()

View file

@ -132,6 +132,13 @@ abstract class InviteDelegate extends ListDelegateBase
TextView descView = (TextView)findViewById( R.id.invite_desc );
descView.setText( descTxt );
int extraID = getExtra();
if ( 0 != extraID ) {
TextView extraView = (TextView)findViewById( R.id.invite_extra );
extraView.setText( getString( extraID ) );
extraView.setVisibility( View.VISIBLE );
}
m_lv = (ListView)findViewById( android.R.id.list );
m_ev = (TextView)findViewById( android.R.id.empty );
if ( null != m_lv && null != m_ev && 0 != emptyMsgId ) {
@ -146,6 +153,9 @@ abstract class InviteDelegate extends ListDelegateBase
// Children implement ...
abstract void onChildAdded( View child, InviterItem item );
// Implement this if you want to insert descriptive text
int getExtra() { return 0; }
// Subclasses are meant to call this
protected void addButtonBar( int buttonBarId, int[] buttonBarItemIds )
{

View file

@ -57,21 +57,25 @@ public class SMSInviteDelegate extends InviteDelegate {
R.id.manual_add_button,
R.id.button_clear,
};
private static final String INTENT_KEY_MEANS = "means";
private ArrayList<PhoneRec> m_phoneRecs;
private boolean m_immobileConfirmed;
private Activity m_activity;
private InviteMeans mMeans;
public static void launchForResult( Activity activity, int nMissing,
SentInvitesInfo info,
InviteMeans means,
RequestCode requestCode )
{
Intent intent = InviteDelegate
.makeIntent( activity, SMSInviteActivity.class,
nMissing, info );
nMissing, info )
.putExtra( INTENT_KEY_MEANS, means.ordinal() );
if ( null != info ) {
String lastDev = info.getLastDev( InviteMeans.SMS_DATA );
String lastDev = info.getLastDev( means );
intent.putExtra( INTENT_KEY_LASTDEV, lastDev );
}
activity.startActivityForResult( intent, requestCode.ordinal() );
@ -86,6 +90,7 @@ public class SMSInviteDelegate extends InviteDelegate {
@Override
protected void init( Bundle savedInstanceState )
{
mMeans = InviteMeans.values()[getIntent().getIntExtra(INTENT_KEY_MEANS, -1)];
String msg = getString( R.string.button_invite );
msg = getQuantityString( R.plurals.invite_sms_desc_fmt, m_nMissing,
m_nMissing, msg );
@ -98,6 +103,24 @@ public class SMSInviteDelegate extends InviteDelegate {
askContactsPermission();
}
@Override
int getExtra()
{
int result = 0;
switch( mMeans ) {
case SMS_DATA:
result = R.string.invite_nbs_desc;
break;
case SMS_USER:
result = R.string.invite_sms_desc;
break;
default:
Assert.assertFalse( BuildConfig.DEBUG );
break;
}
return result;
}
@Override
protected void onBarButtonClicked( int id )
{

View file

@ -13,6 +13,14 @@
android:padding="8dp"
/>
<TextView android:id="@+id/invite_extra"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="8dp"
android:visibility="gone"
/>
<ListView android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

View file

@ -1921,6 +1921,20 @@
<item quantity="other">Please check the %1$d phone numbers you
want to invite to your new game, then tap \"%2$s\".</item>
</plurals>
<!-- Appears near top of invitation phone number picker when it's
the user-visible SMS case -->
<string name="invite_sms_desc">Your SMS messaging app will then be
launched with a message for you to send to the phone number
you\'ve selected.</string>
<!-- Appears near top of invitation phone number picker when it's
the user-invisible Data SMS case -->
<string name="invite_nbs_desc">A data message will then be
delivered to the device with that phone number. If CrossWords is
installed there and has the necessary permissions it will receive
the invitation and play can begin.</string>
<!-- -->
<plurals name="invite_relay_desc_fmt">
<item quantity="one">Please check the device you want to invite