updating commons

This commit is contained in:
tibbi 2022-02-05 11:37:16 +01:00
parent 154abdeb8e
commit 4b18b684f5
4 changed files with 41 additions and 24 deletions

View File

@ -47,7 +47,7 @@ android {
flavorDimensions "variants"
productFlavors {
basic {}
core {}
fdroid {}
}
@ -62,7 +62,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:14033f9b50'
implementation 'com.github.SimpleMobileTools:Simple-Commons:4d36cc84e9'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.11.3'
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

View File

@ -187,7 +187,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
R.id.dialpad -> launchDialpad()
R.id.import_contacts -> tryImportContacts()
R.id.export_contacts -> tryExportContacts()
R.id.settings -> startActivity(Intent(applicationContext, SettingsActivity::class.java))
R.id.settings -> launchSettings()
R.id.about -> launchAbout()
else -> return super.onOptionsItemSelected(item)
}
@ -420,6 +420,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
}
private fun launchDialpad() {
hideKeyboard()
Intent(Intent.ACTION_DIAL).apply {
try {
startActivity(this)
@ -518,16 +519,23 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
toast(R.string.no_entries_for_exporting)
} else {
VcfExporter().exportContacts(this, outputStream, contacts, true) { result ->
toast(when (result) {
VcfExporter.ExportResult.EXPORT_OK -> R.string.exporting_successful
VcfExporter.ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_entries_failed
else -> R.string.exporting_failed
})
toast(
when (result) {
VcfExporter.ExportResult.EXPORT_OK -> R.string.exporting_successful
VcfExporter.ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_entries_failed
else -> R.string.exporting_failed
}
)
}
}
}
}
private fun launchSettings() {
hideKeyboard()
startActivity(Intent(applicationContext, SettingsActivity::class.java))
}
private fun launchAbout() {
val licenses = LICENSE_JODA or LICENSE_GLIDE or LICENSE_GSON or LICENSE_INDICATOR_FAST_SCROLL

View File

@ -1,5 +1,6 @@
package com.simplemobiletools.contacts.pro.extensions
import android.app.Activity
import android.content.Intent
import android.net.Uri
import android.provider.ContactsContract.CommonDataKinds.BaseTypes
@ -8,11 +9,15 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.CallConfirmationDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.CONTACT_ID
import com.simplemobiletools.commons.helpers.IS_PRIVATE
import com.simplemobiletools.commons.helpers.PERMISSION_CALL_PHONE
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.contacts.pro.BuildConfig
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.activities.EditContactActivity
import com.simplemobiletools.contacts.pro.activities.SimpleActivity
import com.simplemobiletools.contacts.pro.activities.ViewContactActivity
import com.simplemobiletools.contacts.pro.helpers.*
import com.simplemobiletools.contacts.pro.models.Contact
@ -107,6 +112,7 @@ fun SimpleActivity.handleGenericContactClick(contact: Contact) {
}
fun SimpleActivity.callContact(contact: Contact) {
hideKeyboard()
if (contact.phoneNumbers.isNotEmpty()) {
tryStartCall(contact)
} else {
@ -114,6 +120,24 @@ fun SimpleActivity.callContact(contact: Contact) {
}
}
fun Activity.viewContact(contact: Contact) {
hideKeyboard()
Intent(applicationContext, ViewContactActivity::class.java).apply {
putExtra(CONTACT_ID, contact.id)
putExtra(IS_PRIVATE, contact.isPrivate())
startActivity(this)
}
}
fun Activity.editContact(contact: Contact) {
hideKeyboard()
Intent(applicationContext, EditContactActivity::class.java).apply {
putExtra(CONTACT_ID, contact.id)
putExtra(IS_PRIVATE, contact.isPrivate())
startActivity(this)
}
}
fun SimpleActivity.getPhoneNumberTypeText(type: Int, label: String): String {
return if (type == BaseTypes.TYPE_CUSTOM) {
label

View File

@ -1,6 +1,7 @@
package com.simplemobiletools.contacts.pro.extensions
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.database.Cursor
@ -43,22 +44,6 @@ fun Context.getEmptyContact(): Contact {
)
}
fun Context.viewContact(contact: Contact) {
Intent(applicationContext, ViewContactActivity::class.java).apply {
putExtra(CONTACT_ID, contact.id)
putExtra(IS_PRIVATE, contact.isPrivate())
startActivity(this)
}
}
fun Context.editContact(contact: Contact) {
Intent(applicationContext, EditContactActivity::class.java).apply {
putExtra(CONTACT_ID, contact.id)
putExtra(IS_PRIVATE, contact.isPrivate())
startActivity(this)
}
}
fun Context.sendEmailIntent(recipient: String) {
Intent(Intent.ACTION_SENDTO).apply {
data = Uri.fromParts(KEY_MAILTO, recipient, null)