@Override public View getView(final int position, final View convertView, final ViewGroup parent) { TextView view = (TextView) convertView; if (view == null) { view = (TextView) mInflater.inflate(R.layout.default_listview_textview, parent, false); UIUtils.setRobotoLight(getContext(), view); } final ChannelUser user = getItem(position); final UserLevel level = user.getChannelPrivileges(mChannel); final char prefix = level == null ? '\0' : level.getPrefix(); final SpannableStringBuilder builder = new SpannableStringBuilder(prefix + user.getNick().getNickAsString()); final ForegroundColorSpan span = new ForegroundColorSpan(NickCache.getNickCache().get(user.getNick()).getColour()); builder.setSpan(span, 0, builder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); view.setText(builder); return view; }
@Override public long getHeaderId(int position) { final ChannelUser user = getItem(position); return user.getChannelPrivileges(mChannel).getPrefix(); }