MasayukiSuda/BubbleLayout

setBubbleColor always gray

Yisas opened this issue · 1 comments

Yisas commented

The issue could be specific to when populating through an adapter. Inside the poplateView I have:

protected void populateView(View v, ChatMessage model, int position) {
 BubbleLayout bubble;
 bubble = (BubbleLayout) v.findViewById(R.id.bubble);

 if (model.getMessageUser() != null && messageAuthor.equals(currentUsername)) {
            RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) bubble.getLayoutParams();
            params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

            bubble.setArrowDirection(ArrowDirection.RIGHT);
            bubble.setBubbleColor(R.color.colorPrimary);
        }

The arrow direction works well, but the bubbles always looks dark gray regardless of the value of R.color.colorPrimary in the values resource folder. Setting the color of the bubble in the xml layout works (displays the right color) for the bubbles that don't meet the condition in the above statement.

bubble.setBubbleColor(ContextCompat.getColor(context, R.color.colorPrimary));

I think that it will be successful.