Exemplo n.º 1
0
 @Override
 public void onClick(View v) {
   // TODO Auto-generated method stub
   try {
     if (v != null && v.getId() == R.id.flImgProfile) {
       Post post = (Post) ((View) v.getParent().getParent()).getTag();
       delegate.doAction("userProfile", post.getUser().getUserID());
     }
   } catch (Exception ex) {
     delegate.doAction("logException", null);
   }
 }
Exemplo n.º 2
0
  public View getView(int position, View convertView, ViewGroup parent) {

    View row = convertView;

    try {
      Post item = getItem(position);
      ImageView imgStatus = null;
      ImageView imageView = null;

      if (item.isMoreFlag()) {
        row = inflater.inflate(R.layout.list_user_more_item, parent, false);
        row.setTag(item);
        this.delegate.doAction("loadMore", item);
        return row;
      } else if (row != null) {
        Post tempItem = (Post) row.getTag();
        if (tempItem == null || tempItem.isMoreFlag()) row = null;
      }

      if (row == null) {
        row = inflater.inflate(R.layout.list_taxi_post_item, parent, false);
        imgStatus = (ImageView) row.findViewById(R.id.imgStatus);
        imgStatus.setOnTouchListener(this);

        imageView = (ImageView) row.findViewById(R.id.imgProfile);
        FrameLayout flImgProfile = (FrameLayout) row.findViewById(R.id.flImgProfile);
        flImgProfile.setOnClickListener(this);
      } else {
        imageView = (ImageView) row.findViewById(R.id.imgProfile);
        imgStatus = (ImageView) row.findViewById(R.id.imgStatus);
      }

      ImageView imgSex = (ImageView) row.findViewById(R.id.imgSex);
      imgSex.setVisibility(ViewGroup.VISIBLE);

      if ("M".equals(item.getUser().getSex())) imgSex.setImageResource(R.drawable.ic_male);
      else if ("F".equals(item.getUser().getSex())) imgSex.setImageResource(R.drawable.ic_female);
      else imgSex.setVisibility(ViewGroup.GONE);

      TextView txtUserName = (TextView) row.findViewById(R.id.txtUserName);
      if (Util.isEmptyString(item.getUser().getUserName())) {
        txtUserName.setText(item.getUser().getUserID());
      } else txtUserName.setText(item.getUser().getUserName());

      if (!Util.isEmptyString(item.getUser().getKakaoID()))
        row.findViewById(R.id.imgKakaoIcon).setVisibility(ViewGroup.VISIBLE);
      else row.findViewById(R.id.imgKakaoIcon).setVisibility(ViewGroup.GONE);

      TextView txtTitle = (TextView) row.findViewById(R.id.txtTitle);
      txtTitle.setText(item.getMessage());

      TextView txtDepartureDateTime = (TextView) row.findViewById(R.id.txtDepartureDateTime);

      if (item.getMessage().indexOf("매일") < 0)
        txtDepartureDateTime.setText(Util.getDepartureDateTime(item.getDepartureDateTime()));
      else txtDepartureDateTime.setText("매일");

      if (item.getUser() != null && !Util.isEmptyString(item.getUser().getProfileImageURL())) {
        ImageLoader.getInstance()
            .displayImage(
                Constants.getThumbnailImageURL() + item.getUser().getProfileImageURL(),
                imageView,
                options);
      } else {
        ImageLoader.getInstance().cancelDisplayTask(imageView);
        imageView.setImageResource(R.drawable.no_image);
      }

      setControlsVisibility(row, item, imgStatus);

      row.setTag(item);
    } catch (Exception ex) {
      delegate.doAction("logException", ex);
    }

    return row;
  }