pull/433/head
gedoor 4 years ago
parent 570df89135
commit b55d511ce0
  1. 14
      app/src/main/java/io/legado/app/ui/about/AboutFragment.kt
  2. 10
      app/src/main/java/io/legado/app/utils/ContextExtensions.kt

@ -13,8 +13,8 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.utils.applyTint import io.legado.app.utils.applyTint
import io.legado.app.utils.openUrl import io.legado.app.utils.openUrl
import io.legado.app.utils.sendMail
import io.legado.app.utils.sendToClip import io.legado.app.utils.sendToClip
import io.legado.app.utils.toast
class AboutFragment : PreferenceFragmentCompat() { class AboutFragment : PreferenceFragmentCompat() {
@ -48,7 +48,7 @@ class AboutFragment : PreferenceFragmentCompat() {
"contributors" -> openUrl(R.string.contributors_url) "contributors" -> openUrl(R.string.contributors_url)
"update_log" -> showUpdateLog() "update_log" -> showUpdateLog()
"check_update" -> openUrl(R.string.latest_release_url) "check_update" -> openUrl(R.string.latest_release_url)
"mail" -> sendMail() "mail" -> requireContext().sendMail("kunfei.ge@gmail.com")
"sourceRuleSummary" -> openUrl(R.string.source_rule_url) "sourceRuleSummary" -> openUrl(R.string.source_rule_url)
"git" -> openUrl(R.string.this_github_url) "git" -> openUrl(R.string.this_github_url)
"home_page" -> openUrl(R.string.home_page_url) "home_page" -> openUrl(R.string.home_page_url)
@ -66,16 +66,6 @@ class AboutFragment : PreferenceFragmentCompat() {
requireContext().openUrl(getString(addressID)) requireContext().openUrl(getString(addressID))
} }
private fun sendMail() {
try {
val intent = Intent(Intent.ACTION_SENDTO)
intent.data = Uri.parse("mailto:kunfei.ge@gmail.com")
startActivity(intent)
} catch (e: Exception) {
toast(e.localizedMessage ?: "Error")
}
}
private fun showUpdateLog() { private fun showUpdateLog() {
val log = String(requireContext().assets.open("updateLog.md").readBytes()) val log = String(requireContext().assets.open("updateLog.md").readBytes())
TextDialog.show(childFragmentManager, log, TextDialog.MD) TextDialog.show(childFragmentManager, log, TextDialog.MD)

@ -156,6 +156,16 @@ fun Context.getClipText(): String? {
return null return null
} }
fun Context.sendMail(mail: String) {
try {
val intent = Intent(Intent.ACTION_SENDTO)
intent.data = Uri.parse("mailto:$mail")
startActivity(intent)
} catch (e: Exception) {
toast(e.localizedMessage ?: "Error")
}
}
/** /**
* 系统是否暗色主题 * 系统是否暗色主题
*/ */

Loading…
Cancel
Save