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.
This commit is contained in:
Brion Vibber 2013-05-26 12:52:13 +02:00
parent 0b00a9f54e
commit e24ce770f1
2 changed files with 15 additions and 3 deletions

View file

@ -75,9 +75,9 @@
<string name="preference_tracking_summary">Send usage reports to Wikimedia to help us improve the app</string>
<string name="title_activity_settings">Settings</string>
<string name="menu_about">About</string>
<string name="about_license">Open Source software released under the <a href="https://github.com/wikimedia/android-commons/blob/master/COPYING">Apache License v2</a></string>
<string name="about_improve">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>.</string>
<string name="about_privacy_policy"><a href="https://wikimediafoundation.org/wiki/Privacy_policy">Privacy policy</a></string>
<string name="about_license">Open Source software released under the &lt;a href="https://github.com/wikimedia/android-commons/blob/master/COPYING">Apache License v2&lt;/a></string>
<string name="about_improve">Source on &lt;a href="https://github.com/wikimedia/android-commons">GitHub&lt;/a>. Bugs at &lt;a href="https://bugzilla.wikimedia.org/enter_bug.cgi?product=Commons%20App">Bugzilla&lt;/a>.</string>
<string name="about_privacy_policy">&lt;a href="https://wikimediafoundation.org/wiki/Privacy_policy">Privacy policy&lt;/a></string>
<string name="title_activity_about">About</string>
<string name="menu_feedback">Send Feedback (via Email)</string>
<string name="provider_categories">Recently used categories</string>

View file

@ -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)));
}
}