fix #241, make sure we show the call confirmation on number click
This commit is contained in:
parent
63d3702af3
commit
353462e684
|
@ -11,6 +11,7 @@ import android.widget.RelativeLayout
|
|||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
|
||||
import com.simplemobiletools.contacts.R
|
||||
import com.simplemobiletools.contacts.dialogs.CallConfirmationDialog
|
||||
import com.simplemobiletools.contacts.extensions.*
|
||||
import com.simplemobiletools.contacts.helpers.*
|
||||
import kotlinx.android.synthetic.main.activity_view_contact.*
|
||||
|
@ -225,8 +226,14 @@ class ViewContactActivity : ContactActivity() {
|
|||
contact_number_type.setText(getPhoneNumberTextId(phoneNumber.type))
|
||||
|
||||
setOnClickListener {
|
||||
if (config.showCallConfirmation) {
|
||||
CallConfirmationDialog(this@ViewContactActivity, phoneNumber.value) {
|
||||
startCallIntent(phoneNumber.value)
|
||||
}
|
||||
} else {
|
||||
startCallIntent(phoneNumber.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
contact_numbers_image.beVisible()
|
||||
|
|
|
@ -7,10 +7,9 @@ import com.simplemobiletools.commons.extensions.applyColorFilter
|
|||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.contacts.R
|
||||
import com.simplemobiletools.contacts.extensions.config
|
||||
import com.simplemobiletools.contacts.models.Contact
|
||||
import kotlinx.android.synthetic.main.dialog_call_confirmation.view.*
|
||||
|
||||
class CallConfirmationDialog(val activity: BaseSimpleActivity, val contact: Contact, private val callback: () -> Unit) {
|
||||
class CallConfirmationDialog(val activity: BaseSimpleActivity, val callee: String, private val callback: () -> Unit) {
|
||||
private var view = activity.layoutInflater.inflate(R.layout.dialog_call_confirmation, null)
|
||||
|
||||
init {
|
||||
|
@ -18,7 +17,7 @@ class CallConfirmationDialog(val activity: BaseSimpleActivity, val contact: Cont
|
|||
AlertDialog.Builder(activity)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
val title = String.format(activity.getString(R.string.call_person), contact.getFullName())
|
||||
val title = String.format(activity.getString(R.string.call_person), callee)
|
||||
activity.setupDialogStuff(view, this, titleText = title) {
|
||||
view.call_confirm_phone.apply {
|
||||
startAnimation(AnimationUtils.loadAnimation(activity, R.anim.pulsing_animation))
|
||||
|
|
|
@ -36,7 +36,7 @@ fun SimpleActivity.startCallIntent(recipient: String) {
|
|||
|
||||
fun SimpleActivity.tryStartCall(contact: Contact) {
|
||||
if (config.showCallConfirmation) {
|
||||
CallConfirmationDialog(this, contact) {
|
||||
CallConfirmationDialog(this, contact.getFullName()) {
|
||||
startCall(contact)
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue