diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 500622bee..4919fe1c0 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -72,9 +72,7 @@ eehouse.org http://eehouse.org/and_dicts_hh 4.4 beta 28 - https://market.android.com/search?q=pname:org.eehouse.android.xw4 - - http://%1$s/redir.php?lang=%2$d + /%1$s/redir.php diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 319df69ee..3c9c3d811 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -565,7 +565,7 @@ you haven\'t already? Let\'s play Crosswords Tap on this link to start a game: - %1$s. (If you don\'t have Crosswords: %2$s.) + %1$s . Send invitation via Unable to download. Do you have diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index e3c6aaf9d..162992655 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -23,6 +23,7 @@ package org.eehouse.android.xw4; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.net.Uri; import android.os.Environment; import java.io.File; import java.io.FileInputStream; @@ -392,18 +393,17 @@ public class GameUtils { int lang ) { Random random = new Random(); - String gameUrl = NetLaunchInfo.makeLaunchURL( context, room, - lang, 2 ); + Uri gameUri = NetLaunchInfo.makeLaunchUri( context, room, + lang, 2 ); - if ( null != gameUrl ) { + if ( null != gameUri ) { Intent intent = new Intent( Intent.ACTION_SEND ); intent.setType( "text/plain" ); intent.putExtra( Intent.EXTRA_SUBJECT, context.getString( R.string.invite_subject ) ); String format = context.getString( R.string.invite_bodyf ); - String appUrl = context.getString( R.string.app_market_url ); - String message = String.format( format, gameUrl, appUrl ); + String message = String.format( format, gameUri.toString() ); intent.putExtra( Intent.EXTRA_TEXT, message ); String chooserMsg = context.getString( R.string.invite_chooser ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java index 7a8e61b63..09b5a01dd 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java @@ -22,6 +22,7 @@ package org.eehouse.android.xw4; import android.content.Context; import android.net.Uri; +import android.net.Uri.Builder; import java.net.URLEncoder; import org.eehouse.android.xw4.jni.CommonPrefs; @@ -34,22 +35,19 @@ public class NetLaunchInfo { private boolean m_valid; - public static String makeLaunchURL( Context context, String room, + public static Uri makeLaunchUri( Context context, String room, int lang, int nPlayers ) { - String format = context.getString( R.string.game_urlf ); - String host = CommonPrefs.getDefaultRelayHost( context ); - StringBuilder query = - new StringBuilder( String.format( format, host, lang, room ) ); - query.append( "&room=" ); - String result = null; - try { - query.append( URLEncoder.encode(room, "UTF-8") ); - result = query.toString(); - } catch ( java.io.UnsupportedEncodingException uee ) { - Utils.logf( "%s", uee.toString() ); - } - return result; + Builder ub = new Builder(); + ub.scheme( "http" ); + String format = context.getString( R.string.game_url_pathf ); + ub.path( String.format( format, + CommonPrefs.getDefaultRelayHost( context ) ) ); + + ub.appendQueryParameter( "lang", String.format("%d", lang ) ); + ub.appendQueryParameter( "np", String.format( "%d", nPlayers ) ); + ub.appendQueryParameter( "room", room ); + return ub.build(); } public NetLaunchInfo( Uri data )