Closed iRaam closed 5 years ago
Currently I am using this library for one of my project. I have a requirement to apply different color for different tokens in the recipient editor. How could I achieve that ?
@Override protected View getViewForObject(final ContactInfo contact) { LayoutInflater l = (LayoutInflater)getContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE); TokenTextView token = (TokenTextView) l.inflate(R.layout.contact_token, (ViewGroup) getParent(), false); if (!TextUtils.isEmpty(contact.getContactName())) { token.setText(contact.getContactName()); } else { token.setText(contact.getContactNo()); } if (contact.getUserProfile().isSubscribedUser()) { token.setTextColor(Color.YELLOW); } else { token.setTextColor(Color.RED); } return token; }
As of now, the token color changes to the color which I have in "contact_token.xml" when I add the next token.
I made a mistake in TokenTextView class. In setSelected() I was changing the text color.
setSelected()
Currently I am using this library for one of my project. I have a requirement to apply different color for different tokens in the recipient editor. How could I achieve that ?
As of now, the token color changes to the color which I have in "contact_token.xml" when I add the next token.