Ejemplo n.º 1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    HashMap<String, Object> map = (HashMap<String, Object>) mList.get(position);
    ViewHolder holder = null;
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.item_list_phy_search, null);
      holder = new ViewHolder();
      holder.tvName = (TextView) convertView.findViewById(R.id.tv_item_menu_name);

      holder.tvDetail = (TextView) convertView.findViewById(R.id.tv_item_menu_detail);

      holder.tvPrice = (TextView) convertView.findViewById(R.id.tv_item_menu_price);

      holder.tvHostey = (TextView) convertView.findViewById(R.id.tv_item_hostey);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    holder.tvName.setText(map.get("name") + "");
    holder.tvDetail.setText(map.get("detail") + "");
    holder.tvPrice.setText("¥" + map.get("price") + "");
    holder.tvHostey.setText(map.get("hostey") + "");
    return convertView;
  }
Ejemplo n.º 2
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder1;
   if (convertView == null) {
     holder1 = new ViewHolder();
     convertView =
         LayoutInflater.from(context)
             .inflate(R.layout.common_views_popup_window_item, parent, false);
     convertView.setBackgroundResource(R.drawable.popup_window_left_item_bg);
     holder1.tvName = (TextView) convertView.findViewById(R.id.popup_window_item_name_tv);
     holder1.vDivider = convertView.findViewById(R.id.popup_window_item_divider);
     convertView.setTag(holder1);
   } else {
     holder1 = (ViewHolder) convertView.getTag();
   }
   //			TextView tvName = (TextView) convertView.findViewById(R.id.popup_window_item_name_tv);
   holder1.tvName.setBackgroundResource(R.drawable.popup_window_left_item_bg); // 设置左侧List 点击效果
   //	View vDivider = convertView.findViewById(R.id.shop_sort_item_divider);
   holder1.vDivider.setVisibility(View.GONE);
   String sortName = (String) getItem(position);
   //
   if (position == curPositionLeft) {
     holder1.tvName.setBackgroundColor(Color.rgb(0xff, 0xff, 0xff));
     //				vDivider.setBackgroundColor(Color.rgb(235, 65, 62));
   } else {
     holder1.tvName.setBackgroundColor(Color.rgb(0xf0, 0xf0, 0xf0));
     //				vDivider.setBackgroundColor(Color.rgb(217, 217, 217));
   }
   holder1.tvName.setText(sortName);
   return convertView;
 }
Ejemplo n.º 3
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder2;
      if (convertView == null) {
        holder2 = new ViewHolder();
        convertView =
            LayoutInflater.from(context)
                .inflate(R.layout.common_views_popup_window_item, parent, false);
        holder2.tvName = (TextView) convertView.findViewById(R.id.popup_window_item_name_tv);
        holder2.vDivider = convertView.findViewById(R.id.popup_window_item_divider);
        convertView.setTag(holder2);
      } else {
        holder2 = (ViewHolder) convertView.getTag();
      }
      //			TextView tvName = (TextView) convertView.findViewById(R.id.popup_window_item_name_tv);
      //			//			tvName.setBackgroundResource(R.drawable.popup_window_left_item_bg);//设置左侧List 点击效果
      //			View vDivider = convertView.findViewById(R.id.popup_window_item_divider);

      String sortName = (String) getItem(position);
      //
      if (position == curPositionRight && curNameRight.equals(sortName) /*
																			  * &&!
																			  * leftPositionIsChange
																			  */) {
        //				isFirstInRight=false;
        holder2.tvName.setTextColor(Color.rgb(235, 65, 62));
        holder2.vDivider.setBackgroundColor(Color.rgb(235, 65, 62));
      } else {
        holder2.tvName.setTextColor(Color.rgb(50, 50, 50));
        holder2.vDivider.setBackgroundColor(Color.rgb(217, 217, 217));
      }
      holder2.tvName.setText(sortName);
      return convertView;
    }
