From c4e22f5512570d05178711ba90c28eb6dc288253 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 6 Jun 2017 00:43:57 -0700 Subject: Beautify accounts selector --- app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt index 5a17fa8f..e0e33e79 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt @@ -1,5 +1,6 @@ package com.pitchedapps.frost.views +import android.graphics.Bitmap import android.graphics.drawable.Drawable import android.support.v7.widget.AppCompatTextView import android.support.v7.widget.RecyclerView @@ -8,8 +9,11 @@ import android.widget.ImageView import butterknife.ButterKnife import com.bumptech.glide.Glide import com.bumptech.glide.load.DataSource +import com.bumptech.glide.load.Transformation import com.bumptech.glide.load.engine.GlideException +import com.bumptech.glide.load.resource.bitmap.CircleCrop import com.bumptech.glide.request.RequestListener +import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target import com.mikepenz.fastadapter.items.AbstractItem import com.pitchedapps.frost.R @@ -36,7 +40,8 @@ class AccountItem(val id: Long, val name: String) : AbstractItem { + val options = RequestOptions().transform(CircleCrop()) + Glide.with(itemView).load(PROFILE_PICTURE_URL(id)).apply(options).listener(object : RequestListener { override fun onResourceReady(resource: Drawable?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { text.fadeIn() return false @@ -48,6 +53,7 @@ class AccountItem(val id: Long, val name: String) : AbstractItem