Skip to content

Commit a1ab418

Browse files
committed
Fix some deprecated API in AboutActivity
1 parent 4681aac commit a1ab418

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/src/main/java/org/fedorahosted/freeotp/ui/AboutActivity.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
package org.fedorahosted.freeotp.ui
2222

2323
import android.os.Bundle
24-
import android.text.Html
2524
import android.text.method.LinkMovementMethod
2625
import android.widget.TextView
2726
import androidx.appcompat.app.AppCompatActivity
27+
import androidx.core.content.pm.PackageInfoCompat
28+
import androidx.core.text.HtmlCompat
2829
import org.fedorahosted.freeotp.R
2930

3031
class AboutActivity : AppCompatActivity() {
@@ -42,14 +43,15 @@ class AboutActivity : AppCompatActivity() {
4243

4344
val pm = packageManager
4445
val info = pm.getPackageInfo(packageName, 0)
45-
val version = res.getString(R.string.about_version, info.versionName, info.versionCode)
46+
val version = res.getString(R.string.about_version,
47+
info.versionName, PackageInfoCompat.getLongVersionCode(info))
4648
aboutVersion.text = version
4749

4850
val apache2 = res.getString(R.string.link_apache2)
4951
val license = res.getString(R.string.about_license, apache2)
5052

5153
val aboutLicense:TextView = findViewById(R.id.about_license)
5254
aboutLicense.movementMethod = LinkMovementMethod.getInstance()
53-
aboutLicense.text = Html.fromHtml(license)
55+
aboutLicense.text = HtmlCompat.fromHtml(license, HtmlCompat.FROM_HTML_MODE_COMPACT)
5456
}
5557
}

0 commit comments

Comments
 (0)