Ejemplo n.º 4
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder viewHolder = null;
   if (convertView == null) {
     viewHolder = new ViewHolder();
     convertView = mLayoutInflater.inflate(R.layout.layout_score, parent, false);
     convertView.setTag(viewHolder);
   } else {
     viewHolder = (ViewHolder) convertView.getTag();
   }
   viewHolder.tvId = (TextView) convertView.findViewById(R.id.tv_id);
   viewHolder.tvName = (TextView) convertView.findViewById(R.id.tv_name);
   viewHolder.tvLevel = (TextView) convertView.findViewById(R.id.tv_level);
   viewHolder.tvMoney = (TextView) convertView.findViewById(R.id.tv_money);
   MoneyModel money = getItem(position);
   if (money.getMac().equals(GameUtility.getMacAddress())) {
     viewHolder.tvId.setTextColor(mColorMe);
     viewHolder.tvName.setTextColor(mColorMe);
     viewHolder.tvMoney.setTextColor(mColorMe);
     viewHolder.tvLevel.setTextColor(mColorMe);
   } else {
     viewHolder.tvId.setTextColor(mColorText);
     viewHolder.tvName.setTextColor(mColorText);
     viewHolder.tvMoney.setTextColor(mColorText);
     viewHolder.tvLevel.setTextColor(mColorText);
   }
   viewHolder.tvId.setText(money.getId());
   viewHolder.tvName.setText(money.getName());
   viewHolder.tvLevel.setText(money.getLevel());
   viewHolder.tvMoney.setText(money.getMoney() + " $");
   return convertView;
 }
Ejemplo n.º 5
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    Ticket ticket = getItem(position);

    if (convertView == null) {
      convertView = View.inflate(getContext(), R.layout.adapter_inventory, null);
      viewHolder = new ViewHolder();
      viewHolder.tvName = (TextView) convertView.findViewById(R.id.tvName);
      viewHolder.tvSerial = (TextView) convertView.findViewById(R.id.tvSerial);
      viewHolder.tvPark = (TextView) convertView.findViewById(R.id.tvPark);
      viewHolder.tvKey = (TextView) convertView.findViewById(R.id.tvKey);
      viewHolder.tvModel = (TextView) convertView.findViewById(R.id.tvModel);
      viewHolder.ivType = (ImageView) convertView.findViewById(R.id.ivType);
      viewHolder.vColor = (ImageView) convertView.findViewById(R.id.vColor);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }

    getColor(ticket.getColor().toLowerCase());
    viewHolder.tvName.setText(ticket.getName());
    viewHolder.tvSerial.setText(ticket.getSerial());
    viewHolder.tvModel.setText(ticket.getModel());
    viewHolder.tvPark.setText(ticket.getParkLocation());
    viewHolder.tvKey.setText(ticket.getKeyLocation());
    getType(ticket.getType());

    return convertView;
  }
