mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
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:
parent
e5294f2393
commit
0dfc1312ff
6 changed files with 38 additions and 33 deletions
|
@ -1171,15 +1171,14 @@
|
||||||
<!-- The invitation process beging with this query. The choice is
|
<!-- The invitation process beging with this query. The choice is
|
||||||
between html and plaintext formatting but I also provide some
|
between html and plaintext formatting but I also provide some
|
||||||
explanation/guidance. -->
|
explanation/guidance. -->
|
||||||
<string name="text_or_html">Send invitation using plain text or
|
<string name="sms_or_email">Send invitation using SMS (texting) or
|
||||||
html? Text links are harder to open but can be sent via SMS.
|
email?</string>
|
||||||
Most devices let you send html only via email.</string>
|
|
||||||
|
|
||||||
<!-- When an invitation is sent, the user gets to choose between
|
<!-- When an invitation is sent, the user gets to choose between
|
||||||
plaintext and html formatting. These two strings are shown in the
|
plaintext and html formatting. These two strings are shown in the
|
||||||
two buttons in the dialog. -->
|
two buttons in the dialog. -->
|
||||||
<string name="button_text">Text</string>
|
<string name="button_text">SMS/Text</string>
|
||||||
<string name="button_html">Html</string>
|
<string name="button_html">Email</string>
|
||||||
|
|
||||||
<!-- This is the subject line of the email/text sent to invite
|
<!-- This is the subject line of the email/text sent to invite
|
||||||
someone to join a game. -->
|
someone to join a game. -->
|
||||||
|
@ -1190,18 +1189,18 @@
|
||||||
substituted for "%1$s". (The funky \u003c and friends are
|
substituted for "%1$s". (The funky \u003c and friends are
|
||||||
encodings for the greater-than and less-than symbols which
|
encodings for the greater-than and less-than symbols which
|
||||||
are not legal in xml strings.)-->
|
are not legal in xml strings.)-->
|
||||||
<string name="invite_htmf">\u003ca href=\"%1$s\"\u003ETap
|
<string name="invite_htmf">\u003ca href=\"%1$s\"\u003ETap here to
|
||||||
here\u003c/a\u003E (%1$s) to accept my invitation and join this
|
accept\u003c/a\u003E my invitation and join this
|
||||||
game.\u003cbr\u003E \u003ca
|
game.\u003cbr\u003E \u003ca
|
||||||
href=\"http://eehouse.org/market_redir.php\"\u003E Tap
|
href=\"http://eehouse.org/market_redir.php\"\u003E
|
||||||
here\u003c/a\u003E (http://eehouse.org/market_redir.php) to
|
Tap here to install Crosswords\u003c/a\u003E if you haven\'t
|
||||||
install Crosswords if you haven\'t already.</string>
|
already.</string>
|
||||||
|
|
||||||
<!-- This is the body of the text version of the invitation. A URL
|
<!-- This is the body of the text version of the invitation. A URL
|
||||||
is created with parameters describing the game and
|
is created with parameters describing the game and
|
||||||
substituted for "%1$s".-->
|
substituted for "%1$s".-->
|
||||||
<string name="invite_txtf">Accept my invitation and join this
|
<string name="invite_txtf">Play Crosswords? Join this
|
||||||
game: %1$s . (But install Crosswords first:
|
game: %1$s . (But install Crosswords first if you haven\'t:
|
||||||
http://eehouse.org/market_redir.php ).</string>
|
http://eehouse.org/market_redir.php ).</string>
|
||||||
|
|
||||||
<!-- When I've created the invitation, in text or html, I ask
|
<!-- When I've created the invitation, in text or html, I ask
|
||||||
|
|
|
@ -353,7 +353,7 @@ public class BoardActivity extends XWActivity
|
||||||
lstnr = new DialogInterface.OnClickListener() {
|
lstnr = new DialogInterface.OnClickListener() {
|
||||||
public void onClick( DialogInterface dialog,
|
public void onClick( DialogInterface dialog,
|
||||||
int item ) {
|
int item ) {
|
||||||
showTextOrHtmlThen( LAUNCH_INVITE_ACTION );
|
showEmailOrSMSThen( LAUNCH_INVITE_ACTION );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
dialog = new AlertDialog.Builder( this )
|
dialog = new AlertDialog.Builder( this )
|
||||||
|
@ -669,7 +669,7 @@ public class BoardActivity extends XWActivity
|
||||||
if ( LAUNCH_INVITE_ACTION == id ) {
|
if ( LAUNCH_INVITE_ACTION == id ) {
|
||||||
if ( DlgDelegate.DISMISS_BUTTON != which ) {
|
if ( DlgDelegate.DISMISS_BUTTON != which ) {
|
||||||
GameUtils.launchInviteActivity( BoardActivity.this,
|
GameUtils.launchInviteActivity( BoardActivity.this,
|
||||||
DlgDelegate.TEXT_BTN == which,
|
DlgDelegate.EMAIL_BTN == which,
|
||||||
m_room,
|
m_room,
|
||||||
m_gi.dictLang,
|
m_gi.dictLang,
|
||||||
m_gi.nPlayers );
|
m_gi.nPlayers );
|
||||||
|
|
|
@ -46,8 +46,8 @@ public class DlgDelegate {
|
||||||
public static final int DLG_LOOKUP = 7;
|
public static final int DLG_LOOKUP = 7;
|
||||||
public static final int DIALOG_LAST = DLG_LOOKUP;
|
public static final int DIALOG_LAST = DLG_LOOKUP;
|
||||||
|
|
||||||
public static final int TEXT_BTN = AlertDialog.BUTTON_POSITIVE;
|
public static final int SMS_BTN = AlertDialog.BUTTON_POSITIVE;
|
||||||
public static final int HTML_BTN = AlertDialog.BUTTON_NEGATIVE;
|
public static final int EMAIL_BTN = AlertDialog.BUTTON_NEGATIVE;
|
||||||
public static final int DISMISS_BUTTON = 0;
|
public static final int DISMISS_BUTTON = 0;
|
||||||
public static final int SKIP_CALLBACK = -1;
|
public static final int SKIP_CALLBACK = -1;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ public class DlgDelegate {
|
||||||
m_activity.showDialog( CONFIRM_THEN );
|
m_activity.showDialog( CONFIRM_THEN );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showTextOrHtmlThen( int callbackID )
|
public void showEmailOrSMSThen( int callbackID )
|
||||||
{
|
{
|
||||||
Assert.assertTrue( 0 != callbackID );
|
Assert.assertTrue( 0 != callbackID );
|
||||||
Assert.assertTrue( 0 == m_cbckID );
|
Assert.assertTrue( 0 == m_cbckID );
|
||||||
|
@ -351,7 +351,7 @@ public class DlgDelegate {
|
||||||
DialogInterface.OnClickListener lstnr = mkCallbackClickListener();
|
DialogInterface.OnClickListener lstnr = mkCallbackClickListener();
|
||||||
Dialog dialog = new AlertDialog.Builder( m_activity )
|
Dialog dialog = new AlertDialog.Builder( m_activity )
|
||||||
.setTitle( R.string.query_title )
|
.setTitle( R.string.query_title )
|
||||||
.setMessage( R.string.text_or_html )
|
.setMessage( R.string.sms_or_email )
|
||||||
.setPositiveButton( R.string.button_text, lstnr )
|
.setPositiveButton( R.string.button_text, lstnr )
|
||||||
.setNegativeButton( R.string.button_html, lstnr )
|
.setNegativeButton( R.string.button_html, lstnr )
|
||||||
.create();
|
.create();
|
||||||
|
|
|
@ -412,7 +412,7 @@ public class GameUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void launchInviteActivity( Context context,
|
public static void launchInviteActivity( Context context,
|
||||||
boolean choseText,
|
boolean choseEmail,
|
||||||
String room,
|
String room,
|
||||||
int lang, int nPlayers )
|
int lang, int nPlayers )
|
||||||
{
|
{
|
||||||
|
@ -421,16 +421,22 @@ public class GameUtils {
|
||||||
lang, nPlayers );
|
lang, nPlayers );
|
||||||
|
|
||||||
if ( null != gameUri ) {
|
if ( null != gameUri ) {
|
||||||
Intent intent = new Intent( Intent.ACTION_SEND );
|
int fmtId = choseEmail? R.string.invite_htmf : R.string.invite_txtf;
|
||||||
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;
|
|
||||||
String format = context.getString( fmtId );
|
String format = context.getString( fmtId );
|
||||||
String message = String.format( format, gameUri.toString() );
|
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 );
|
String chooserMsg = context.getString( R.string.invite_chooser );
|
||||||
context.startActivity( Intent.createChooser( intent, chooserMsg ) );
|
context.startActivity( Intent.createChooser( intent, chooserMsg ) );
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class NewGameActivity extends XWActivity {
|
||||||
switch( id ) {
|
switch( id ) {
|
||||||
case NEW_GAME_ACTION:
|
case NEW_GAME_ACTION:
|
||||||
if ( DlgDelegate.DISMISS_BUTTON != which ) {
|
if ( DlgDelegate.DISMISS_BUTTON != which ) {
|
||||||
makeNewGame( true, true, DlgDelegate.TEXT_BTN == which );
|
makeNewGame( true, true, DlgDelegate.EMAIL_BTN == which );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -106,14 +106,14 @@ public class NewGameActivity extends XWActivity {
|
||||||
{
|
{
|
||||||
if ( launch && networked ) {
|
if ( launch && networked ) {
|
||||||
// Let 'em cancel before we make the game
|
// Let 'em cancel before we make the game
|
||||||
showTextOrHtmlThen( NEW_GAME_ACTION );
|
showEmailOrSMSThen( NEW_GAME_ACTION );
|
||||||
} else {
|
} else {
|
||||||
makeNewGame( networked, launch, false );
|
makeNewGame( networked, launch, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeNewGame( boolean networked, boolean launch,
|
private void makeNewGame( boolean networked, boolean launch,
|
||||||
boolean choseText )
|
boolean choseEmail )
|
||||||
{
|
{
|
||||||
String room = null;
|
String room = null;
|
||||||
long rowid;
|
long rowid;
|
||||||
|
@ -131,7 +131,7 @@ public class NewGameActivity extends XWActivity {
|
||||||
if ( launch ) {
|
if ( launch ) {
|
||||||
GameUtils.launchGame( this, rowid, networked );
|
GameUtils.launchGame( this, rowid, networked );
|
||||||
if ( networked ) {
|
if ( networked ) {
|
||||||
GameUtils.launchInviteActivity( this, choseText, room,
|
GameUtils.launchInviteActivity( this, choseEmail, room,
|
||||||
lang[0], nPlayers );
|
lang[0], nPlayers );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -141,9 +141,9 @@ public class XWActivity extends Activity
|
||||||
m_delegate.showConfirmThen( getString(msgID), action );
|
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()
|
protected void doSyncMenuitem()
|
||||||
|
|
Loading…
Add table
Reference in a new issue