Add vCard attachment preview

This commit is contained in:
Naveen 2022-08-29 03:19:50 +05:30
parent d874e16024
commit f07abeb54c
58 changed files with 1263 additions and 117 deletions

View file

@ -24,3 +24,19 @@ 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)
}
}
}

View file

@ -0,0 +1,8 @@
package com.simplemobiletools.smsmessenger.extensions
import android.text.format.DateFormat
import java.util.*
fun Date.format(pattern: String): String {
return DateFormat.format(pattern, this).toString()
}

View file

@ -14,3 +14,8 @@ fun String.getExtensionFromMimeType(): String {
fun String.isImageMimeType(): Boolean {
return lowercase().startsWith("image")
}
fun String.isVCardMimeType(): Boolean {
val lowercase = lowercase()
return lowercase.endsWith("x-vcard") || lowercase.endsWith("vcard")
}