Ejemplo n.º 6
0
  // @SuppressLint("UseValueOf")
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    // 观察convertView随ListView滚动情况
    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.manage_collection_lv_layout, null);
      holder = new ViewHolder();
      // 得到各个控件的对象
      holder.tvIcon = (ImageView) convertView.findViewById(R.id.manage_iv_icon);
      holder.tvName = (TextView) convertView.findViewById(R.id.manage_tv_name);
      holder.proessBarStarLevel =
          (RatingBar) convertView.findViewById(R.id.manage_ratingbar_starlevel);
      holder.tvStarLevel = (TextView) convertView.findViewById(R.id.manage_tv_startlevel);
      holder.tvDowntimes = (TextView) convertView.findViewById(R.id.manage_tv_downtimes);
      holder.tvSize = (TextView) convertView.findViewById(R.id.manage_tv_size);
      holder.btnDownInstall = (Button) convertView.findViewById(R.id.manage_btn_downinstall);
      holder.btnDelete = (Button) convertView.findViewById(R.id.manage_btn_delcollection);
      holder.proessBarStarLevel.setMax(5);
      // 绑定ViewHolder对象
      convertView.setTag(holder);
    } else {
      // 取出ViewHolder对象
      holder = (ViewHolder) convertView.getTag();
    }
    CollectionInfo gameInfo = (CollectionInfo) group.get(position);
    if (null != gameInfo) {
      holder.tvName.setText(gameInfo.getName());

      holder.proessBarStarLevel.setProgress((int) Float.parseFloat(gameInfo.getStarLevel()));
      holder.tvStarLevel.setText(gameInfo.getStarLevel() + mContext.getString(R.string.game_share));
      holder.tvSize.setText(
          String.valueOf(StringTool.StringToFloat(gameInfo.getSize()))
              + mContext.getString(R.string.game_MB));
      holder.tvDowntimes.setText(
          String.valueOf(gameInfo.getDownCounts()) + mContext.getString(R.string.game_down_num));
      bindRoundImg(gameInfo.getIconMin(), holder.tvIcon, 10);
      convertView.setOnClickListener(detail);
      // 为下载安装按钮提供监听
      holder.btnDownInstall.setOnClickListener(new DownLoadorInstallListern());
      // 为移除收藏提供监听
      holder.btnDelete.setOnClickListener(new CollectionDeleteListern());
    }
    convertView.setTag(convertView.getId(), Integer.valueOf(position));
    // 为每个按钮设置一个tag..
    holder.btnDownInstall.setTag(Integer.valueOf(position));
    holder.btnDelete.setTag(Integer.valueOf(position));
    return convertView;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    layoutInflater = LayoutInflater.from(context);
    if (convertView == null) {
      convertView = layoutInflater.inflate(R.layout.fragment_hashtag_list_item, null);
      viewHolder = new ViewHolder();
      viewHolder.ivPor = (ImageView) convertView.findViewById(R.id.fragment_hahstag_list_item_iv1);
      //            viewHolder.ivEvent = (ImageView) convertView
      //
      viewHolder.ifFixed =
          (ImageView) convertView.findViewById(R.id.fragment_hahstag_list_item_iv3);
      viewHolder.ibLike = (ImageView) convertView.findViewById(R.id.fragment_hashtag_list_item_iv2);
      viewHolder.tvEvent = (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv2);
      viewHolder.tvName = (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv1);
      viewHolder.tvEvent = (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv2);
      viewHolder.tvLocation =
          (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv3);
      viewHolder.tvTime = (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv4);

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

    Bitmap bmp = BitmapFactory.decodeResource(context.getResources(), R.mipmap.btn_follow);
    viewHolder.ibLike.setImageBitmap(
        ImageUtilities.getRoundedCroppedBitmap(
            bmp, (int) (context.getResources().getDimension(R.dimen.img_width))));
    byte[] bitmapBytes = (byte[]) list.get(position).get(POSTERIMG);
    String bmpStr = new String(bitmapBytes, Charset.defaultCharset());
    Bitmap bmpPor = ImageUtilities.decodeBase64(bmpStr);
    viewHolder.ivPor.setImageBitmap(
        ImageUtilities.getRoundedCroppedBitmap(
            bmpPor, (int) (context.getResources().getDimension(R.dimen.img_width))));
    setStatus(viewHolder.ifFixed, (String) list.get(position).get(IFFIXED));
    viewHolder.tvName.setText(
        (String) list.get(position).get(DEPARTMENT)
            + " "
            + (String) list.get(position).get(STUDENT_NAME));
    viewHolder.tvEvent.setText("Events: " + (String) list.get(position).get(EVENTS));
    viewHolder.tvLocation.setText("Location: " + (String) list.get(position).get(LOCATION));
    viewHolder.tvTime.setText(
        "Time: " + TimeUtilities.StringToTime((String) list.get(position).get(TIME)));
    return convertView;
  }
  public View getView(final int position, View view, ViewGroup arg2) {
    ViewHolder viewHolder = null;
    if (view == null) {
      viewHolder = new ViewHolder();
      view = LayoutInflater.from(mContext).inflate(R.layout.game_gift_item, null);
      viewHolder.tvName = (TextView) view.findViewById(R.id.tv_gift_name);

      viewHolder.btnMoreInfo = (Button) view.findViewById(R.id.btn_gift_receive);

      view.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) view.getTag();
    }
    viewHolder.tvName.setText(this.mBetaInfos.get(position).getgNameStr());
    viewHolder.btnMoreInfo.setVisibility(View.GONE);

    return view;
  }
