Esempio n. 1
0
  @Override
  public View getView(int position, View view, ViewGroup parent) {
    Holder holder = null;
    if (view == null) {
      Context context = parent.getContext();
      view = LayoutInflater.from(context).inflate(R.layout.list_item, null);
      holder = new Holder();
      holder.ivRight = (ImageView) view.findViewById(R.id.list_item_right);
      holder.tvContent = (TextView) view.findViewById(R.id.list_item_tv_text);
      holder.tvTime = (TextView) view.findViewById(R.id.list_item_time);
      view.setTag(holder);
    } else {
      holder = (Holder) view.getTag();
    }
    Notes notes = (Notes) this.myNotesList.get(position);
    holder.ivRight.setBackgroundResource(R.drawable.ic_chevron_right_black_24dp);
    holder.tvContent.setText(notes.getContent());
    holder.tvTime.setText(Utils.getDeltaTime(notes));

    return view;
  }
Esempio n. 2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    final Holder holder;
    if (convertView == null) {
      holder = new Holder();
      convertView = mInflater.inflate(R.layout.weiqiang_item_layout, parent, false);
      holder.ivAuthorImg = (ImageView) convertView.findViewById(R.id.iv_img);
      holder.tvAuthorName = (TextView) convertView.findViewById(R.id.tv_nick);
      holder.tvTime = (TextView) convertView.findViewById(R.id.tv_time);
      holder.tvComments = (TextView) convertView.findViewById(R.id.tv_comments);
      holder.gridView = (NoScrollGridView) convertView.findViewById(R.id.gv_show_img);

      holder.llTransArea = (LinearLayout) convertView.findViewById(R.id.ll_old_area);
      holder.tvOldAuthorName = (TextView) convertView.findViewById(R.id.tv_old_user);
      holder.tvContent = (TextView) convertView.findViewById(R.id.tv_content);
      holder.oldgridView = (NoScrollGridView) convertView.findViewById(R.id.gv_old_show_img);

      holder.avZan = (ActionView) convertView.findViewById(R.id.av_zan);
      holder.avReply = (ActionView) convertView.findViewById(R.id.av_reply);
      holder.avTranspnt = (ActionView) convertView.findViewById(R.id.av_transpont);
      holder.avShare = (ActionView) convertView.findViewById(R.id.av_share);
      convertView.setTag(holder);
    } else {
      holder = (Holder) convertView.getTag();
    }

    final WeiQiangBean weiqiangBean = (WeiQiangBean) mList.get(position);

    BGApp.getInstance().setImage(weiqiangBean.photo, holder.ivAuthorImg);

    holder.ivAuthorImg.setOnClickListener(new ShowNameCardListener(weiqiangBean, mActivity));

    holder.tvAuthorName.setText(weiqiangBean.name);
    holder.tvAuthorName.setOnClickListener(new ShowNameCardListener(weiqiangBean, mActivity));

    holder.tvTime.setText(ToolUtils.getFormatDate(weiqiangBean.date_time));

    if (!TextUtils.isEmpty(weiqiangBean.fromname)) { // 如果转发人存在
      holder.llTransArea.setVisibility(View.VISIBLE);
      holder.tvOldAuthorName.setText(weiqiangBean.fromname);
      holder.tvOldAuthorName.setOnClickListener(new ShowNameCardListener(weiqiangBean, mActivity));
      holder.tvContent.setText(weiqiangBean.content);
      holder.tvComments.setText(weiqiangBean.comments);
      ImgUtils.showImgs(weiqiangBean.imgs, holder.oldgridView, mActivity);
      holder.gridView.setVisibility(View.GONE);
      holder.tvContent.setVisibility(
          TextUtils.isEmpty(weiqiangBean.content) ? View.GONE : View.VISIBLE);
      holder.tvComments.setVisibility(
          TextUtils.isEmpty(weiqiangBean.comments) ? View.GONE : View.VISIBLE);
    } else {
      holder.llTransArea.setVisibility(View.GONE);
      holder.tvComments.setText(weiqiangBean.content);
      holder.tvComments.setVisibility(
          TextUtils.isEmpty(weiqiangBean.content) ? View.GONE : View.VISIBLE);
      holder.gridView.setVisibility(View.GONE);
      ImgUtils.showImgs(weiqiangBean.imgs, holder.gridView, mActivity);
    }

    holder.avZan.setCount(weiqiangBean.like_count);
    holder.avZan.setOnClickListener(mListener);
    holder.avZan.setTag(weiqiangBean);

    holder.avReply.setCount(weiqiangBean.comment_count);
    holder.avReply.setOnClickListener(mListener);
    holder.avReply.setTag(weiqiangBean);

    holder.avTranspnt.setCount(weiqiangBean.forward_count);
    holder.avTranspnt.setOnClickListener(mListener);
    holder.avTranspnt.setTag(weiqiangBean);

    holder.avShare.setCount(weiqiangBean.share_count);
    holder.avShare.setOnClickListener(mListener);
    holder.avShare.setTag(weiqiangBean);

    return convertView;
  }