Skip to content

Commit

Permalink
Fix some deprecated API in AboutActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
helloworld1 committed May 30, 2019
1 parent 4681aac commit a1ab418
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
package org.fedorahosted.freeotp.ui

import android.os.Bundle
import android.text.Html
import android.text.method.LinkMovementMethod
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.pm.PackageInfoCompat
import androidx.core.text.HtmlCompat
import org.fedorahosted.freeotp.R

class AboutActivity : AppCompatActivity() {
Expand All @@ -42,14 +43,15 @@ class AboutActivity : AppCompatActivity() {

val pm = packageManager
val info = pm.getPackageInfo(packageName, 0)
val version = res.getString(R.string.about_version, info.versionName, info.versionCode)
val version = res.getString(R.string.about_version,
info.versionName, PackageInfoCompat.getLongVersionCode(info))
aboutVersion.text = version

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

val aboutLicense:TextView = findViewById(R.id.about_license)
aboutLicense.movementMethod = LinkMovementMethod.getInstance()
aboutLicense.text = Html.fromHtml(license)
aboutLicense.text = HtmlCompat.fromHtml(license, HtmlCompat.FROM_HTML_MODE_COMPACT)
}
}

0 comments on commit a1ab418

Please sign in to comment.