fix #115, use rounded avatars

This commit is contained in:
tibbi 2019-03-07 15:35:42 +01:00
parent 312c4c363e
commit 11fac47ae7
2 changed files with 15 additions and 2 deletions

View file

@ -1,6 +1,7 @@
package com.simplemobiletools.contacts.pro.activities
import android.graphics.Bitmap
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.provider.ContactsContract
import android.widget.ImageView
@ -53,9 +54,11 @@ abstract class ContactActivity : SimpleActivity() {
.load(bitmap ?: path)
.transition(DrawableTransitionOptions.withCrossFade())
.apply(options)
.apply(RequestOptions.circleCropTransform())
.listener(object : RequestListener<Drawable> {
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)
return false
}

View file

@ -295,7 +295,12 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
.error(placeholderImage)
.centerCrop()
Glide.with(activity).load(contact.photoUri).transition(DrawableTransitionOptions.withCrossFade()).apply(options).into(contact_tmb)
Glide.with(activity)
.load(contact.photoUri)
.transition(DrawableTransitionOptions.withCrossFade())
.apply(options)
.apply(RequestOptions.circleCropTransform())
.into(contact_tmb)
}
contact.photo != null -> {
val options = RequestOptions()
@ -304,7 +309,12 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
.error(placeholderImage)
.centerCrop()
Glide.with(activity).load(contact.photo).transition(DrawableTransitionOptions.withCrossFade()).apply(options).into(contact_tmb)
Glide.with(activity)
.load(contact.photo)
.transition(DrawableTransitionOptions.withCrossFade())
.apply(options)
.apply(RequestOptions.circleCropTransform())
.into(contact_tmb)
}
else -> contact_tmb.setImageDrawable(placeholderImage)
}