diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-06 00:43:57 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-06 00:43:57 -0700 |
commit | c4e22f5512570d05178711ba90c28eb6dc288253 (patch) | |
tree | 520e84e0956ba886620328642814d3126a852d5d /app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt | |
parent | 39a09a3ec1b62fe2c82bf1ad067515b1f974472b (diff) | |
download | frost-c4e22f5512570d05178711ba90c28eb6dc288253.tar.gz frost-c4e22f5512570d05178711ba90c28eb6dc288253.tar.bz2 frost-c4e22f5512570d05178711ba90c28eb6dc288253.zip |
Beautify accounts selector
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt | 8 |
1 files changed, 7 insertions, 1 deletions
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<AccountItem, Ac text.visibility = View.INVISIBLE if (id != -1L) { text.text = name - Glide.with(itemView).load(PROFILE_PICTURE_URL(id)).listener(object : RequestListener<Drawable> { + val options = RequestOptions().transform(CircleCrop()) + Glide.with(itemView).load(PROFILE_PICTURE_URL(id)).apply(options).listener(object : RequestListener<Drawable> { override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { text.fadeIn() return false @@ -48,6 +53,7 @@ class AccountItem(val id: Long, val name: String) : AbstractItem<AccountItem, Ac } }).into(image) } else { + text.visibility = View.VISIBLE text.text = itemView.context.getString(R.string.add_account) //todo add plus image } |