From e24ce770f1f716bda8f77f2a42b6fb0fab447549 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 26 May 2013 12:52:13 +0200 Subject: [PATCH] Fix localizable formatted strings in About screen, part 1. We can't use formatted strings directly because it breaks with our localization tools. Grab an HTML string and turn it into a formatted string. Localized versions will have to be updated still, but that should happen automatically at TWN. --- commons/res/values/strings.xml | 6 +++--- .../java/org/wikimedia/commons/AboutActivity.java | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/commons/res/values/strings.xml b/commons/res/values/strings.xml index 1d368bd76..c76dc96e6 100644 --- a/commons/res/values/strings.xml +++ b/commons/res/values/strings.xml @@ -75,9 +75,9 @@ Send usage reports to Wikimedia to help us improve the app Settings About - Open Source software released under the Apache License v2 - Source on GitHub. Bugs at Bugzilla. - Privacy policy + Open Source software released under the <a href="https://github.com/wikimedia/android-commons/blob/master/COPYING">Apache License v2</a> + Source on <a href="https://github.com/wikimedia/android-commons">GitHub</a>. Bugs at <a href="https://bugzilla.wikimedia.org/enter_bug.cgi?product=Commons%20App">Bugzilla</a>. + <a href="https://wikimediafoundation.org/wiki/Privacy_policy">Privacy policy</a> About Send Feedback (via Email) Recently used categories diff --git a/commons/src/main/java/org/wikimedia/commons/AboutActivity.java b/commons/src/main/java/org/wikimedia/commons/AboutActivity.java index 0c0ef0039..9951e320a 100644 --- a/commons/src/main/java/org/wikimedia/commons/AboutActivity.java +++ b/commons/src/main/java/org/wikimedia/commons/AboutActivity.java @@ -2,6 +2,7 @@ package org.wikimedia.commons; import android.app.Activity; import android.os.Bundle; +import android.text.Html; import android.text.method.LinkMovementMethod; import android.widget.TextView; @@ -23,8 +24,19 @@ public class AboutActivity extends Activity { versionText.setText(CommonsApplication.APPLICATION_VERSION); + // We can't use formatted strings directly because it breaks with + // our localization tools. Grab an HTML string and turn it into + // a formatted string. + fixFormatting(licenseText, R.string.about_license); + fixFormatting(improveText, R.string.about_improve); + fixFormatting(privacyPolicyText, R.string.about_privacy_policy); + licenseText.setMovementMethod(LinkMovementMethod.getInstance()); improveText.setMovementMethod(LinkMovementMethod.getInstance()); privacyPolicyText.setMovementMethod(LinkMovementMethod.getInstance()); } + + private void fixFormatting(TextView textView, int resource) { + textView.setText(Html.fromHtml(getResources().getString(resource))); + } } \ No newline at end of file