From 4345bb7a9ebd36f32f017a565f68ae7d87d371c4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 7 Mar 2019 15:45:54 +0100 Subject: [PATCH] use circular photos at the edit and view screens too --- .../contacts/pro/activities/ContactActivity.kt | 5 +++++ .../contacts/pro/activities/EditContactActivity.kt | 5 +++-- .../contacts/pro/activities/ViewContactActivity.kt | 5 +++-- app/src/main/res/drawable/contact_circular_background.xml | 7 +++++++ 4 files changed, 18 insertions(+), 4 deletions(-) create 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 190672a9..fa90b7ac 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 @@ -15,6 +15,7 @@ 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.getColoredBitmap import com.simplemobiletools.commons.extensions.getContrastColor import com.simplemobiletools.commons.models.RadioItem @@ -32,6 +33,10 @@ 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.getColoredBitmap(R.drawable.ic_person, config.primaryColor.getContrastColor()) val padding = resources.getDimension(R.dimen.activity_margin).toInt() photoView.setPadding(padding, padding, padding, padding) 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 a25b59d1..80519369 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 @@ -6,7 +6,6 @@ import android.content.ClipData import android.content.ContentValues import android.content.Intent import android.graphics.Bitmap -import android.graphics.drawable.ColorDrawable import android.net.Uri import android.os.Bundle import android.provider.ContactsContract.CommonDataKinds @@ -195,7 +194,9 @@ class EditContactActivity : ContactActivity() { contact_start_call.beVisibleIf(contact!!.phoneNumbers.isNotEmpty()) contact_send_email.beVisibleIf(contact!!.emails.isNotEmpty()) - contact_photo.background = ColorDrawable(config.primaryColor) + 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) 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 be1fbdb1..7d1df17f 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 @@ -1,7 +1,6 @@ package com.simplemobiletools.contacts.pro.activities import android.content.Intent -import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.provider.ContactsContract import android.view.Menu @@ -133,7 +132,9 @@ class ViewContactActivity : ContactActivity() { contact_start_call.beVisibleIf(contact!!.phoneNumbers.isNotEmpty()) contact_send_email.beVisibleIf(contact!!.emails.isNotEmpty()) - contact_photo.background = ColorDrawable(config.primaryColor) + 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) diff --git a/app/src/main/res/drawable/contact_circular_background.xml b/app/src/main/res/drawable/contact_circular_background.xml new file mode 100644 index 00000000..bd3dc800 --- /dev/null +++ b/app/src/main/res/drawable/contact_circular_background.xml @@ -0,0 +1,7 @@ + + + + +