From bee5d768b9e6a2d1c592cf88e15faf887f714b27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 28 Apr 2020 09:32:49 +0200 Subject: [PATCH] use the colored letter icon at View and Edit screens too --- .../contacts/pro/activities/ContactActivity.kt | 15 +++------------ .../pro/activities/EditContactActivity.kt | 4 ---- .../pro/activities/ViewContactActivity.kt | 4 ---- .../res/drawable/contact_circular_background.xml | 7 ------- 4 files changed, 3 insertions(+), 27 deletions(-) delete mode 100644 app/src/main/res/drawable/contact_circular_background.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ContactActivity.kt index 76924b6f..15a03894 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ContactActivity.kt @@ -1,6 +1,7 @@ package com.simplemobiletools.contacts.pro.activities import android.graphics.Bitmap +import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.provider.ContactsContract.CommonDataKinds.* @@ -15,12 +16,9 @@ import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog -import com.simplemobiletools.commons.extensions.applyColorFilter -import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor -import com.simplemobiletools.commons.extensions.getContrastColor +import com.simplemobiletools.commons.extensions.getContactLetterIcon import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.contacts.pro.R -import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.extensions.sendEmailIntent import com.simplemobiletools.contacts.pro.extensions.sendSMSIntent import com.simplemobiletools.contacts.pro.extensions.shareContacts @@ -33,13 +31,7 @@ abstract class ContactActivity : SimpleActivity() { protected var currentContactPhotoPath = "" fun showPhotoPlaceholder(photoView: ImageView) { - val background = resources.getDrawable(R.drawable.contact_circular_background) - background.applyColorFilter(config.primaryColor) - photoView.background = background - - val placeholder = resources.getColoredDrawableWithColor(R.drawable.ic_person_vector, config.primaryColor.getContrastColor()) - val padding = resources.getDimension(R.dimen.activity_margin).toInt() - photoView.setPadding(padding, padding, padding, padding) + val placeholder = BitmapDrawable(resources, getContactLetterIcon(contact?.getNameToDisplay() ?: "S")) photoView.setImageDrawable(placeholder) currentContactPhotoPath = "" contact?.photo = null @@ -62,7 +54,6 @@ abstract class ContactActivity : SimpleActivity() { .apply(RequestOptions.circleCropTransform()) .listener(object : RequestListener { override fun onResourceReady(resource: Drawable?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { - photoView.setPadding(0, 0, 0, 0) photoView.background = ColorDrawable(0) return false } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt index a36a2c95..b4e1da60 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt @@ -213,10 +213,6 @@ class EditContactActivity : ContactActivity() { contact_start_call.beVisibleIf(contact!!.phoneNumbers.isNotEmpty()) contact_send_email.beVisibleIf(contact!!.emails.isNotEmpty()) - val background = resources.getDrawable(R.drawable.contact_circular_background) - background.applyColorFilter(config.primaryColor) - contact_photo.background = background - if (contact!!.photoUri.isEmpty() && contact!!.photo == null) { showPhotoPlaceholder(contact_photo) } else { 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 d92dc8d6..c25f451f 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 @@ -155,10 +155,6 @@ class ViewContactActivity : ContactActivity() { contact_start_call.beVisibleIf(contact!!.phoneNumbers.isNotEmpty()) contact_send_email.beVisibleIf(contact!!.emails.isNotEmpty()) - val background = resources.getDrawable(R.drawable.contact_circular_background) - background.applyColorFilter(config.primaryColor) - contact_photo.background = background - if (contact!!.photoUri.isEmpty() && contact!!.photo == null) { showPhotoPlaceholder(contact_photo) } else { diff --git a/app/src/main/res/drawable/contact_circular_background.xml b/app/src/main/res/drawable/contact_circular_background.xml deleted file mode 100644 index bd3dc800..00000000 --- a/app/src/main/res/drawable/contact_circular_background.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - -