From 828c3337cc5cee15a6c32b959d97fe2aa566eef3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 3 Aug 2018 11:58:53 +0200 Subject: [PATCH] adding the call confirmation dialog --- app/build.gradle | 2 +- .../dialogs/CallConfirmationDialog.kt | 30 ++++++++++++++++++ .../contacts/extensions/Activity.kt | 11 +++++++ app/src/main/res/anim/pulsing_animation.xml | 14 ++++++++ .../main/res/drawable-hdpi/ic_phone_big.png | Bin 0 -> 566 bytes .../main/res/drawable-xhdpi/ic_phone_big.png | Bin 0 -> 716 bytes .../main/res/drawable-xxhdpi/ic_phone_big.png | Bin 0 -> 993 bytes .../res/drawable-xxxhdpi/ic_phone_big.png | Bin 0 -> 1367 bytes .../res/layout/dialog_call_confirmation.xml | 18 +++++++++++ app/src/main/res/values-az/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-el/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-ko-rKR/strings.xml | 1 + app/src/main/res/values-lt/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 24 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/contacts/dialogs/CallConfirmationDialog.kt create mode 100644 app/src/main/res/anim/pulsing_animation.xml create mode 100644 app/src/main/res/drawable-hdpi/ic_phone_big.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_phone_big.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_phone_big.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_phone_big.png create mode 100644 app/src/main/res/layout/dialog_call_confirmation.xml diff --git a/app/build.gradle b/app/build.gradle index 071698b2..c58036a0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/dialogs/CallConfirmationDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/dialogs/CallConfirmationDialog.kt new file mode 100644 index 00000000..bad59311 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/dialogs/CallConfirmationDialog.kt @@ -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() + } + } + } + } + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/extensions/Activity.kt index ee5be77c..60ead47a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/extensions/Activity.kt @@ -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) diff --git a/app/src/main/res/anim/pulsing_animation.xml b/app/src/main/res/anim/pulsing_animation.xml new file mode 100644 index 00000000..119d4b04 --- /dev/null +++ b/app/src/main/res/anim/pulsing_animation.xml @@ -0,0 +1,14 @@ + + diff --git a/app/src/main/res/drawable-hdpi/ic_phone_big.png b/app/src/main/res/drawable-hdpi/ic_phone_big.png new file mode 100644 index 0000000000000000000000000000000000000000..61d59bd472a6143e571679dffb46189ac517bfd0 GIT binary patch literal 566 zcmV-60?GY}P)Gx6~8e8ySEe*e-WJ{*gYnb z_=~i>!tM%5#b4CnGj>-Y6bOzFlMBzvpgxhqYhs;@v$sKZpXUo{_AQ{DhsGd2N{o&dj`GnJJ+FA2S zqOgoV^IpP(YP`X12kC$2EZ~nxxKM_V;dtOFYl>JkRsI zApF8Ct`L(e%;Fc(iElWIjdOe}8Ziu8BSa(4VC$@C#6#@8FZyr=dtZt^9LL^Iq7S>U z_n+v)8ti2heVC8E3Zf5_u-97jp+ELUi9Xc9-d@p%oY)KTsc6F=L?W~3!vpNK6Mfi@ zy$zxdlhFd?fl%9Xpr!Uo_%x%lUCdD-Q5H z*N7{6(T14aAdzUs??lBoKe=efa-wtFn6DGn2zHk=;sQSBKH(maQCz|3fce?Q9VEmw zUEIPfOo_xLq{OsP+`>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A+k@;aBZ7fY4?T>c|er{@V6&Y!%-%^c6p zY{ptF&%#t$@!%<9{$SZzk*7o#s8Y%M#0+IO%L~f|@|4;FRciT>m}ah{GLJkx2q?J) zsw~9s#C^w-h2?RuK$Ql*A#NxK6qd)q0##~wn_RrcB8B8}ut1dx9wZlo*?W%V0j!vC zF}Zn;MdnN%D82`fiR5A!=TV)WC(eouTQij0bmE}YJaJZhSb=}Y)pu;jQuF|SfdZ)G zNpjV~An+O}fa4iY5wPOL>inTVK~!-yjS3XRCUj7sAZodpMg0o|Ppa?eQMH&?-h$Xp*wh9!%<~+s-1qz~$ z!}yR!W|h(A5sPphpD>1WznNduuq{{fEfXl*@#Y`(?92`P$VBq>D-~8gs9`M*;3A&j zd-@UAo@K0jF&`UqBv)}KkMa`l@io8GmYxh{;_RCb5)ly*5fKp)5fPaT{t(GNvbJp+ P00000NkvXXu0mjf)A`04 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_phone_big.png b/app/src/main/res/drawable-xxxhdpi/ic_phone_big.png new file mode 100644 index 0000000000000000000000000000000000000000..707350b0057539085e1c7932d5d4d042e3e79cd0 GIT binary patch literal 1367 zcmV-d1*rOoP)G0000FZNklI+diMinpn4*$^^xB~3laSUBMk()NUf z5|*KYv{kaKg%NJX!z~s@=!S50PS4={1B|h4jgy1xM zj4=tpLHMZB=eQtjg_jjflCcC{4lqeZ0TrO%k`XZwA77Y+;8T3eGzq~Yx(!Fg#dtZy zBpG|-FP{f3n!ePa{RSTvcc+#KQcxu{;0T9@khmm{Cn+U#;-}M?Wke76K+!cQL&cdkBq*G zKOYAwwov>jp$TO<#GkRW2yZL?sMuZcM@0eS6n|7)Pna(hzYCV6JShGW6CXTJvUNInBH1L3fp)_hRFUi{6E8eUh#gIQ(16(_8%J#uA6!6)hfI7>!Vp4iW#WUq z2r-n}CO&wR5Fb%s;(=z&B*e`oJ~&=0=0-*$F%lu6WW&@0%@Bz+XqjxY<@#KdLz?o`6eU@epMu^p9!naDCG z>EjAQ4WpS!+9=?2LJfB~3xxU%Bh)xnHc1;RGmB7DS;ria;Y_}vC7<&Ym$07wKd>!j zgqp=>=7hZ&$M22h3HGI?Rd*agxcMH#S196f{?0-^=OVVIhTe>SRK~ukzZSkjvI=_f z1ShdJh1KzS=yk$Xa%rmZe?)f57)1x(;sGw@Xm(^X)@4yE2dLm2nUC z!s1r}30Q}Tl>ou{TpyKvXp4D-{qK7cgH1M8&dvqXHu1NT#ZQsA$NuDj+hprLPKz ziXu*BiVBE|y4*>b3W$mocufUF#=5+x0wQBWK2ZUYu@Ud9fXG;rXDL$wQLzNKGg}2j zMQu)JpbChLt$2||Dj+HvasdNXKxAylJxtQz+^8sIC!S@FhNnkGDcf@kU8&Lpji_kE zAw0=o(pAASCfT4V`*A1jSVS5gH^~j9Y{8j4L1z|{tL`aGQx%F>gTuL*7x;$3!F5#e zF15{t-Xzv#R}SYauHk-Oa60<31DlNF^*K5Csh=_=Yh=_=Yh=_=Yh=_=Y Z$hQiM&3h@-rdR*~002ovPDHLkV1i)GZ65#t literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/dialog_call_confirmation.xml b/app/src/main/res/layout/dialog_call_confirmation.xml new file mode 100644 index 00000000..9d406f6b --- /dev/null +++ b/app/src/main/res/layout/dialog_call_confirmation.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index ae62308d..316127b9 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -13,6 +13,7 @@ Kontaktlara e-poçt göndər Grupa SMS göndər Grupa e-poçt göndər + Call %s Yeni kontakt Redaktə et diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 64591683..0ff4ffd4 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -13,6 +13,7 @@ Sende E-Mail an Kontakte Sende SMS an Gruppe Sende E-Mail an Gruppe + Call %s Neuer Kontakt Kontakt bearbeiten diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 440efcb3..74ec8836 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -13,6 +13,7 @@ Send email to contacts Send SMS to group Send email to group + Call %s Νέα επαφή Επεξεργασία επαφής diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 97c2c5ae..f26a7906 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -13,6 +13,7 @@ Envoyer un e-mail aux contacts Envoyer un SMS au groupe Envoyer un e-mail au groupe + Call %s Nouveau contact Modifier contact diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 58b743d9..f5c127bc 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -13,6 +13,7 @@ Send email to contacts Send SMS to group Send email to group + Call %s Novi kontakt Uredi kontakt diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 00b4b2c0..6088a8c7 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -13,6 +13,7 @@ 連絡先にメールを送信 グループにSMSを送信 グループにメールを送信 + Call %s 新しい連絡先 連絡先を編集 diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 83faac29..0d26d31d 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -13,6 +13,7 @@ Send email to contacts Send SMS to group Send email to group + Call %s 새로운 연락처 연락처 수정 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index c191ccb9..856c888f 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -13,6 +13,7 @@ Send email to contacts Send SMS to group Send email to group + Call %s Naujas kontaktas Redaguoti kontaktą diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d2445a9e..d1c90985 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -13,6 +13,7 @@ Enviar e-mail aos contactos Enviar SMS para o grupo Enviar e-mail para o grupo + Call %s Novo contacto Editar contacto diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 55577789..9d6a161d 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -13,6 +13,7 @@ Отправить письмо контактам Отправить SMS группе Отправить письмо группе + Call %s Новый контакт Редактировать контакт diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 764e5951..8efa53a1 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -13,6 +13,7 @@ Poslať kontaktom email Poslať skupine SMS Poslať skupine email + Zavolať %s Nový kontakt Upraviť kontakt diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 49ea418d..5ded4f45 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -13,6 +13,7 @@ Skicka e-post till kontakter Skicka sms till grupp Skicka e-post till grupp + Call %s Ny kontakt Redigera kontakt diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 9b6057a9..aa343df4 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -13,6 +13,7 @@ Kişilere e-posta gönder Gruba SMS gönder Gruba e-posta gönder + Call %s Yeni kişi Kişiyi düzenle diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0ae83827..9383c834 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -13,6 +13,7 @@ 發送電子郵件給聯絡人 發送簡訊給群組 發送電子郵件給群組 + Call %s 新聯絡人 編輯聯絡人 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c5296c61..1ce3a4b0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -13,6 +13,7 @@ Send email to contacts Send SMS to group Send email to group + Call %s New contact Edit contact