예제 #1
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;
 }
예제 #2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    RobotEntity entity = entities.get(position);
    int type = entity.getType();
    ViewHolder holder = new ViewHolder();
    // if(convertView==null){
    if (type == RobotEntity.RECEIVER)
      convertView = mInflater.inflate(R.layout.list_item_robot_left, null);
    else if (type == RobotEntity.SEND)
      convertView = mInflater.inflate(R.layout.list_item_robot_right, null);
    holder.tv_content = (TextView) convertView.findViewById(R.id.tv_chatcontent);
    holder.tv_name = (TextView) convertView.findViewById(R.id.tv_username);
    holder.tv_time = (TextView) convertView.findViewById(R.id.tv_sendtime);
    holder.head_photo = (CircularImage) convertView.findViewById(R.id.head_photo);
    convertView.setTag(holder);
    //	}else {
    holder = (ViewHolder) convertView.getTag();
    //	}
    if (entities.get(position).getType() == RobotEntity.RECEIVER) {
      holder.head_photo.setImageResource(R.drawable.logo);
      holder.tv_name.setText("СÁµ");
    } else {
      bais = editPhoto();
      holder.head_photo.setImageDrawable(
          Drawable.createFromStream(bais, entities.get(position).getPhoto()));
      String name = sp.getString("username", "");
      if (name != null) {
        holder.tv_name.setText(name);
      } else holder.tv_name.setText("ÁµÁµ");
    }
    holder.tv_content.setText(entities.get(position).getContent());

    holder.tv_time.setText(entities.get(position).getTime());
    return convertView;
  }
  @Override
  public View getView(final int position, View convertView, ViewGroup arg2) {
    ViewHolder holder;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = mInflater.inflate(R.layout.item_events_message, null);
      holder.tv_message = (TextView) convertView.findViewById(R.id.tv_message);
      holder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    GDMessage msg = list.get(position);
    // 去掉前面的
    // content=来自 跑步群发消息:嘟嘟嘟
    String message = msg.getContent().substring(msg.getContent().indexOf(":") + 1);
    holder.tv_message.setText(message);
    String time = msg.getCreated_at().trim();
    try {
      holder.tv_time.setText(GDUtil.getTimeDiff2(dwf.parse(time)));
    } catch (ParseException e1) {
      e1.printStackTrace();
    }
    return convertView;
  }
예제 #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;
 }
예제 #5
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder h = null;
      if (convertView == null) {
        convertView =
            LayoutInflater.from(getActivity()).inflate(R.layout.item_lv_acty_messagecenter, null);
        h = new ViewHolder();
        h.iv_avatar = (ImageView) convertView.findViewById(R.id.iv_avatar);
        h.tv_username = (TextView) convertView.findViewById(R.id.tv_username);
        h.tv_content = (TextView) convertView.findViewById(R.id.tv_content);
        h.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
        h.tv_unreadCount = (TextView) convertView.findViewById(R.id.tv_unreadcount);
        convertView.setTag(h);
      } else {
        h = (ViewHolder) convertView.getTag();
      }
      MMessage mm = data_message.get(position);

      if (mm.getSenderavatar() != null) {
        ImageLoader.getInstance()
            .displayImage(RestClient.BASE_URL + mm.getSenderavatar(), h.iv_avatar);
      } else {
        ImageLoader.getInstance()
            .displayImage("drawalbe://" + R.drawable.ic_image_load_normal, h.iv_avatar);
      }
      h.tv_content.setText(mm.getBody());
      h.tv_username.setText(mm.getSendername());
      h.tv_time.setText(
          CalendarUtils.getTimeFromat(
              data_message.get(position).getSendtime(), CalendarUtils.TYPE_timeline));
      h.tv_unreadCount.setVisibility(View.GONE);

      if (mm.getSenderid() == 8) { // 系统消息
        h.tv_username.setTextColor(getResources().getColor(R.color.blue_lv_two));
      } else {
        h.tv_username.setTextColor(getResources().getColor(R.color.black));
      }
      if (mm.getUnreadcount() > 0) {
        h.tv_unreadCount.setText(mm.getUnreadcount() + "");
        h.tv_unreadCount.setVisibility(View.VISIBLE);
      }
      return convertView;
    }
