Skip to content
Snippets Groups Projects
Commit 55800364 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

use AvatarView

Change-Id: I55bf89cdb327fbda28b8c50b7de606cdcdfa8487
parent b091f768
No related branches found
No related tags found
No related merge requests found
...@@ -74,7 +74,7 @@ class SmartListViewHolder : RecyclerView.ViewHolder { ...@@ -74,7 +74,7 @@ class SmartListViewHolder : RecyclerView.ViewHolder {
binding.convLastItem.text = "" binding.convLastItem.text = ""
binding.convLastTime.text = "" binding.convLastTime.text = ""
binding.convParticipant.text = "" binding.convParticipant.text = ""
binding.photo.setImageDrawable(null) binding.photo.setAvatar(null)
} }
itemView.setOnClickListener { clickListener.onItemClick(conversation) } itemView.setOnClickListener { clickListener.onItemClick(conversation) }
...@@ -119,12 +119,10 @@ class SmartListViewHolder : RecyclerView.ViewHolder { ...@@ -119,12 +119,10 @@ class SmartListViewHolder : RecyclerView.ViewHolder {
.observeOn(DeviceUtils.uiScheduler) .observeOn(DeviceUtils.uiScheduler)
.subscribe { conversationItemViewModel -> .subscribe { conversationItemViewModel ->
binding.convParticipant.text = conversationItemViewModel.title binding.convParticipant.text = conversationItemViewModel.title
val fade = binding.photo.drawable !is AvatarDrawable if (binding.photo.setAvatar(AvatarDrawable.Builder()
binding.photo.setImageDrawable(AvatarDrawable.Builder()
.withViewModel(conversationItemViewModel) .withViewModel(conversationItemViewModel)
.withCircleCrop(true) .withCircleCrop(true)
.build(binding.photo.context)) .build(binding.photo.context)))
if (fade)
binding.photo.startAnimation(fadeIn()) binding.photo.startAnimation(fadeIn())
}) })
...@@ -135,7 +133,7 @@ class SmartListViewHolder : RecyclerView.ViewHolder { ...@@ -135,7 +133,7 @@ class SmartListViewHolder : RecyclerView.ViewHolder {
} }
fun unbind() { fun unbind() {
binding?.photo?.setImageDrawable(null) binding?.photo?.setAvatar(null)
compositeDisposable.clear() compositeDisposable.clear()
} }
......
...@@ -27,14 +27,14 @@ along with this program; if not, write to the Free Software ...@@ -27,14 +27,14 @@ along with this program; if not, write to the Free Software
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="8dp"> android:paddingBottom="8dp">
<ImageView <cx.ring.views.AvatarView
android:id="@+id/photo" android:id="@+id/photo"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:scaleType="fitCenter" tools:uri="@tools:sample/us_phones"
tools:src="@drawable/ic_contact_picture_fallback" /> tools:avatar="@tools:sample/avatars" />
<RelativeLayout <RelativeLayout
android:id="@+id/conv_info" android:id="@+id/conv_info"
...@@ -58,7 +58,8 @@ along with this program; if not, write to the Free Software ...@@ -58,7 +58,8 @@ along with this program; if not, write to the Free Software
android:textColor="?attr/colorOnSurface" android:textColor="?attr/colorOnSurface"
android:textSize="@dimen/text_size_medium" android:textSize="@dimen/text_size_medium"
android:textStyle="bold" android:textStyle="bold"
tools:text="Person Name" /> tools:text="@tools:sample/full_names"
android:paddingBottom="3dp"/>
<TextView <TextView
android:id="@+id/conv_last_item" android:id="@+id/conv_last_item"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment