Example #1
0
  @Override
  public View getHeaderView(int i, View convertView, ViewGroup viewGroup) {
    TextView view = (TextView) convertView;
    if (convertView == null) {
      view = (TextView) mInflater.inflate(R.layout.sliding_menu_header, viewGroup, false);
    }

    final UserLevel levelEnum = getItem(i).getChannelPrivileges(mChannel);
    view.setText(mChannel.getNumberOfUsersType(levelEnum) + " " + levelEnum.getName());
    return view;
  }
Example #2
0
 @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;
 }