예제 #6
0
  @Override
  public View getView(int position, View layout, ViewGroup parent) {
    ViewHolder holder = null;
    if (layout == null) {
      holder = new ViewHolder();
      layout = activity.getLayoutInflater().inflate(R.layout.item_craft_value, null);
      holder.tv_content = (TextView) layout.findViewById(R.id.tv_content);
      holder.tv_name = (TextView) layout.findViewById(R.id.tv_name);
      holder.tv_time = (TextView) layout.findViewById(R.id.tv_time);
      layout.setTag(holder);
    } else {
      holder = (ViewHolder) layout.getTag();
    }
    Comment comment = commentList.get(position);
    holder.tv_content.setText(comment.getAdvise());
    holder.tv_time.setText(comment.getTime());

    holder.tv_name.setText(comment.getComment_craftsman_name());
    return layout;
  }
예제 #7
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder;
   if (convertView == null) {
     holder = new ViewHolder();
     convertView =
         LayoutInflater.from(YuEDetailActivity.this)
             .inflate(R.layout.layout_db_item, parent, false);
     holder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
     holder.tv_bg_title = (TextView) convertView.findViewById(R.id.tv_bg_title);
     holder.tv_bg_content = (TextView) convertView.findViewById(R.id.tv_bg_content);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   MessageBean bean = beans.get(position);
   holder.tv_bg_title.setText(bean.getMessage());
   holder.tv_time.setText(bean.getTime());
   return convertView;
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    final int selectId = position;
    ViewHolder viewHolder = null;
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.os_dhb_syzx_yyy_list_item, null);
      viewHolder = new ViewHolder();
      viewHolder.iv_thumbnail = (ImageView) convertView.findViewById(R.id.iv_thumbnail);
      viewHolder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
      viewHolder.tv_describe = (MarqueeText) convertView.findViewById(R.id.tv_describe);
      viewHolder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
      viewHolder.btn_yyy = (FButton) convertView.findViewById(R.id.btn_yyy);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }

    if (infos.get(position).getSmallpic() != null
        && (infos.get(position).getSmallpic().contains(".jpg")
            || infos.get(position).getSmallpic().contains(".png"))) {
      finalBitmap.display(
          viewHolder.iv_thumbnail,
          infos.get(position).getSmallpic(),
          loadingBitmap,
          loadingBitmap,
          false);
    }
    viewHolder.tv_name.setText(infos.get(position).getTitle());
    viewHolder.tv_describe.setText(infos.get(position).getInfo());
    viewHolder.tv_time.setText(ContextUtil.formateTime(infos.get(position).getBegintime()));
    viewHolder.btn_yyy.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            // 旧流程,先跳转至摇一摇广告页,浏览完广告图后才可进入摇一摇界面
            //				((DhbSyzxShakeListActivity) mContext).getNextAd(
            //						infos.get(selectId).getGgid(), infos.get(selectId)
            //						.getLargepic());

            // 新流程,直接跳转至摇一摇界面
            Intent intent = new Intent(mContext, DhbSyzxShakeActivity.class);
            intent.putExtra("currentGgid", infos.get(selectId).getGgid());
            intent.putExtra("largepic", infos.get(selectId).getLargepic());
            mContext.startActivity(intent);

            //				SimpleDateFormat simpledate = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            //				try {
            //					Date date1 = simpledate.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new
            // Date()));
            //					Date date2 =
            // simpledate.parse(ContextUtil.formateTime(infos.get(selectId).getBegintime()));
            //					Date date3 =
            // simpledate.parse(ContextUtil.formateTime(infos.get(selectId).getEndtime()));
            //					if(date1.getTime()<date2.getTime()){
            //						Toast.makeText(mContext,
            // "活动时间还没到,"+ContextUtil.formateTime(infos.get(selectId).getBegintime())+"开始~",
            // Toast.LENGTH_SHORT).show();
            //					}else if(date1.getTime()>date3.getTime()){
            //						Toast.makeText(mContext, "活动已结束~", Toast.LENGTH_SHORT).show();
            //					}else{
            //						((DhbSyzxShakeListActivity) mContext).getNextAd(
            //								infos.get(selectId).getGgid(), infos.get(selectId)
            //								.getLargepic());
            //					}
            //				} catch (ParseException e) {
            //					// TODO Auto-generated catch block
            //					e.printStackTrace();
            //				}
          }
        });
    return convertView;
  }
  @Override
  public View generateView(final int position, View contentView, ViewGroup parent) {
    final ViewHolder holder;
    if (contentView == null) {
      holder = new ViewHolder();
      contentView = LayoutInflater.from(mContext).inflate(R.layout.listview_item, parent, false);
      holder.swipeLayout = (SwipeLayout) contentView.findViewById(R.id.swipe);
      holder.ll_menu = (LinearLayout) contentView.findViewById(R.id.ll_menu);
      holder.rl_item = (RelativeLayout) contentView.findViewById(R.id.rl_item);
      //			holder.rl_image = (ImageView) contentView.findViewById(R.id.rl_iamge);
      holder.tv_theme = (TextView) contentView.findViewById(R.id.tv_theme);
      holder.tv_time = (TextView) contentView.findViewById(R.id.tv_time);
      holder.tv_adress = (TextView) contentView.findViewById(R.id.tv_adress);

    } else {
      holder = (ViewHolder) contentView.getTag();
    }
    // 当隐藏的删除menu被打开的时候的回调函数
    holder.swipeLayout.addSwipeListener(
        new SimpleSwipeListener() {
          @Override
          public void onOpen(SwipeLayout layout) {
            Toast.makeText(mContext, "Open", Toast.LENGTH_SHORT).show();
          }
        });
    // 双击的回调函数
    holder.swipeLayout.setOnDoubleClickListener(
        new SwipeLayout.DoubleClickListener() {
          @Override
          public void onDoubleClick(SwipeLayout layout, boolean surface) {
            if (holder.swipeLayout.getOpenStatus() == SwipeLayout.Status.Open) {
              Toast.makeText(
                      mContext,
                      "aoe" + (holder.swipeLayout.getOpenStatus() == SwipeLayout.Status.Open),
                      Toast.LENGTH_SHORT)
                  .show();
              holder.swipeLayout.close();
              notifyDataSetChanged();
            }
            Toast.makeText(
                    mContext,
                    "DoubleClick" + (holder.swipeLayout.getOpenStatus() == SwipeLayout.Status.Open),
                    Toast.LENGTH_SHORT)
                .show();
          }
        });
    // 添加删除布局的点击事件
    holder.swipeLayout.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            Toast.makeText(mContext, "###", Toast.LENGTH_SHORT).show();
            System.out.println(holder.swipeLayout.getOpenStatus() == SwipeLayout.Status.Open);
            if (holder.swipeLayout.getOpenStatus() == SwipeLayout.Status.Open) {
              holder.swipeLayout.close();
              notifyDataSetChanged();
            }
          }
        });
    // 添加删除布局的点击事件
    holder.ll_menu.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // 点击完成之后,关闭删除menu
            holder.swipeLayout.close();
            strList.remove(position);
            Toast.makeText(mContext, "删除成功", Toast.LENGTH_SHORT).show();
            notifyDataSetChanged();
          }
        });
    FrameLayout.LayoutParams layoutParam =
        new FrameLayout.LayoutParams(200, FrameLayout.LayoutParams.MATCH_PARENT);
    holder.ll_menu.setLayoutParams(layoutParam);
    return contentView;
  }