mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Define a custom TextView that displays HTML
This commit is contained in:
parent
0fbd3a9cf6
commit
ce1e293d87
3 changed files with 25 additions and 29 deletions
|
|
@ -1,10 +1,6 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.widget.TextView;
|
||||
|
||||
import fr.free.nrw.commons.theme.BaseActivity;
|
||||
|
|
@ -14,11 +10,7 @@ import butterknife.ButterKnife;
|
|||
|
||||
public class AboutActivity extends BaseActivity {
|
||||
@BindView(R.id.about_version) TextView versionText;
|
||||
@BindView(R.id.about_license) TextView licenseText;
|
||||
@BindView(R.id.about_improve) TextView improveText;
|
||||
@BindView(R.id.about_privacy_policy) TextView privacyPolicyText;
|
||||
@BindView(R.id.about_uploads_to) TextView uploadsToText;
|
||||
@BindView(R.id.about_credits) TextView creditsText;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
|
@ -29,22 +21,5 @@ public class AboutActivity extends BaseActivity {
|
|||
|
||||
uploadsToText.setText(CommonsApplication.EVENTLOG_WIKI);
|
||||
versionText.setText(BuildConfig.VERSION_NAME);
|
||||
|
||||
// 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);
|
||||
fixFormatting(creditsText, R.string.about_credits);
|
||||
|
||||
licenseText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
improveText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
privacyPolicyText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
creditsText.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