move prefix into resources two since it's repeated.

This commit is contained in:
Eric House 2012-11-28 06:30:35 -08:00
parent baa790a8c3
commit 6f620ebc44
3 changed files with 13 additions and 12 deletions

View file

@ -129,7 +129,9 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="@string/invite_host" android:pathPrefix="/and/" />
android:host="@string/invite_host"
android:pathPrefix="@string/invite_prefix"
/>
</intent-filter>
</activity>

View file

@ -102,10 +102,9 @@
<!-- other -->
<string name="default_host">eehouse.org</string>
<!-- <string name="default_host">10.0.2.2</string> -->
<string name="invite_host">eehouse.org</string>
<string name="invite_prefix">/and/</string>
<string name="dict_url">http://eehouse.org/and_wordlists</string>
<string name="game_url_pathf">//%1$s/and</string>
<string name="expl_update_url">Update checks URL</string>
<string name="default_update_url">http://eehouse.org/xw4/info.py</string>

View file

@ -22,7 +22,6 @@ package org.eehouse.android.xw4;
import android.content.Context;
import android.content.Intent;
import android.net.Uri.Builder;
import android.net.Uri;
import android.os.Bundle;
import java.net.URLEncoder;
@ -99,14 +98,15 @@ public class NetLaunchInfo {
String inviteID, int lang,
String dict, int nPlayersT )
{
String host = context.getString( R.string.invite_host );
Builder ub = new Builder();
ub.scheme( "http" );
ub.path( context.getString( R.string.game_url_pathf, host ) );
ub.appendQueryParameter( "lang", String.format("%d", lang ) );
ub.appendQueryParameter( "np", String.format( "%d", nPlayersT ) );
ub.appendQueryParameter( "room", room );
ub.appendQueryParameter( "id", inviteID );
Uri.Builder ub = new Uri.Builder()
.scheme( "http" )
.path( String.format( "//%s%s",
context.getString(R.string.invite_host),
context.getString(R.string.invite_prefix) ) )
.appendQueryParameter( "lang", String.format("%d", lang ) )
.appendQueryParameter( "np", String.format( "%d", nPlayersT ) )
.appendQueryParameter( "room", room )
.appendQueryParameter( "id", inviteID );
if ( null != dict ) {
ub.appendQueryParameter( "wl", dict );
}