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

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