Ejemplo n.º 9
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder = null;

      if (convertView == null) {
        convertView = View.inflate(AntivirusActivity.this, R.layout.item_virus_info, null);

        holder = new ViewHolder();

        convertView.setTag(holder);

        holder.ivIcon = (ImageView) convertView.findViewById(R.id.item_iv_virus_icon);
        holder.tvName = (TextView) convertView.findViewById(R.id.item_tv_virus_name);
        holder.tvIsvirus = (TextView) convertView.findViewById(R.id.item_tv_virus_isvirus);
        holder.ivKill = (ImageView) convertView.findViewById(R.id.item_iv_virus_kill);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      final AppInfo info = mDatas.get(position);
      holder.ivIcon.setImageDrawable(info.icon);
      holder.tvName.setText(info.name);
      holder.tvIsvirus.setText(info.isVirus ? "病毒" : "安全");
      holder.tvIsvirus.setTextColor(info.isVirus ? Color.RED : Color.GREEN);

      holder.ivKill.setVisibility(info.isVirus ? View.VISIBLE : View.INVISIBLE);

      if (info.isVirus) {
        holder.ivKill.setOnClickListener(
            new OnClickListener() {

              @Override
              public void onClick(View v) {
                Intent intent = new Intent();
                intent.setAction("android.intent.action.DELETE");
                intent.addCategory("android.intent.category.DEFAULT");
                intent.setData(Uri.parse("package:" + info.packageName));
                startActivity(intent);
              }
            });
      }

      return convertView;
    }
Ejemplo n.º 10
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;

    if (convertView == null) {
      if (isUseGridLayout) {
        convertView = inflater.inflate(R.layout.layout_student_item, parent, false);
      } else {
        convertView = inflater.inflate(R.layout.layout_student_list_item, parent, false);
      }
      viewHolder = new ViewHolder();
      viewHolder.tvName = (TextView) convertView.findViewById(R.id.tvStudentName);
      viewHolder.imgAvatar = (CircularImageView) convertView.findViewById(R.id.imgStudentAvatar);
      viewHolder.imgAvatar.setImageDrawable(
          context.getResources().getDrawable(R.drawable.img_black));
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }

    Student.Entity item = (Student.Entity) getItem(position);

    if (isUseGridLayout) {
      viewHolder.tvName.setText(item.getFirstName());
      viewHolder.imgAvatar.setAlpha(0.7f);
    } else {
      viewHolder.tvName.setText(String.format("%s %s", item.getFirstName(), item.getLastName()));
    }

    Picasso.with(context).cancelRequest(viewHolder.imgAvatar);

    if (!item.getAvatar().isEmpty()) {
      Picasso.with(context).load(item.getAvatar()).into(viewHolder.imgAvatar);
    } else {
      if (isUseGridLayout) {
        viewHolder.imgAvatar.setImageDrawable(null);
      } else {
        viewHolder.imgAvatar.setImageDrawable(
            context.getResources().getDrawable(R.drawable.img_black));
      }
    }

    return convertView;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    final ViewHolder viewHolder;
    if (convertView == null) {

      convertView = super.layoutInflater.inflate(R.layout.list_item, null);
      viewHolder = new ViewHolder();
      viewHolder.ivPic = (ImageView) convertView.findViewById(R.id.iv_pic);
      viewHolder.tvName = (TextView) convertView.findViewById(R.id.tv_name);

      convertView.setTag(viewHolder);
    } else {

      viewHolder = (ViewHolder) convertView.getTag();
    }

    // TODO 接下去对数据进行绑定...

    return convertView;
  }
Ejemplo n.º 12
0
  @SuppressWarnings("unused")
  @Override
  public View getView(int arg0, View contentView, ViewGroup arg2) {
    // TODO Auto-generated method stub
    LinearLayout layout = null;

    ViewHolder viewHolder = null;
    if (layout == null) {
      layout = (LinearLayout) layoutInflater.inflate(R.layout.pinglun_listview_item, null);

      viewHolder = new ViewHolder();
      viewHolder.tvName = (TextView) layout.findViewById(R.id.pinglunName);
      viewHolder.tvContent = (TextView) layout.findViewById(R.id.pinglunContent);
    } else {
      viewHolder = (ViewHolder) layout.getTag();
    }

    viewHolder.tvContent.setText(allComment.get(arg0).getComment_detail());
    viewHolder.tvName.setText(allComment.get(arg0).getComment_name());
    return layout;
  }
