Exemplo n.º 1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      viewHolder = new ViewHolder();
      convertView = inflater.inflate(R.layout.item_issuedynamite, null);
      viewHolder.AssistContent = (TextView) convertView.findViewById(R.id.itemid_assistcontent);
      viewHolder.btn = (Button) convertView.findViewById(R.id.itemid_btn);
      viewHolder.locationInfo = (TextView) convertView.findViewById(R.id.itemid_locationinfo);
      viewHolder.mainContent = (TextView) convertView.findViewById(R.id.itemid_maincontent);
      viewHolder.name = (TextView) convertView.findViewById(R.id.itemid_name);
      viewHolder.networkImageView = (NetworkImageView) convertView.findViewById(R.id.itemid_iv);
      viewHolder.SendDateStr = (TextView) convertView.findViewById(R.id.itemid_senddatestr);
      viewHolder.SenderDateStr = (TextView) convertView.findViewById(R.id.itemid_senderdatestr);
      viewHolder.sex = (ImageView) convertView.findViewById(R.id.itemid_seximg);
      viewHolder.personLL = (LinearLayout) convertView.findViewById(R.id.itemid_personll);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }
    AdminMessageContentEntity mContentEntity = mList.get(position);
    AdminMessageContentButtonEntity mButtonEntity =
        mContentEntity.getAdminMessageContentButtonEntity();
    int type = mContentEntity.getMsgTypeId();
    String imgUrl = mContentEntity.getSenderPhoto();
    if (type == 12) { // 邀请
      viewHolder.mainContent.setVisibility(View.GONE);
      viewHolder.name.setText(mContentEntity.getSenderName());
      if (mContentEntity.getSenderSexIsFemale()) {
        viewHolder.sex.setImageResource(R.drawable.girl);
      } else {
        viewHolder.sex.setImageResource(R.drawable.boy);
      }
      viewHolder.locationInfo.setText(mContentEntity.getSenderLocationInfo());
      viewHolder.SenderDateStr.setText(mContentEntity.getSenderDateStr());
      viewHolder.SendDateStr.setText(mContentEntity.getSendDateStr());
      viewHolder.btn.setText(mButtonEntity.getCaption());
      viewHolder.AssistContent.setText(mContentEntity.getAssistContent());
      viewHolder.btn.setOnClickListener(new btnOnclick(mButtonEntity.getCallUrl()));
      viewHolder.networkImageView.setErrorImageResId(R.drawable.photobg);
      viewHolder.networkImageView.setDefaultImageResId(R.drawable.photobg);
      viewHolder.networkImageView.setImageUrl(
          Utils.processResultStr(Constants.URL + imgUrl, "_150_"), mImageLoader);
      if (mButtonEntity.getCallUrl() == null) {
        viewHolder.btn.setText(mButtonEntity.getCaption());
      } else {
        viewHolder.btn.setText(mButtonEntity.getCaption());
        viewHolder.btn.setOnClickListener(new btnOnclick(mButtonEntity.getCaption()));
      }
    } else if (type == 10) { // 报名
      if (mContentEntity.getSenderID() != 1) { // 如果button有内容的
        viewHolder.name.setText(mContentEntity.getSenderName());
        if (mContentEntity.getSenderSexIsFemale()) {
          viewHolder.sex.setImageResource(R.drawable.girl);
        } else {
          viewHolder.sex.setImageResource(R.drawable.boy);
        }
        viewHolder.locationInfo.setText(mContentEntity.getSenderLocationInfo());
        viewHolder.SenderDateStr.setText(mContentEntity.getSenderDateStr());
        viewHolder.SendDateStr.setText(mContentEntity.getSendDateStr());
        viewHolder.btn.setText(mButtonEntity.getCaption());
        viewHolder.AssistContent.setText(mContentEntity.getAssistContent());
        viewHolder.btn.setOnClickListener(new btnOnclick(mButtonEntity.getCallUrl()));
        viewHolder.networkImageView.setErrorImageResId(R.drawable.photobg);
        viewHolder.networkImageView.setDefaultImageResId(R.drawable.photobg);
        viewHolder.networkImageView.setImageUrl(
            Utils.processResultStr(Constants.URL + imgUrl, "_150_"), mImageLoader);
      } else {
        viewHolder.name.setText("您已经接受了该邀请:");
        viewHolder.networkImageView.setVisibility(View.GONE);
        viewHolder.personLL.setVisibility(View.GONE);
        viewHolder.mainContent.setText("此处需要后台调整");
        viewHolder.btn.setVisibility(View.GONE);
        viewHolder.SendDateStr.setText(mContentEntity.getSendDateStr());
      }
    } else if (type == 11) { // 回复
      viewHolder.AssistContent.setText(mContentEntity.getAssistContent());
      viewHolder.mainContent.setText(mContentEntity.getMainContent());
      viewHolder.AssistContent.setVisibility(View.VISIBLE);
      viewHolder.mainContent.setVisibility(View.VISIBLE);
      viewHolder.personLL.setVisibility(View.GONE);
      viewHolder.name.setText(mContentEntity.getSenderName());
      viewHolder.SendDateStr.setText(mContentEntity.getSendDateStr());
      viewHolder.btn.setVisibility(View.GONE);
      viewHolder.networkImageView.setErrorImageResId(R.drawable.photobg);
      viewHolder.networkImageView.setDefaultImageResId(R.drawable.photobg);
      viewHolder.networkImageView.setImageUrl(
          Utils.processResultStr(Constants.URL + imgUrl, "_150_"), mImageLoader);
    } else if (type == 13) { // 评论
      viewHolder.name.setText(mContentEntity.getMainContent());
      viewHolder.AssistContent.setText(mContentEntity.getAssistContent());
      viewHolder.SendDateStr.setText(mContentEntity.getSendDateStr());
      viewHolder.btn.setText(mButtonEntity.getCaption());
      viewHolder.personLL.setVisibility(View.GONE);
      viewHolder.networkImageView.setVisibility(View.GONE);
      // 此处需要跟我哥交流1下。
    }

    return convertView;
  }
