Use `sendEmailIntent` extension from commons
This commit is contained in:
parent
8f656db1fb
commit
9179125476
|
@ -63,7 +63,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:2122bbc6a3'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:141660c8f9'
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
|
||||
implementation 'com.github.tibbi:android-smsmms:4cdacdb701'
|
||||
|
|
|
@ -4,11 +4,11 @@ import android.content.Intent
|
|||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.extensions.normalizePhoneNumber
|
||||
import com.simplemobiletools.commons.extensions.sendEmailIntent
|
||||
import com.simplemobiletools.commons.helpers.NavigationIcon
|
||||
import com.simplemobiletools.smsmessenger.R
|
||||
import com.simplemobiletools.smsmessenger.adapters.VCardViewerAdapter
|
||||
import com.simplemobiletools.smsmessenger.extensions.dialNumber
|
||||
import com.simplemobiletools.smsmessenger.extensions.sendMail
|
||||
import com.simplemobiletools.smsmessenger.helpers.EXTRA_VCARD_URI
|
||||
import com.simplemobiletools.smsmessenger.helpers.parseVCardFromUri
|
||||
import com.simplemobiletools.smsmessenger.models.VCardPropertyWrapper
|
||||
|
@ -71,7 +71,7 @@ class VCardViewerActivity : SimpleActivity() {
|
|||
private fun handleClick(property: VCardPropertyWrapper) {
|
||||
when (property.property) {
|
||||
is Telephone -> dialNumber(property.value.normalizePhoneNumber())
|
||||
is Email -> sendMail(property.value)
|
||||
is Email -> sendEmailIntent(property.value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,19 +24,3 @@ fun Activity.dialNumber(phoneNumber: String, callback: (() -> Unit)? = null) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Activity.sendMail(email: String) {
|
||||
hideKeyboard()
|
||||
Intent(Intent.ACTION_SENDTO).apply {
|
||||
data = Uri.parse("mailto:")
|
||||
putExtra(Intent.EXTRA_EMAIL, email)
|
||||
|
||||
try {
|
||||
startActivity(this)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
toast(R.string.no_app_found)
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue