From 7fe3a96f6aa3d9609375580d526ef18b4be22dc0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 26 Oct 2020 22:45:48 +0100 Subject: [PATCH] show a WhatsApp logo at WhatsApp sources --- .../pro/activities/ViewContactActivity.kt | 8 +++ .../contacts/pro/helpers/Constants.kt | 2 + .../main/res/drawable/ic_logo_whatsapp.xml | 18 +++++++ .../res/layout/item_view_contact_source.xml | 49 +++++++++++++------ 4 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 app/src/main/res/drawable/ic_logo_whatsapp.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt index 458ed121..396dca28 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt @@ -534,6 +534,14 @@ class ViewContactActivity : ContactActivity() { contact_source.setOnClickListener { launchEditContact(key) } + + if (value.toLowerCase() == WHATSAPP) { + contact_source_image.setImageResource(R.drawable.ic_logo_whatsapp) + contact_source_image.beVisible() + contact_source_image.setOnClickListener { + + } + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt index bc2e37e6..a071b86d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt @@ -107,6 +107,8 @@ const val TELEGRAM_PACKAGE = "org.telegram.messenger" const val SIGNAL_PACKAGE = "org.thoughtcrime.securesms" const val WHATSAPP_PACKAGE = "com.whatsapp" +const val WHATSAPP = "whatsapp" + fun getEmptyLocalContact() = LocalContact(0, "", "", "", "", "", "", null, "", ArrayList(), ArrayList(), ArrayList(), 0, ArrayList(), "", ArrayList(), "", "", ArrayList(), ArrayList()) fun getProperText(text: String, shouldNormalize: Boolean) = if (shouldNormalize) text.normalizeString() else text diff --git a/app/src/main/res/drawable/ic_logo_whatsapp.xml b/app/src/main/res/drawable/ic_logo_whatsapp.xml new file mode 100644 index 00000000..08433044 --- /dev/null +++ b/app/src/main/res/drawable/ic_logo_whatsapp.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/layout/item_view_contact_source.xml b/app/src/main/res/layout/item_view_contact_source.xml index 236280cc..5991dee8 100644 --- a/app/src/main/res/layout/item_view_contact_source.xml +++ b/app/src/main/res/layout/item_view_contact_source.xml @@ -1,16 +1,37 @@ - + android:layout_height="wrap_content"> + + + + + +