mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
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:
parent
0b00a9f54e
commit
e24ce770f1
2 changed files with 15 additions and 3 deletions
|
|
@ -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)));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue