pull/32/head
GKF 6 years ago
parent a2c6c1ccf5
commit 54a5410af3
  1. 3
      app/src/main/java/io/legado/app/ui/about/AboutActivity.kt
  2. 14
      app/src/main/java/io/legado/app/ui/about/AboutFragment.kt

@ -40,7 +40,7 @@ class AboutActivity : BaseActivity<AndroidViewModel>() {
return super.onCompatOptionsItemSelected(item) return super.onCompatOptionsItemSelected(item)
} }
internal fun openIntent(intentName: String, address: String) { private fun openIntent(intentName: String, address: String) {
try { try {
val intent = Intent(intentName) val intent = Intent(intentName)
intent.data = Uri.parse(address) intent.data = Uri.parse(address)
@ -48,6 +48,5 @@ class AboutActivity : BaseActivity<AndroidViewModel>() {
} catch (e: Exception) { } catch (e: Exception) {
toast(R.string.can_not_open) toast(R.string.can_not_open)
} }
} }
} }

@ -1,10 +1,13 @@
package io.legado.app.ui.about package io.legado.app.ui.about
import android.content.Intent
import android.net.Uri
import android.os.Bundle import android.os.Bundle
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.utils.toast
class AboutFragment : PreferenceFragmentCompat() { class AboutFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
@ -18,4 +21,15 @@ class AboutFragment : PreferenceFragmentCompat() {
} }
return super.onPreferenceTreeClick(preference) return super.onPreferenceTreeClick(preference)
} }
private fun openIntent(intentName: String, address: String) {
try {
val intent = Intent(intentName)
intent.data = Uri.parse(address)
startActivity(intent)
} catch (e: Exception) {
toast(R.string.can_not_open)
}
}
} }
Loading…
Cancel
Save