Commit b250e7be authored by Łukasz Rutkowski's avatar Łukasz Rutkowski

Use drawableStart instead of separate ImageView for status indicator

parent 016ae737
...@@ -43,9 +43,8 @@ class MembersAdapter(private val listener: (MemberUiModel) -> Unit) : ...@@ -43,9 +43,8 @@ class MembersAdapter(private val listener: (MemberUiModel) -> Unit) :
fun bind(memberUiModel: MemberUiModel, listener: (MemberUiModel) -> Unit) = with(itemView) { fun bind(memberUiModel: MemberUiModel, listener: (MemberUiModel) -> Unit) = with(itemView) {
image_avatar.setImageURI(memberUiModel.avatarUri) image_avatar.setImageURI(memberUiModel.avatarUri)
text_member.content = memberUiModel.displayName text_member.content = memberUiModel.displayName
text_member.setCompoundDrawablesRelativeWithIntrinsicBounds(DrawableHelper.getUserStatusDrawable(memberUiModel.status, context), null, null, null)
setOnClickListener { listener(memberUiModel) } setOnClickListener { listener(memberUiModel) }
val statusDrawable = DrawableHelper.getUserStatusDrawable(memberUiModel.status, context)
image_member_status.setImageDrawable(statusDrawable)
} }
} }
} }
\ No newline at end of file
...@@ -18,25 +18,17 @@ ...@@ -18,25 +18,17 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/image_member_status"
android:layout_width="12dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="@+id/layout_avatar"
app:layout_constraintStart_toEndOf="@+id/layout_avatar"
app:layout_constraintTop_toTopOf="@+id/layout_avatar"
tools:src="@drawable/ic_status_invisible_12dp" />
<TextView <TextView
android:id="@+id/text_member" android:id="@+id/text_member"
style="@style/Sender.Name.TextView" style="@style/Sender.Name.TextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/text_view_drawable_padding" android:layout_marginStart="16dp"
android:drawablePadding="@dimen/text_view_drawable_padding"
app:layout_constraintBottom_toBottomOf="@+id/layout_avatar" app:layout_constraintBottom_toBottomOf="@+id/layout_avatar"
app:layout_constraintLeft_toRightOf="@+id/image_member_status" app:layout_constraintLeft_toRightOf="@+id/layout_avatar"
app:layout_constraintTop_toTopOf="@+id/layout_avatar" app:layout_constraintTop_toTopOf="@+id/layout_avatar"
tools:drawableStart="@drawable/ic_status_invisible_12dp"
tools:text="Ronald Perkins" /> tools:text="Ronald Perkins" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment