@Override
    public View getView(int position, View convertView, ViewGroup group) {
      if (convertView == null) {
        convertView = View.inflate(getActivity(), R.layout.buffer_line, null);
      }

      BufferEvent event = getItem(position);
      BufferEvent prevEvent = (position > 0) ? getItem(position - 1) : null;

      BufferEventItem firstItem = event.getFirstItem();
      BufferEventMessage firstItemMessage = firstItem.getMessage();

      boolean isNewDay = ((prevEvent != null) && (!firstItem.isSameDay(prevEvent.getFirstItem())));
      TextView dayView = (TextView) convertView.findViewById(R.id.day);
      dayView.setVisibility(isNewDay ? View.VISIBLE : View.GONE);
      if (isNewDay) {
        dayView.setText(mDateFormat.format(firstItemMessage.getDate()));
      }

      TextView timestampView = (TextView) convertView.findViewById(R.id.timestamp);
      TextView textView = (TextView) convertView.findViewById(R.id.text);

      Date date = firstItemMessage.getDate();
      if (date != null) {
        timestampView.setText(new SimpleDateFormat("h:mm aa").format(date));
        timestampView.setVisibility(View.VISIBLE);
      } else {
        timestampView.setVisibility(View.GONE);
      }
      CharSequence text = mRenderer.renderEvent(event);
      if ((!(mBuffer instanceof ConsoleBuffer)) && (!(text instanceof SpannableString))) {
        SpannableString span = new SpannableString(text);
        span.setSpan(
            new StyleSpan(Typeface.ITALIC), 0, span.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        span.setSpan(
            new ForegroundColorSpan(Color.GRAY),
            0,
            span.length(),
            Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        textView.setText(span);
      } else {
        textView.setText(text);
      }

      boolean highlight = firstItem.isHighlight() && (mBuffer instanceof ChannelBuffer);
      convertView
          .findViewById(R.id.inner)
          .setBackgroundColor(highlight ? mHighlightBgColor : Color.TRANSPARENT);

      return convertView;
    }
  private void populateMenuItems(List<ContextMenuItem> menuItems, BufferEventItem item) {
    menuItems.add(new CopyContextMenuItem(item));

    BufferEventMessage message = item.getMessage();

    final String nick = TextUtils.isEmpty(message.from) ? message.nick : message.from;
    if (!TextUtils.isEmpty(nick)) {
      if (mBuffer instanceof ChannelBuffer) {
        if (((ChannelBuffer) mBuffer).isInChannel(nick)) {
          menuItems.add(new MessageUserContextMenuItem(nick));
          menuItems.add(new MentionUserContextMenuItem(nick));
        }
      } else {
        menuItems.add(new MessageUserContextMenuItem(nick));
      }
    }

    if (!TextUtils.isEmpty(message.getMsgString())) {
      Matcher matcher = URL_PATTERN.matcher(message.getMsgString());
      while (matcher.find()) {
        menuItems.add(new URLContextMenuItem(matcher.group(0)));
      }
    }
  }