move the SMS sending activity extension to Commons

This commit is contained in:
tibbi 2020-12-31 15:24:56 +01:00
parent c759954db0
commit 416054b792
5 changed files with 8 additions and 21 deletions

View File

@ -57,13 +57,13 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.32.5'
implementation 'com.simplemobiletools:commons:5.32.17'
implementation 'joda-time:joda-time:2.10.1'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
kapt "androidx.room:room-compiler:2.2.5"
implementation "androidx.room:room-runtime:2.2.5"
annotationProcessor "androidx.room:room-compiler:2.2.5"
kapt "androidx.room:room-compiler:2.2.6"
implementation "androidx.room:room-runtime:2.2.6"
annotationProcessor "androidx.room:room-compiler:2.2.6"
}

View File

@ -24,7 +24,6 @@ import com.simplemobiletools.commons.helpers.letterBackgroundColors
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.sendEmailIntent
import com.simplemobiletools.contacts.pro.extensions.sendSMSIntent
import com.simplemobiletools.contacts.pro.extensions.shareContacts
import com.simplemobiletools.contacts.pro.helpers.ContactsHelper
import com.simplemobiletools.contacts.pro.models.Contact
@ -92,7 +91,7 @@ abstract class ContactActivity : SimpleActivity() {
fun trySendSMS() {
val numbers = contact!!.phoneNumbers
if (numbers.size == 1) {
sendSMSIntent(numbers.first().value)
launchSendSMSIntent(numbers.first().value)
} else if (numbers.size > 1) {
val items = ArrayList<RadioItem>()
numbers.forEachIndexed { index, phoneNumber ->
@ -100,7 +99,7 @@ abstract class ContactActivity : SimpleActivity() {
}
RadioGroupDialog(this, items) {
sendSMSIntent(it as String)
launchSendSMSIntent(it as String)
}
}
}

View File

@ -66,17 +66,6 @@ fun Context.sendEmailIntent(recipient: String) {
}
}
fun Context.sendSMSIntent(recipient: String) {
Intent(Intent.ACTION_SENDTO).apply {
data = Uri.fromParts("smsto", recipient, null)
if (resolveActivity(packageManager) != null) {
startActivity(this)
} else {
toast(R.string.no_app_found)
}
}
}
fun Context.sendAddressIntent(address: String) {
val location = Uri.encode(address)
val uri = Uri.parse("geo:0,0?q=$location")

View File

@ -6,7 +6,6 @@ import android.graphics.BitmapFactory
import android.net.Uri
import android.provider.ContactsContract.CommonDataKinds.Event
import android.provider.MediaStore
import com.simplemobiletools.commons.extensions.getChoppedList
import com.simplemobiletools.commons.models.SimpleContact
import com.simplemobiletools.contacts.pro.extensions.contactsDB
import com.simplemobiletools.contacts.pro.extensions.getByteArray
@ -56,7 +55,7 @@ class LocalContactsHelper(val context: Context) {
}
fun deleteContactIds(ids: MutableList<Long>) {
ids.getChoppedList().forEach {
ids.chunked(30).forEach {
context.contactsDB.deleteContactIds(it)
}
}

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.20'
ext.kotlin_version = '1.4.21'
repositories {
google()