- Used HtmlCompat to convert About HTML to text (should work on all

Android API levels).
This commit is contained in:
Juha Heinanen
2019-06-01 19:38:25 +03:00
parent 6d0d8a3be7
commit fd5ed456f9

View File

@ -2,10 +2,9 @@ package com.tutpro.baresip
import android.app.Activity import android.app.Activity
import android.content.Intent import android.content.Intent
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.support.v4.text.HtmlCompat
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.text.Html
import android.text.method.LinkMovementMethod import android.text.method.LinkMovementMethod
import android.view.MenuItem import android.view.MenuItem
import android.widget.TextView import android.widget.TextView
@ -17,10 +16,7 @@ class AboutActivity : AppCompatActivity() {
setContentView(R.layout.activity_about) setContentView(R.layout.activity_about)
val aboutText = findViewById<TextView>(R.id.aboutText) val aboutText = findViewById<TextView>(R.id.aboutText)
val text = String.format(getString(R.string.about_text), BuildConfig.VERSION_NAME) val text = String.format(getString(R.string.about_text), BuildConfig.VERSION_NAME)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) aboutText.text = HtmlCompat.fromHtml(text, HtmlCompat.FROM_HTML_MODE_LEGACY)
aboutText.text = Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY)
else
aboutText.text = Html.fromHtml(text)
aboutText.setMovementMethod(LinkMovementMethod.getInstance()) aboutText.setMovementMethod(LinkMovementMethod.getInstance())
} }