Ejemplo n.º 1
0
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

      final ViewHolder holder;

      if (convertView == null) {

        convertView = m_Inflater.inflate(R.layout.reputation_item, parent, false);

        holder = new ViewHolder();

        holder.txtIsNew = (ImageView) convertView.findViewById(R.id.txtIsNew);
        holder.txtAuthor = (TextView) convertView.findViewById(R.id.txtAuthor);
        holder.txtAuthor.setTextSize(m_TopTextSize);

        holder.txtLastMessageDate = (TextView) convertView.findViewById(R.id.txtLastMessageDate);
        holder.txtLastMessageDate.setTextSize(m_TopTextSize);

        holder.txtTitle = (TextView) convertView.findViewById(R.id.txtTitle);
        holder.txtTitle.setTextSize(m_ThemeTitleSize);

        holder.txtForumTitle = (TextView) convertView.findViewById(R.id.txtForumTitle);

        holder.txtForumTitle.setTextSize(m_BottomTextSize);

        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      Reputation rep = this.getItem(position);

      holder.txtAuthor.setText(rep.user);
      holder.txtLastMessageDate.setText(rep.date);
      holder.txtTitle.setText(rep.description);

      holder.txtForumTitle.setText("@" + rep.source);

      if (rep.level.equals("up")) {
        holder.txtIsNew.setImageResource(R.drawable.new_flag);
      } else {
        holder.txtIsNew.setImageResource(R.drawable.old_flag);
      }

      return convertView;
    }