ChatKit
ChatKit copied to clipboard
when I'm setting the bubble color programmatically it lose its shape

Hi! Do you use Styling via attributes?
mBubble.setBackgroundColor(mContext.getResources().getColor(R.color.mRed));
no I'm using this line, I'm using it when a message is not delivered to the user
Unfortunately, you can't just set bg color without change the shape of a bubble.
MessageListStyle use this method to set bg color of a bubble:
private Drawable getMessageSelector(@ColorInt int normalColor, @ColorInt int selectedColor,
@ColorInt int pressedColor, @DrawableRes int shape) {
Drawable drawable = DrawableCompat.wrap(getVectorDrawable(shape)).mutate();
DrawableCompat.setTintList(
drawable,
new ColorStateList(
new int[][]{
new int[]{android.R.attr.state_selected},
new int[]{android.R.attr.state_pressed},
new int[]{-android.R.attr.state_pressed, -android.R.attr.state_selected}
},
new int[]{selectedColor, pressedColor, normalColor}
));
return drawable;
}
You could use something similar to it.