mirror of
				https://github.com/SimpleMobileTools/Simple-Contacts.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	move the SMS sending activity extension to Commons
This commit is contained in:
		| @@ -57,13 +57,13 @@ android { | |||||||
| } | } | ||||||
|  |  | ||||||
| dependencies { | dependencies { | ||||||
|     implementation 'com.simplemobiletools:commons:5.32.5' |     implementation 'com.simplemobiletools:commons:5.32.17' | ||||||
|     implementation 'joda-time:joda-time:2.10.1' |     implementation 'joda-time:joda-time:2.10.1' | ||||||
|     implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5' |     implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5' | ||||||
|     implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a' |     implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a' | ||||||
|     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' |     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' | ||||||
|  |  | ||||||
|     kapt "androidx.room:room-compiler:2.2.5" |     kapt "androidx.room:room-compiler:2.2.6" | ||||||
|     implementation "androidx.room:room-runtime:2.2.5" |     implementation "androidx.room:room-runtime:2.2.6" | ||||||
|     annotationProcessor "androidx.room:room-compiler:2.2.5" |     annotationProcessor "androidx.room:room-compiler:2.2.6" | ||||||
| } | } | ||||||
|   | |||||||
| @@ -24,7 +24,6 @@ import com.simplemobiletools.commons.helpers.letterBackgroundColors | |||||||
| import com.simplemobiletools.commons.models.RadioItem | import com.simplemobiletools.commons.models.RadioItem | ||||||
| import com.simplemobiletools.contacts.pro.R | import com.simplemobiletools.contacts.pro.R | ||||||
| import com.simplemobiletools.contacts.pro.extensions.sendEmailIntent | 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.extensions.shareContacts | ||||||
| import com.simplemobiletools.contacts.pro.helpers.ContactsHelper | import com.simplemobiletools.contacts.pro.helpers.ContactsHelper | ||||||
| import com.simplemobiletools.contacts.pro.models.Contact | import com.simplemobiletools.contacts.pro.models.Contact | ||||||
| @@ -92,7 +91,7 @@ abstract class ContactActivity : SimpleActivity() { | |||||||
|     fun trySendSMS() { |     fun trySendSMS() { | ||||||
|         val numbers = contact!!.phoneNumbers |         val numbers = contact!!.phoneNumbers | ||||||
|         if (numbers.size == 1) { |         if (numbers.size == 1) { | ||||||
|             sendSMSIntent(numbers.first().value) |             launchSendSMSIntent(numbers.first().value) | ||||||
|         } else if (numbers.size > 1) { |         } else if (numbers.size > 1) { | ||||||
|             val items = ArrayList<RadioItem>() |             val items = ArrayList<RadioItem>() | ||||||
|             numbers.forEachIndexed { index, phoneNumber -> |             numbers.forEachIndexed { index, phoneNumber -> | ||||||
| @@ -100,7 +99,7 @@ abstract class ContactActivity : SimpleActivity() { | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             RadioGroupDialog(this, items) { |             RadioGroupDialog(this, items) { | ||||||
|                 sendSMSIntent(it as String) |                 launchSendSMSIntent(it as String) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -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) { | fun Context.sendAddressIntent(address: String) { | ||||||
|     val location = Uri.encode(address) |     val location = Uri.encode(address) | ||||||
|     val uri = Uri.parse("geo:0,0?q=$location") |     val uri = Uri.parse("geo:0,0?q=$location") | ||||||
|   | |||||||
| @@ -6,7 +6,6 @@ import android.graphics.BitmapFactory | |||||||
| import android.net.Uri | import android.net.Uri | ||||||
| import android.provider.ContactsContract.CommonDataKinds.Event | import android.provider.ContactsContract.CommonDataKinds.Event | ||||||
| import android.provider.MediaStore | import android.provider.MediaStore | ||||||
| import com.simplemobiletools.commons.extensions.getChoppedList |  | ||||||
| import com.simplemobiletools.commons.models.SimpleContact | import com.simplemobiletools.commons.models.SimpleContact | ||||||
| import com.simplemobiletools.contacts.pro.extensions.contactsDB | import com.simplemobiletools.contacts.pro.extensions.contactsDB | ||||||
| import com.simplemobiletools.contacts.pro.extensions.getByteArray | import com.simplemobiletools.contacts.pro.extensions.getByteArray | ||||||
| @@ -56,7 +55,7 @@ class LocalContactsHelper(val context: Context) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun deleteContactIds(ids: MutableList<Long>) { |     fun deleteContactIds(ids: MutableList<Long>) { | ||||||
|         ids.getChoppedList().forEach { |         ids.chunked(30).forEach { | ||||||
|             context.contactsDB.deleteContactIds(it) |             context.contactsDB.deleteContactIds(it) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | // Top-level build file where you can add configuration options common to all sub-projects/modules. | ||||||
|  |  | ||||||
| buildscript { | buildscript { | ||||||
|     ext.kotlin_version = '1.4.20' |     ext.kotlin_version = '1.4.21' | ||||||
|  |  | ||||||
|     repositories { |     repositories { | ||||||
|         google() |         google() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user