Exemplo n.º 2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = inflater.inflate(R.layout.item_evaluate, null);
      holder.age = (TextView) convertView.findViewById(R.id.evaluate__age);
      holder.evaluate = (Button) convertView.findViewById(R.id.evaluate__pj);
      holder.name = (TextView) convertView.findViewById(R.id.evaluate_name);
      holder.sex = (ImageView) convertView.findViewById(R.id.evaluate__seximg);
      holder.signature = (TextView) convertView.findViewById(R.id.evaluate__signature);
      holder.state = (TextView) convertView.findViewById(R.id.evaluate_zt);
      holder.astro = (TextView) convertView.findViewById(R.id.evaluate__astro);
      holder.networkImageView = (NetworkImageView) convertView.findViewById(R.id.evaluate_img);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    UserInfo userInfo = mUserInfos.get(position);
    final String publishID = userInfo.getPID();
    String imgUrl = userInfo.getPhotoUrl();
    holder.age.setText(userInfo.getAge());
    holder.astro.setText(userInfo.getAstro());
    holder.name.setText(userInfo.getNickName());
    if (TextUtils.isEmpty(userInfo.getSignature())) {
      holder.signature.setText("此人暂时没有签名");
    } else {

      holder.signature.setText(userInfo.getSignature());
    }
    if (userInfo.getSexID().equals("1")) {
      holder.sex.setImageResource(R.drawable.boy);
      holder.age.setTextColor(mContext.getResources().getColor(R.color.lanse));
      holder.astro.setTextColor(mContext.getResources().getColor(R.color.lanse));
    } else {
      holder.sex.setImageResource(R.drawable.girl);
      holder.age.setTextColor(mContext.getResources().getColor(R.color.fense));
      holder.astro.setTextColor(mContext.getResources().getColor(R.color.fense));
    }
    holder.networkImageView.setErrorImageResId(R.drawable.photobg);
    holder.networkImageView.setDefaultImageResId(R.drawable.photobg);
    holder.networkImageView.setImageUrl(
        Utils.processResultStr(Constants.URL + imgUrl, "_150_"), mImageLoader);
    holder.networkImageView.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent(mContext, PersonalDetailActivity.class);
            intent.putExtra("userId", publishID + "");
            mContext.startActivity(intent);
          }
        });
    boolean isMe = publishID.equals(mUserPid) ? true : false;
    if (isMe) {
      holder.state.setVisibility(View.INVISIBLE);
      holder.evaluate.setVisibility(View.INVISIBLE);
    } else {
      WriteEvaluateListener writeEvaluateListener =
          new WriteEvaluateListener(userInfo.getNickName(), publishID, mUserPid);
      LookEvaluateListener lookEvaluateListener;
      if (isPublish) {

        lookEvaluateListener = new LookEvaluateListener(mAppointID, publishID);
      } else {
        lookEvaluateListener = new LookEvaluateListener(mAppointID, mUserPid);
      }
      int AppointScoreStateID = userInfo.getAppointScoreStateID();
      switch (AppointScoreStateID) {
        case 0:
          holder.state.setText("尚未评价");
          holder.evaluate.setText("评价");
          holder.evaluate.setOnClickListener(writeEvaluateListener);
          break;
        case 10:
          holder.state.setText("我已评价");
          holder.evaluate.setText("查看评价");
          holder.evaluate.setOnClickListener(lookEvaluateListener);
          break;
        case 20:
          holder.state.setText("对方已评");
          holder.evaluate.setText("评价");
          holder.evaluate.setOnClickListener(writeEvaluateListener);
          break;
        case 30:
          holder.state.setText("双方已评");
          holder.evaluate.setText("查看评价");
          holder.evaluate.setOnClickListener(lookEvaluateListener);
          break;

        default:
          break;
      }
    }

    return convertView;
  }