Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// com/example/bubblechat/BubbleMessageViewHolder.kt:84
private fun configText() {
text.text = messageListItem.message.text
val params = text.layoutParams as ConstraintLayout.LayoutParams
if (messageListItem.isMine) {
params.horizontalBias = 1f
text.setTextColor(Color.WHITE)
text.setPadding(dpToPixel(10f), dpToPixel(5f), dpToPixel(15f), dpToPixel(5f))
if (isBottom()) {
text.setBackgroundResource(R.drawable.bubble_right_tail)
} else {
text.setBackgroundResource(R.drawable.bubble_right)
}
} else {
params.horizontalBias = 0f
text.setTextColor(Color.BLACK)
text.setPadding(dpToPixel(15f), dpToPixel(5f), dpToPixel(10f), dpToPixel(5f))
if (isBottom()) {
text.setBackgroundResource(R.drawable.bubble_left_tail)
} else {
text.setBackgroundResource(R.drawable.bubble_left)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.