use the colored letter icon at View and Edit screens too
This commit is contained in:
parent
8f8b5800b8
commit
bee5d768b9
|
@ -1,6 +1,7 @@
|
||||||
package com.simplemobiletools.contacts.pro.activities
|
package com.simplemobiletools.contacts.pro.activities
|
||||||
|
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.provider.ContactsContract.CommonDataKinds.*
|
import android.provider.ContactsContract.CommonDataKinds.*
|
||||||
|
@ -15,12 +16,9 @@ import com.bumptech.glide.request.RequestOptions
|
||||||
import com.bumptech.glide.request.target.Target
|
import com.bumptech.glide.request.target.Target
|
||||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
import com.simplemobiletools.commons.extensions.getContactLetterIcon
|
||||||
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
|
||||||
import com.simplemobiletools.commons.extensions.getContrastColor
|
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
import com.simplemobiletools.contacts.pro.R
|
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.sendEmailIntent
|
||||||
import com.simplemobiletools.contacts.pro.extensions.sendSMSIntent
|
import com.simplemobiletools.contacts.pro.extensions.sendSMSIntent
|
||||||
import com.simplemobiletools.contacts.pro.extensions.shareContacts
|
import com.simplemobiletools.contacts.pro.extensions.shareContacts
|
||||||
|
@ -33,13 +31,7 @@ abstract class ContactActivity : SimpleActivity() {
|
||||||
protected var currentContactPhotoPath = ""
|
protected var currentContactPhotoPath = ""
|
||||||
|
|
||||||
fun showPhotoPlaceholder(photoView: ImageView) {
|
fun showPhotoPlaceholder(photoView: ImageView) {
|
||||||
val background = resources.getDrawable(R.drawable.contact_circular_background)
|
val placeholder = BitmapDrawable(resources, getContactLetterIcon(contact?.getNameToDisplay() ?: "S"))
|
||||||
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)
|
|
||||||
photoView.setImageDrawable(placeholder)
|
photoView.setImageDrawable(placeholder)
|
||||||
currentContactPhotoPath = ""
|
currentContactPhotoPath = ""
|
||||||
contact?.photo = null
|
contact?.photo = null
|
||||||
|
@ -62,7 +54,6 @@ abstract class ContactActivity : SimpleActivity() {
|
||||||
.apply(RequestOptions.circleCropTransform())
|
.apply(RequestOptions.circleCropTransform())
|
||||||
.listener(object : RequestListener<Drawable> {
|
.listener(object : RequestListener<Drawable> {
|
||||||
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||||
photoView.setPadding(0, 0, 0, 0)
|
|
||||||
photoView.background = ColorDrawable(0)
|
photoView.background = ColorDrawable(0)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,10 +213,6 @@ class EditContactActivity : ContactActivity() {
|
||||||
contact_start_call.beVisibleIf(contact!!.phoneNumbers.isNotEmpty())
|
contact_start_call.beVisibleIf(contact!!.phoneNumbers.isNotEmpty())
|
||||||
contact_send_email.beVisibleIf(contact!!.emails.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) {
|
if (contact!!.photoUri.isEmpty() && contact!!.photo == null) {
|
||||||
showPhotoPlaceholder(contact_photo)
|
showPhotoPlaceholder(contact_photo)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -155,10 +155,6 @@ class ViewContactActivity : ContactActivity() {
|
||||||
contact_start_call.beVisibleIf(contact!!.phoneNumbers.isNotEmpty())
|
contact_start_call.beVisibleIf(contact!!.phoneNumbers.isNotEmpty())
|
||||||
contact_send_email.beVisibleIf(contact!!.emails.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) {
|
if (contact!!.photoUri.isEmpty() && contact!!.photo == null) {
|
||||||
showPhotoPlaceholder(contact_photo)
|
showPhotoPlaceholder(contact_photo)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="oval">
|
|
||||||
|
|
||||||
<solid android:color="@color/color_primary"/>
|
|
||||||
</shape>
|
|
Loading…
Reference in New Issue