Ejemplo n.º 13
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    ViewHolder holder;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView =
          ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
              .inflate(R.layout.local_all_pic_item, parent, false);
      holder.iv = (ImageView) convertView.findViewById(R.id.id_listview_imageview);
      holder.tvCount = (TextView) convertView.findViewById(R.id.id_listview_count);
      holder.tvName = (TextView) convertView.findViewById(R.id.id_listview_name);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    ImageBean bean = mDatas.get(position);
    holder.tvCount.setText(bean.getCount() + "张");
    holder.tvName.setText(bean.getName() + "");
    holder.iv.setImageResource(R.drawable.pictures_no);
    ImageLoader.getInstance(3, ImageLoader.Type.LIFO).loadImage(bean.getFirstImage(), holder.iv);

    return convertView;
  }
Ejemplo n.º 14
0
  @Override
  public View getView(
      final HashMap<String, Object> user, View convertView, final ViewGroup parent) {

    ViewHolder viewHolder;
    if (convertView == null) {
      viewHolder = new ViewHolder();
      LayoutInflater inflater = LayoutInflater.from(parent.getContext());
      int resId = getLayoutRes(parent.getContext(), "smssdk_contacts_listview_item");
      convertView = inflater.inflate(resId, null);
      resId = getIdRes(parent.getContext(), "iv_contact");
      viewHolder.ivContact = (AsyncImageView) convertView.findViewById(resId);
      resId = getIdRes(parent.getContext(), "tv_name");
      viewHolder.tvName = (TextView) convertView.findViewById(resId);
      resId = getIdRes(parent.getContext(), "tv_contact");
      viewHolder.tvContact = (TextView) convertView.findViewById(resId);
      resId = getIdRes(parent.getContext(), "btn_add");
      viewHolder.btnAdd = (Button) convertView.findViewById(resId);
      resId = getIdRes(parent.getContext(), "rl_lv_item_bg");
      viewHolder.bg = convertView.findViewById(resId);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }

    if (user != null) {
      // 如果user包含“fia”,则为应用内好友
      if (user.containsKey("fia")) {
        viewHolder.tvName.setText(String.valueOf(user.get("nickname")));
        viewHolder.tvContact.setVisibility(View.VISIBLE);
        String dspName = (String) user.get("displayname");
        if (TextUtils.isEmpty(dspName)) {
          viewHolder.tvContact.setText(String.valueOf(user.get("phone")));
        } else {
          viewHolder.tvContact.setText(dspName);
        }
        int resId = getStringRes(parent.getContext(), "smssdk_add_contact");
        if (resId > 0) {
          viewHolder.btnAdd.setText(resId);
        }
      } else {
        String dspName = (String) user.get("displayname");
        if (TextUtils.isEmpty(dspName)) {
          @SuppressWarnings("unchecked")
          ArrayList<HashMap<String, Object>> phones =
              (ArrayList<HashMap<String, Object>>) user.get("phones");
          if (phones != null && phones.size() > 0) {
            String cp = (String) phones.get(0).get("phone");
            viewHolder.tvName.setText(cp);
          }
        } else {
          viewHolder.tvName.setText(dspName);
        }
        viewHolder.tvContact.setVisibility(View.GONE);
        int resId = getStringRes(parent.getContext(), "smssdk_invite");
        if (resId > 0) {
          viewHolder.btnAdd.setText(resId);
        }
      }

      viewHolder.bg.setBackgroundColor(0xffffffff);
      // 是否有新好友,如有,改变背景颜色
      if (user.containsKey("isnew")) {
        boolean isNew = Boolean.valueOf(String.valueOf(user.get("isnew")));
        if (isNew) {
          viewHolder.bg.setBackgroundColor(0xfff7fcff);
        }
      }

      String iconUrl = user.containsKey("avatar") ? (String) user.get("avatar") : null;
      // 设置默认头像,如果有url,就去下载
      int resId = getBitmapRes(parent.getContext(), "smssdk_cp_default_avatar");
      if (resId > 0) {
        viewHolder.ivContact.execute(null, resId);
      }
      if (!TextUtils.isEmpty(iconUrl)) {
        Log.w(String.valueOf(user.get("displayname")) + " icon url ==>> ", iconUrl);
        Bitmap bm = BitmapProcessor.getBitmapFromCache(iconUrl);
        if (bm != null && !bm.isRecycled()) {
          viewHolder.ivContact.setImageBitmap(bm);
        } else {
          viewHolder.ivContact.execute(iconUrl);
        }
      }

      viewHolder.btnAdd.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              if (user.containsKey("fia")) {
                // 在这里添加第一组的按钮事件
                Toast.makeText(parent.getContext(), String.valueOf(user), Toast.LENGTH_SHORT)
                    .show();
              } else {
                ContactDetailPage contactDetailPage = new ContactDetailPage();
                contactDetailPage.setContact(user);
                contactDetailPage.show(parent.getContext(), null);
              }
            }
          });
    }
    return convertView;
  }
