@Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    // for each string, inflate an enter_person_item then set the fields appropriately, then add it
    if (convertView == null) {
      viewHolder = new ViewHolder();
      LinearLayout linearLayout = new LinearLayout(cx);
      linearLayout.setOnLongClickListener(peopleListActivity);
      linearLayout.setOnClickListener(peopleListActivity);
      convertView = (LinearLayout) li.inflate(R.layout.list_person_item, linearLayout);
      TextView textView = (TextView) convertView.findViewById(R.id.textView1);
      textView.setWidth(nameTextViewWidth);
      Log.v("TeamLeader", "setting first Name text view width to: " + nameTextViewWidth);

      TextView lastNameTextView = (TextView) convertView.findViewById(R.id.textView2);
      lastNameTextView.setWidth(lastNameTextViewWidth);

      TextView cityTextView = (TextView) convertView.findViewById(R.id.textView3);
      cityTextView.setWidth(cityTextViewWidth);

      viewHolder.ll = (LinearLayout) convertView;
      viewHolder.nameTextView = textView;
      viewHolder.cityTextView = cityTextView;
      viewHolder.lastNameTextView = lastNameTextView;
      viewHolder.person = peopleList.get(position);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }
    viewHolder.nameTextView.setText(peopleList.get(position).getName());
    viewHolder.lastNameTextView.setText(((Person) peopleList.get(position)).getSurname());
    viewHolder.cityTextView.setText(peopleList.get(position).getCity());
    return (convertView);
  }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = LayoutInflater.from(context).inflate(R.layout.item_history_list, null);
      holder.ll = (LinearLayout) convertView.findViewById(R.id.ll);
      holder.iv_icon = (ImageView) convertView.findViewById(R.id.iv_icon);
      holder.tv_title = (TextView) convertView.findViewById(R.id.tv_title);
      holder.tv_content = (TextView) convertView.findViewById(R.id.tv_content);
      holder.btn_share = (Button) convertView.findViewById(R.id.btn_share);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    if (historyList.get(getCount() - position - 1).getType() == 1) {
      holder.iv_icon.setImageResource(R.drawable.browser_icon);
      // holder.tv_title.setText( context.getString( R.string.string_interlinkage ) );
    } else {
      holder.iv_icon.setImageResource(R.drawable.text_icon);
      // holder.tv_title.setText( context.getString( R.string.string_text ) );
    }
    holder.tv_title.setText(historyList.get(getCount() - position - 1).getCurrtime());
    holder.tv_content.setText(historyList.get(getCount() - position - 1).getText());
    holder.ll.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            if (historyList.get(getCount() - position - 1).getType() == 1) {
              Uri uri = Uri.parse(historyList.get(getCount() - position - 1).getText());
              Intent intent = new Intent(Intent.ACTION_VIEW, uri);
              context.startActivity(intent);
            } else {
              AlertDialog.Builder builder = new Builder(context);
              builder.setMessage(historyList.get(getCount() - position - 1).getText());
              builder.setTitle(context.getResources().getString(R.string.string_text));
              builder.setNegativeButton(android.R.string.ok, null);
              AlertDialog dialog = builder.create();
              dialog.show();
            }
          }
        });
    holder.btn_share.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Log.v("QrCode", "share click");
            Intent shareIntent = new Intent(Intent.ACTION_SEND);
            shareIntent.setType("text/plain");
            shareIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.share_title));
            shareIntent.putExtra(
                Intent.EXTRA_TEXT, historyList.get(getCount() - position - 1).getText());
            shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(shareIntent);
          }
        });
    return convertView;
  }
Beispiel #3
0
 @SuppressLint("InflateParams")
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder;
   if (convertView == null) {
     convertView = mInflater.inflate(R.layout.ecard_list_item, null);
     holder = new ViewHolder();
     holder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
     holder.tv_description = (TextView) convertView.findViewById(R.id.tv_description);
     holder.tv_money_deal = (TextView) convertView.findViewById(R.id.tv_money_deal);
     holder.tv_money_remain = (TextView) convertView.findViewById(R.id.tv_money_remain);
     holder.tv_station = (TextView) convertView.findViewById(R.id.tv_station);
     holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
     holder.ll = (LinearLayout) convertView.findViewById(R.id.ll);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   if (position % 2 == 1) {
     holder.ll.setBackgroundColor(0xffcccccc);
   } else {
     holder.ll.setBackgroundColor(0xffffffff);
   }
   ConsumeInfo info = mList.get(position);
   holder.tv_time.setText(info.time);
   holder.tv_description.setText(info.description);
   holder.tv_money_deal.setText(info.money_deal);
   holder.tv_money_remain.setText(info.money_remain);
   holder.tv_station.setText(info.station);
   holder.tv_name.setText(info.name);
   return convertView;
 }
