Parameterise PP country

This commit is contained in:
burke.davey
2010-08-06 01:34:26 +00:00
parent e6f84dba5d
commit 9bf6643fc5
3 changed files with 23 additions and 6 deletions

View File

@@ -39,7 +39,7 @@
2. Connect your Chrome and your phone.<br>3. Set your link action preference.<br><br> 2. Connect your Chrome and your phone.<br>3. Set your link action preference.<br><br>
By using this application, you agree to the <br> By using this application, you agree to the <br>
<a href="{tos_link}">Terms of Service</a> and <a href="{tos_link}">Terms of Service</a> and
<a href="http://m.google.com/privacy">Privacy Policy</a> <a href="{pp_link}">Privacy Policy</a>.
</string> </string>
<string name="help_text"> <string name="help_text">
Chrome to Phone lets you easily share links, maps, and currently selected phone numbers and text Chrome to Phone lets you easily share links, maps, and currently selected phone numbers and text
@@ -52,6 +52,6 @@
in the status bar which you can action manually. &lt;br>&lt;br> in the status bar which you can action manually. &lt;br>&lt;br>
By using this application, you agree to the &lt;br> By using this application, you agree to the &lt;br>
&lt;a href="{tos_link}">Terms of Service&lt;/a> and &lt;a href="{tos_link}">Terms of Service&lt;/a> and
&lt;a href="http://m.google.com/privacy">Privacy Policy&lt;/a> &lt;a href="{pp_link}">Privacy Policy&lt;/a>.
</string> </string>
</resources> </resources>

View File

@@ -15,12 +15,14 @@ public class HelpActivity extends Activity {
setContentView(R.layout.help); setContentView(R.layout.help);
TextView textView = (TextView) findViewById(R.id.help_text); TextView textView = (TextView) findViewById(R.id.help_text);
String helpText = getString(R.string.help_text).replace("{tos_link}", getTosLink()); String helpText = getString(R.string.help_text)
.replace("{tos_link}", getTOSLink())
.replace("{pp_link}", getPPLink());
textView.setText(Html.fromHtml(helpText)); textView.setText(Html.fromHtml(helpText));
textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setMovementMethod(LinkMovementMethod.getInstance());
} }
public static String getTosLink() { public static String getTOSLink() {
String link = "http://m.google.com/toscountry"; // default String link = "http://m.google.com/toscountry"; // default
String country = Locale.getDefault().getCountry(); String country = Locale.getDefault().getCountry();
@@ -33,4 +35,18 @@ public class HelpActivity extends Activity {
} }
return link; return link;
} }
public static String getPPLink() {
String link = "http://m.google.com/privacy"; // default
String country = Locale.getDefault().getCountry();
if (country.equals("US")) {
link = "http://m.google.com/privacy";
} else if (country.equals("GB")) {
link = "http://m.google.co.uk/privacy";
} else if (country.equals("CA")) {
link = "http://m.google.ca/privacy";
}
return link;
}
} }

View File

@@ -142,8 +142,9 @@ public class MainActivity extends Activity {
} }
private void setIntroScreenContent() { private void setIntroScreenContent() {
String introText = String introText = getString(R.string.intro_text)
getString(R.string.intro_text).replace("{tos_link}", HelpActivity.getTosLink()); .replace("{tos_link}", HelpActivity.getTOSLink())
.replace("{pp_link}", HelpActivity.getPPLink());
TextView textView = (TextView) findViewById(R.id.intro_text); TextView textView = (TextView) findViewById(R.id.intro_text);
textView.setText(Html.fromHtml(introText)); textView.setText(Html.fromHtml(introText));
textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setMovementMethod(LinkMovementMethod.getInstance());