Ejemplo n.º 15
0
    @SuppressLint("NewApi")
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      final Order data = buyList.get(position);
      ViewHolder holder;
      if (convertView == null) {
        holder = new ViewHolder();
        convertView =
            LayoutInflater.from(context).inflate(R.layout.search_source_listview_item, null);
        holder.tvPlace =
            (TextView)
                convertView.findViewById(
                    R.id.search_source_listview_item_tv_departrue_and_destination);
        holder.tvCarState =
            (TextView) convertView.findViewById(R.id.search_source_listview_item_tv_car_state);
        holder.ivIsEfficacy =
            (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_isEfficacy);
        holder.ivShopping =
            (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_shopping);
        holder.ivColletion =
            (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_colletion);
        holder.tvEqualTitle =
            (TextView) convertView.findViewById(R.id.search_source_listview_item_tv_equaltitle);
        holder.tvDate =
            (TextView) convertView.findViewById(R.id.serch_source_listview_item_tv_date);
        holder.tvDescribe =
            (TextView) convertView.findViewById(R.id.serch_source_listview_item_tv_describe);
        holder.tvDeal = (TextView) convertView.findViewById(R.id.serch_source_listview_item_deal);
        holder.tvName =
            (TextView) convertView.findViewById(R.id.search_source_listview_item_company_name);
        holder.llStar =
            (LinearLayout) convertView.findViewById(R.id.search_source_listview_item_ll_star);
        holder.spinner = (ProgressBar) convertView.findViewById(R.id.download_progressBar);
        holder.imDownload =
            (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_company_logo);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      final ImageView imageView = holder.imDownload;
      final ProgressBar progressBar = holder.spinner;
      setShareImgPath(data.getIconUrl(), imageView, progressBar);
      holder.tvName.setText(data.getCompanyName());
      holder.tvEqualTitle.setText("¥" + data.getTransportPrice() + "元");
      holder.tvPlace.setText(data.getDeparture() + " 至 " + data.getArrival());
      holder.tvDate.setText(
          "承运日期:"
              + dateStringtoString(data.getAcceptStartTime())
              + " 至 "
              + dateStringtoString(data.getAcceptEndTime()));
      String describe = "";
      String type = data.getInfoType();
      if (type != null) {
        if (type.equals("car")) {
          describe = "[运力]";
        } else if (type.equals("line")) {
          describe = "[路线]";
        } else if (type.equals("goods")) {
          describe = "[物品]";
        }
      }
      holder.tvDeal.setText("成交单数:" + data.getOrderCount());
      holder.tvDescribe.setText(describe + data.getInfoName());
      holder.tvCarState.setVisibility(View.VISIBLE);
      final int index = position;
      switch (data.getExecuteState()) {
        case 100:
          holder.tvCarState.setText("同意发车"); // bn
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));

          break;
        case 0:
          holder.tvCarState.setText("同意发车"); // n
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.btn_orange_bg));
          holder.tvCarState.setOnClickListener(
              new OnClickListener() {

                @Override
                public void onClick(View v) {
                  CarDepartureAllowRequest req1 = new CarDepartureAllowRequest();
                  req1.setOrderCode(data.getOrderCode());
                  sendCarRequest(req1, index);
                }
              });
          break;
        case 1:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));
          break;
        case 2:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));
          break;
        case 3:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));
          break;
        case 4:
          holder.tvCarState.setText("同意结算"); // n
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.btn_orange_bg));
          holder.tvCarState.setOnClickListener(
              new OnClickListener() {

                @Override
                public void onClick(View v) {
                  Intent intent = new Intent(context, AgreePayForActivity.class);

                  intent.putExtra(AgreePayForActivity.ORDERID, data.getOrderCode());
                  intent.putExtra(AgreePayForActivity.AMOUNT, data.getTransportPrice());
                  startActivity(intent);
                }
              });
          break;
        case 5:
          holder.tvCarState.setText("同意结算"); // n
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.btn_orange_bg));
          holder.tvCarState.setOnClickListener(
              new OnClickListener() {

                @Override
                public void onClick(View v) {
                  //						SettlementAllowRequest req3 = new SettlementAllowRequest();
                  //						req3.setOrderCode(data.getOrderCode());
                  //						sendCarRequest(req3, index);
                  Intent intent = new Intent(context, AgreePayForActivity.class);

                  intent.putExtra(AgreePayForActivity.ORDERID, data.getOrderCode());
                  intent.putExtra(AgreePayForActivity.AMOUNT, data.getTransportPrice());
                  startActivity(intent);
                }
              });
          holder.tvCarState.setVisibility(View.GONE);
          break;
        case 6:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setVisibility(View.GONE);
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));
          break;
        case 7:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setVisibility(View.GONE);
          break;

        default:
          break;
      }

      holder.ivShopping.setVisibility(View.GONE);
      holder.ivColletion.setVisibility(View.GONE);
      final String state = holder.tvCarState.getText().toString();

      return convertView;
    }