Beispiel #4
0
 @SuppressLint("InflateParams")
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder;
   if (convertView == null) {
     convertView = mInflater.inflate(R.layout.electricity_vp_list_item2, null);
     holder = new ViewHolder();
     holder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
     holder.tv_electricity = (TextView) convertView.findViewById(R.id.tv_electricity);
     holder.tv_money = (TextView) convertView.findViewById(R.id.tv_money);
     holder.tv_type = (TextView) convertView.findViewById(R.id.tv_type);
     holder.ll = (LinearLayout) convertView.findViewById(R.id.ll);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   if (position % 2 == 1) {
     holder.ll.setBackgroundColor(0xffcccccc);
   } else {
     holder.ll.setBackgroundColor(0xffffffff);
   }
   BuyEleInfo info = mList.get(position);
   holder.tv_time.setText(info.time);
   holder.tv_electricity.setText(info.buy);
   holder.tv_money.setText(info.money);
   holder.tv_type.setText(info.type);
   return convertView;
 }
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      View view;
      ViewHolder vh;
      if (convertView == null) {
        view = View.inflate(getActivity(), R.layout.item_mycoarch, null);
        vh = new ViewHolder();
        vh.tv_num = (TextView) view.findViewById(R.id.tv_num);
        vh.gotopay = (ImageView) view.findViewById(R.id.gotopay);
        vh.iv_heart = (ImageView) view.findViewById(R.id.iv_heart);
        vh.tv_mycoach_state = (TextView) view.findViewById(R.id.tv_mycoach_state);
        vh.tv_project = (TextView) view.findViewById(R.id.tv_project);
        vh.tv_online = (TextView) view.findViewById(R.id.tv_online);
        vh.tv_name = (TextView) view.findViewById(R.id.tv_name);
        vh.iv_dot = (ImageView) view.findViewById(R.id.iv_dot);
        vh.iv_header = (CircleImageView) view.findViewById(R.id.iv_header);
        vh.ll = (LinearLayout) view.findViewById(R.id.ll);
        view.setTag(vh);
      } else {
        view = convertView;
        vh = (ViewHolder) view.getTag();
      }
      vh.gotopay.setVisibility(View.GONE);
      vh.tv_num.setVisibility(View.VISIBLE);
      vh.iv_heart.setVisibility(View.VISIBLE);
      vh.tv_num.setText(list1.get(position).praise_num);
      vh.tv_mycoach_state.setText(list1.get(position).price + "元/小时");
      vh.tv_project.setText(list1.get(position).project_type);
      vh.tv_name.setText(list1.get(position).coach_name);
      ImageLoader.getInstance()
          .displayImage(
              "http://112.126.72.250/ut_app" + list1.get(position).head_img, vh.iv_header);
      vh.ll.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {

              final Dialog deleteDialog = new Dialog(getActivity(), R.style.tkdialog);
              View deleteViewDialog =
                  View.inflate(getActivity(), R.layout.layout_contactservice, null);
              ((TextView) deleteViewDialog.findViewById(R.id.tv_content)).setText("确认要移除该喜欢吗?");
              ((TextView) deleteViewDialog.findViewById(R.id.tv_dial)).setText("当然了");
              deleteDialog.setContentView(deleteViewDialog);
              deleteDialog.show();
              deleteViewDialog
                  .findViewById(R.id.ll_dial)
                  .setOnClickListener(
                      new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                          removeMyCoach(position);
                          list1.remove(position);
                          notifyDataSetChanged();
                          deleteDialog.dismiss();
                        }
                      });
              deleteViewDialog
                  .findViewById(R.id.ll_back)
                  .setOnClickListener(
                      new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                          deleteDialog.dismiss();
                        }
                      });
            }
          });
      return view;
    }