set up intents to limit choices in sending invites to SMS and email,

and recast choices offered users from text vs. html to SMS vs. email.
Revert recent change (88986b49d5) adding
visible URL to email as it doesn't seem to be needed now.  Will want
to keep an eye on that.
This commit is contained in:
Andy2 2011-12-13 17:24:21 -08:00
parent e5294f2393
commit 0dfc1312ff
6 changed files with 38 additions and 33 deletions

View file

@ -1171,15 +1171,14 @@
<!-- The invitation process beging with this query. The choice is
between html and plaintext formatting but I also provide some
explanation/guidance. -->
<string name="text_or_html">Send invitation using plain text or
html? Text links are harder to open but can be sent via SMS.
Most devices let you send html only via email.</string>
<string name="sms_or_email">Send invitation using SMS (texting) or
email?</string>
<!-- When an invitation is sent, the user gets to choose between
plaintext and html formatting. These two strings are shown in the
two buttons in the dialog. -->
<string name="button_text">Text</string>
<string name="button_html">Html</string>
<string name="button_text">SMS/Text</string>
<string name="button_html">Email</string>
<!-- This is the subject line of the email/text sent to invite
someone to join a game. -->
@ -1190,18 +1189,18 @@
substituted for "%1$s". (The funky \u003c and friends are
encodings for the greater-than and less-than symbols which
are not legal in xml strings.)-->
<string name="invite_htmf">\u003ca href=\"%1$s\"\u003ETap
here\u003c/a\u003E (%1$s) to accept my invitation and join this
<string name="invite_htmf">\u003ca href=\"%1$s\"\u003ETap here to
accept\u003c/a\u003E my invitation and join this
game.\u003cbr\u003E \u003ca
href=\"http://eehouse.org/market_redir.php\"\u003E Tap
here\u003c/a\u003E (http://eehouse.org/market_redir.php) to
install Crosswords if you haven\'t already.</string>
href=\"http://eehouse.org/market_redir.php\"\u003E
Tap here to install Crosswords\u003c/a\u003E if you haven\'t
already.</string>
<!-- This is the body of the text version of the invitation. A URL
is created with parameters describing the game and
substituted for "%1$s".-->
<string name="invite_txtf">Accept my invitation and join this
game: %1$s . (But install Crosswords first:
<string name="invite_txtf">Play Crosswords? Join this
game: %1$s . (But install Crosswords first if you haven\'t:
http://eehouse.org/market_redir.php ).</string>
<!-- When I've created the invitation, in text or html, I ask

View file

@ -353,7 +353,7 @@ public class BoardActivity extends XWActivity
lstnr = new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dialog,
int item ) {
showTextOrHtmlThen( LAUNCH_INVITE_ACTION );
showEmailOrSMSThen( LAUNCH_INVITE_ACTION );
}
};
dialog = new AlertDialog.Builder( this )
@ -669,7 +669,7 @@ public class BoardActivity extends XWActivity
if ( LAUNCH_INVITE_ACTION == id ) {
if ( DlgDelegate.DISMISS_BUTTON != which ) {
GameUtils.launchInviteActivity( BoardActivity.this,
DlgDelegate.TEXT_BTN == which,
DlgDelegate.EMAIL_BTN == which,
m_room,
m_gi.dictLang,
m_gi.nPlayers );

View file

@ -46,8 +46,8 @@ public class DlgDelegate {
public static final int DLG_LOOKUP = 7;
public static final int DIALOG_LAST = DLG_LOOKUP;
public static final int TEXT_BTN = AlertDialog.BUTTON_POSITIVE;
public static final int HTML_BTN = AlertDialog.BUTTON_NEGATIVE;
public static final int SMS_BTN = AlertDialog.BUTTON_POSITIVE;
public static final int EMAIL_BTN = AlertDialog.BUTTON_NEGATIVE;
public static final int DISMISS_BUTTON = 0;
public static final int SKIP_CALLBACK = -1;
@ -232,7 +232,7 @@ public class DlgDelegate {
m_activity.showDialog( CONFIRM_THEN );
}
public void showTextOrHtmlThen( int callbackID )
public void showEmailOrSMSThen( int callbackID )
{
Assert.assertTrue( 0 != callbackID );
Assert.assertTrue( 0 == m_cbckID );
@ -351,7 +351,7 @@ public class DlgDelegate {
DialogInterface.OnClickListener lstnr = mkCallbackClickListener();
Dialog dialog = new AlertDialog.Builder( m_activity )
.setTitle( R.string.query_title )
.setMessage( R.string.text_or_html )
.setMessage( R.string.sms_or_email )
.setPositiveButton( R.string.button_text, lstnr )
.setNegativeButton( R.string.button_html, lstnr )
.create();

View file

@ -412,7 +412,7 @@ public class GameUtils {
}
public static void launchInviteActivity( Context context,
boolean choseText,
boolean choseEmail,
String room,
int lang, int nPlayers )
{
@ -421,16 +421,22 @@ public class GameUtils {
lang, nPlayers );
if ( null != gameUri ) {
Intent intent = new Intent( Intent.ACTION_SEND );
intent.setType( choseText? "text/plain" : "text/html");
intent.putExtra( Intent.EXTRA_SUBJECT,
context.getString( R.string.invite_subject ) );
int fmtId = choseText? R.string.invite_txtf : R.string.invite_htmf;
int fmtId = choseEmail? R.string.invite_htmf : R.string.invite_txtf;
String format = context.getString( fmtId );
String message = String.format( format, gameUri.toString() );
intent.putExtra( Intent.EXTRA_TEXT,
choseText ? message : Html.fromHtml(message) );
Intent intent = new Intent();
if ( choseEmail ) {
intent.setAction( Intent.ACTION_SEND );
intent.setType( "message/rfc822");
intent.putExtra( Intent.EXTRA_SUBJECT,
context.getString( R.string.invite_subject ) );
intent.putExtra( Intent.EXTRA_TEXT, Html.fromHtml(message) );
} else {
intent.setAction( Intent.ACTION_VIEW );
intent.setType( "vnd.android-dir/mms-sms" );
intent.putExtra( "sms_body", message );
}
String chooserMsg = context.getString( R.string.invite_chooser );
context.startActivity( Intent.createChooser( intent, chooserMsg ) );

View file

@ -94,7 +94,7 @@ public class NewGameActivity extends XWActivity {
switch( id ) {
case NEW_GAME_ACTION:
if ( DlgDelegate.DISMISS_BUTTON != which ) {
makeNewGame( true, true, DlgDelegate.TEXT_BTN == which );
makeNewGame( true, true, DlgDelegate.EMAIL_BTN == which );
}
break;
default:
@ -106,14 +106,14 @@ public class NewGameActivity extends XWActivity {
{
if ( launch && networked ) {
// Let 'em cancel before we make the game
showTextOrHtmlThen( NEW_GAME_ACTION );
showEmailOrSMSThen( NEW_GAME_ACTION );
} else {
makeNewGame( networked, launch, false );
}
}
private void makeNewGame( boolean networked, boolean launch,
boolean choseText )
boolean choseEmail )
{
String room = null;
long rowid;
@ -131,7 +131,7 @@ public class NewGameActivity extends XWActivity {
if ( launch ) {
GameUtils.launchGame( this, rowid, networked );
if ( networked ) {
GameUtils.launchInviteActivity( this, choseText, room,
GameUtils.launchInviteActivity( this, choseEmail, room,
lang[0], nPlayers );
}
} else {

View file

@ -141,9 +141,9 @@ public class XWActivity extends Activity
m_delegate.showConfirmThen( getString(msgID), action );
}
public void showTextOrHtmlThen( int action )
public void showEmailOrSMSThen( int action )
{
m_delegate.showTextOrHtmlThen( action );
m_delegate.showEmailOrSMSThen( action );
}
protected void doSyncMenuitem()