Ejemplo n.º 16
0
  // Translates a particular `Image` given a position
  // into a relevant row within an AdapterView
  @Override
  public View getView(int position, View convertView, final ViewGroup parent) {
    // Get the data item for this position
    final Tweet tweet = getItem(position);
    // Check if an existing view is being reused, otherwise inflate the view
    ViewHolder viewHolder; // view lookup cache stored in tag
    if (convertView == null) {
      viewHolder = new ViewHolder();
      LayoutInflater inflater =
          (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      convertView = inflater.inflate(R.layout.item_tweet, parent, false);
      viewHolder.ivProfileImage = (ImageView) convertView.findViewById(R.id.ivProfileImage);
      viewHolder.tvScreenName = (TextView) convertView.findViewById(R.id.tvScreenName);
      viewHolder.tvName = (TextView) convertView.findViewById(R.id.tvName);
      viewHolder.tvBody = (TextView) convertView.findViewById(R.id.tvBody);
      viewHolder.tvRelativeTimeStamp =
          (TextView) convertView.findViewById(R.id.tvRelativeTimeStamp);

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

    if (position % 2 == 1) {
      convertView.setBackgroundColor(Color.parseColor("#f1f1f1"));
    } else {
      convertView.setBackgroundColor(Color.parseColor("#fafafa"));
    }

    final String screenName = tweet.getUser().getScreenName();
    // Populate data into the template view using the data object
    viewHolder.tvScreenName.setText(Html.fromHtml("@" + tweet.getUser().getScreenName()));
    viewHolder.tvName.setText(Html.fromHtml(tweet.getUser().getName()));
    viewHolder.tvBody.setText(tweet.getBody());
    viewHolder.ivProfileImage.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            activity.onProfileView(screenName);
          }
        });

    ImageView ivReply = (ImageView) convertView.findViewById(R.id.ivReply);
    ivReply.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            activity.replyToTweet(tweet);
          }
        });

    ImageView ivRetweet = (ImageView) convertView.findViewById(R.id.ivRetweet);
    ivRetweet.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            activity.reTweet(tweet);
          }
        });
    try {
      SimpleDateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
      String currDateStr = df.format(Calendar.getInstance().getTime());
      Date currDate = df.parse(currDateStr);

      Date tweetDate = getTimeStamp(tweet.getCreatedAt());
      String timeStamp = getRelativeTimeStamp(currDate, tweetDate);
      viewHolder.tvRelativeTimeStamp.setText(timeStamp);
      Transformation transformation =
          new RoundedTransformationBuilder()
              .borderColor(Color.BLACK)
              // .borderWidthDp(0)
              .cornerRadiusDp(10)
              .oval(false)
              .build();

      Picasso.with(getContext())
          .load(Uri.parse(tweet.getUser().getProfileImageUrl()))
          /*.placeholder(R.drawable.ic_nocover)*/
          .transform(transformation)
          .into(viewHolder.ivProfileImage);
    } catch (ParseException e) {
      e.printStackTrace();
    }

    // Return the completed view to render on screen
    return convertView;
  }