adding the call confirmation dialog
This commit is contained in:
parent
4ec77d685e
commit
828c3337cc
24 changed files with 89 additions and 1 deletions
|
@ -45,7 +45,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:4.5.14'
|
||||
implementation 'com.simplemobiletools:commons:4.5.16'
|
||||
implementation 'joda-time:joda-time:2.9.9'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.simplemobiletools.contacts.dialogs
|
||||
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.view.animation.AnimationUtils
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.contacts.R
|
||||
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) {
|
||||
private var view = activity.layoutInflater.inflate(R.layout.dialog_call_confirmation, null)
|
||||
|
||||
init {
|
||||
AlertDialog.Builder(activity)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
val title = String.format(activity.getString(R.string.call_person), contact.getFullName())
|
||||
activity.setupDialogStuff(view, this, titleText = title) {
|
||||
view.call_confirm_phone.apply {
|
||||
startAnimation(AnimationUtils.loadAnimation(activity, R.anim.pulsing_animation))
|
||||
setOnClickListener {
|
||||
callback.invoke()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ import com.simplemobiletools.commons.models.RadioItem
|
|||
import com.simplemobiletools.contacts.BuildConfig
|
||||
import com.simplemobiletools.contacts.R
|
||||
import com.simplemobiletools.contacts.activities.SimpleActivity
|
||||
import com.simplemobiletools.contacts.dialogs.CallConfirmationDialog
|
||||
import com.simplemobiletools.contacts.helpers.ContactsHelper
|
||||
import com.simplemobiletools.contacts.helpers.SMT_PRIVATE
|
||||
import com.simplemobiletools.contacts.helpers.VcfExporter
|
||||
|
@ -36,6 +37,16 @@ fun SimpleActivity.startCallIntent(recipient: String) {
|
|||
}
|
||||
|
||||
fun SimpleActivity.tryStartCall(contact: Contact) {
|
||||
if (config.showCallConfirmation) {
|
||||
CallConfirmationDialog(this, contact) {
|
||||
startCall(contact)
|
||||
}
|
||||
} else {
|
||||
startCall(contact)
|
||||
}
|
||||
}
|
||||
|
||||
fun SimpleActivity.startCall(contact: Contact) {
|
||||
val numbers = contact.phoneNumbers
|
||||
if (numbers.size == 1) {
|
||||
startCallIntent(numbers.first().value)
|
||||
|
|
14
app/src/main/res/anim/pulsing_animation.xml
Normal file
14
app/src/main/res/anim/pulsing_animation.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<scale
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="1000"
|
||||
android:fillAfter="false"
|
||||
android:fromXScale="1.0"
|
||||
android:fromYScale="1.0"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:repeatCount="infinite"
|
||||
android:repeatMode="reverse"
|
||||
android:toXScale="1.2"
|
||||
android:toYScale="1.2"/>
|
BIN
app/src/main/res/drawable-hdpi/ic_phone_big.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_phone_big.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 566 B |
BIN
app/src/main/res/drawable-xhdpi/ic_phone_big.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_phone_big.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 716 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_phone_big.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_phone_big.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 993 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_phone_big.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_phone_big.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
18
app/src/main/res/layout/dialog_call_confirmation.xml
Normal file
18
app/src/main/res/layout/dialog_call_confirmation.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/dialog_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="@dimen/activity_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/call_confirm_phone"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_phone_big"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Kontaktlara e-poçt göndər</string>
|
||||
<string name="send_sms_to_group">Grupa SMS göndər</string>
|
||||
<string name="send_email_to_group">Grupa e-poçt göndər</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Yeni kontakt</string>
|
||||
<string name="edit_contact">Redaktə et</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Sende E-Mail an Kontakte</string>
|
||||
<string name="send_sms_to_group">Sende SMS an Gruppe</string>
|
||||
<string name="send_email_to_group">Sende E-Mail an Gruppe</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Neuer Kontakt</string>
|
||||
<string name="edit_contact">Kontakt bearbeiten</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Send email to contacts</string>
|
||||
<string name="send_sms_to_group">Send SMS to group</string>
|
||||
<string name="send_email_to_group">Send email to group</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Νέα επαφή</string>
|
||||
<string name="edit_contact">Επεξεργασία επαφής</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Envoyer un e-mail aux contacts</string>
|
||||
<string name="send_sms_to_group">Envoyer un SMS au groupe</string>
|
||||
<string name="send_email_to_group">Envoyer un e-mail au groupe</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Nouveau contact</string>
|
||||
<string name="edit_contact">Modifier contact</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Send email to contacts</string>
|
||||
<string name="send_sms_to_group">Send SMS to group</string>
|
||||
<string name="send_email_to_group">Send email to group</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Novi kontakt</string>
|
||||
<string name="edit_contact">Uredi kontakt</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">連絡先にメールを送信</string>
|
||||
<string name="send_sms_to_group">グループにSMSを送信</string>
|
||||
<string name="send_email_to_group">グループにメールを送信</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">新しい連絡先</string>
|
||||
<string name="edit_contact">連絡先を編集</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Send email to contacts</string>
|
||||
<string name="send_sms_to_group">Send SMS to group</string>
|
||||
<string name="send_email_to_group">Send email to group</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">새로운 연락처</string>
|
||||
<string name="edit_contact">연락처 수정</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Send email to contacts</string>
|
||||
<string name="send_sms_to_group">Send SMS to group</string>
|
||||
<string name="send_email_to_group">Send email to group</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Naujas kontaktas</string>
|
||||
<string name="edit_contact">Redaguoti kontaktą</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Enviar e-mail aos contactos</string>
|
||||
<string name="send_sms_to_group">Enviar SMS para o grupo</string>
|
||||
<string name="send_email_to_group">Enviar e-mail para o grupo</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Novo contacto</string>
|
||||
<string name="edit_contact">Editar contacto</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Отправить письмо контактам</string>
|
||||
<string name="send_sms_to_group">Отправить SMS группе</string>
|
||||
<string name="send_email_to_group">Отправить письмо группе</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Новый контакт</string>
|
||||
<string name="edit_contact">Редактировать контакт</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Poslať kontaktom email</string>
|
||||
<string name="send_sms_to_group">Poslať skupine SMS</string>
|
||||
<string name="send_email_to_group">Poslať skupine email</string>
|
||||
<string name="call_person">Zavolať %s</string>
|
||||
|
||||
<string name="new_contact">Nový kontakt</string>
|
||||
<string name="edit_contact">Upraviť kontakt</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Skicka e-post till kontakter</string>
|
||||
<string name="send_sms_to_group">Skicka sms till grupp</string>
|
||||
<string name="send_email_to_group">Skicka e-post till grupp</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Ny kontakt</string>
|
||||
<string name="edit_contact">Redigera kontakt</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Kişilere e-posta gönder</string>
|
||||
<string name="send_sms_to_group">Gruba SMS gönder</string>
|
||||
<string name="send_email_to_group">Gruba e-posta gönder</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">Yeni kişi</string>
|
||||
<string name="edit_contact">Kişiyi düzenle</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">發送電子郵件給聯絡人</string>
|
||||
<string name="send_sms_to_group">發送簡訊給群組</string>
|
||||
<string name="send_email_to_group">發送電子郵件給群組</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">新聯絡人</string>
|
||||
<string name="edit_contact">編輯聯絡人</string>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<string name="send_email_to_contacts">Send email to contacts</string>
|
||||
<string name="send_sms_to_group">Send SMS to group</string>
|
||||
<string name="send_email_to_group">Send email to group</string>
|
||||
<string name="call_person">Call %s</string>
|
||||
|
||||
<string name="new_contact">New contact</string>
|
||||
<string name="edit_contact">Edit contact</string>
|
||||
|
|
Loading…
Reference in a new issue