Esempio n. 1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.sms_list_item, parent, false);
      holder = new ViewHolder();
      holder.name = (TextView) convertView.findViewById(R.id.name);
      holder.count = (TextView) convertView.findViewById(R.id.count);
      holder.date = (TextView) convertView.findViewById(R.id.date);
      holder.content = (TextView) convertView.findViewById(R.id.content);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.name.setText(smsList.get(position).getAddress());
    holder.count.setText("(" + smsList.get(position).getMsg_count() + ")");

    this.date.setTime(smsList.get(position).getDate());
    holder.date.setText(this.sdf.format(date));

    holder.content.setText(smsList.get(position).getMsg_snippet());

    convertView.setTag(holder);
    return convertView;
  }
Esempio n. 2
0
 /** 初始化View */
 private void initView(ViewHolder holder, View v) {
   holder.image = (NetworkImageView) v.findViewById(R.id.niv_question);
   holder.title = (TextView) v.findViewById(R.id.itemTitle);
   holder.count = (TextView) v.findViewById(R.id.itemCount);
   holder.time = (TextView) v.findViewById(R.id.itemTime);
   holder.size = (TextView) v.findViewById(R.id.itemSize);
   holder.radio = (CheckBox) v.findViewById(R.id.itemChecked);
   holder.mTvItemRightSave = v.findViewById(R.id.tv_item_right_save);
   holder.mTvItemRightDel = v.findViewById(R.id.tv_item_right_del);
   holder.duration = (TextView) v.findViewById(R.id.itemLength);
   v.setTag(holder);
 }
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder = new ViewHolder();
   if (convertView == null) {
     holder = new ViewHolder();
     convertView = mInfolater.inflate(R.layout.item_listview, parent, false);
     holder.mImg = (ImageView) convertView.findViewById(R.id.item_image_dir);
     holder.count = (TextView) convertView.findViewById(R.id.item_dir_count);
     holder.name = (TextView) convertView.findViewById(R.id.item_dir_name);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   holder.mImg.setImageResource(R.mipmap.pic_thumb);
   FolderModel model = getItem(position);
   ImageLoader.getmInstance().loadImage(model.getFirstImagePath(), holder.mImg);
   holder.count.setText(model.getCount() + "张");
   holder.name.setText(model.getName());
   return convertView;
 }
  @Override
  public View getView(final int position, View convertView, final ViewGroup parent) {
    if (convertView == null) {
      convertView =
          ((LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
              .inflate(R.layout.productorder_list_item, parent, false);

      final ViewHolder holder = new ViewHolder();
      holder.image = (ImageView) convertView.findViewById(R.id.image);
      holder.title = (TextView) convertView.findViewById(R.id.title);
      holder.count = (TextView) convertView.findViewById(R.id.count);
      holder.price = (TextView) convertView.findViewById(R.id.price);
      holder.article = (TextView) convertView.findViewById(R.id.article);
      convertView.setTag(holder);
    }
    final ViewHolder holder = (ViewHolder) convertView.getTag();
    final ProductOrder product = getItem(position);

    holder.article.setText(product.getArticle());
    holder.count.setText(product.getCount());
    holder.title.setText(product.getTitle());
    holder.price.setText(product.getPrice());
    holder.image.setImageResource(R.drawable.img_load);
    holder.image.setTag(position);
    roundImage.push(new ImageAddedElement(holder.image, position));
    if (threadLoadImage == null || !threadLoadImage.isAlive()) {
      threadLoadImage = new Thread(runnableLoadImage);
      threadLoadImage.start();
    }

    convertView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            DialogBuilder.getImageProduct(activity, product.getArticle()).show();
          }
        });

    return convertView;
  }
  @SuppressLint("InflateParams")
  @Override
  public View getView(int arg0, View view, ViewGroup arg2) {
    // TODO Auto-generated method stub
    ViewHolder viewHolder;
    if (view == null) {
      view = LayoutInflater.from(notifyListPage).inflate(R.layout.item_delete, null);
      viewHolder = new ViewHolder();
      viewHolder.icon = (ImageView) view.findViewById(R.id.icon);
      viewHolder.title = (TextView) view.findViewById(R.id.title_tx);
      viewHolder.content = (TextView) view.findViewById(R.id.content_tx);
      viewHolder.time = (TextView) view.findViewById(R.id.time_tx);
      viewHolder.count = (TextView) view.findViewById(R.id.count);
      view.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) view.getTag();
    }

    final GotyeNotify notify = (GotyeNotify) getItem(arg0);

    viewHolder.title.setText(notify.getText());
    viewHolder.content.setVisibility(View.GONE);
    viewHolder.icon.setImageResource(R.drawable.contact_group);

    //		switch (notify.getType()) {
    //		case GroupInvite:
    //
    //			if (notify.isRead()) {
    //				viewHolder.reject.setVisibility(View.VISIBLE);
    //				viewHolder.agree.setVisibility(View.GONE);
    //				viewHolder.reject.setText("删除");
    //				viewHolder.reject.setOnClickListener(new OnClickListener() {
    //
    //					@Override
    //					public void onClick(View arg0) {
    //						GotyeAPI.getInstance().deleteNotify(notify);
    //
    //						notifyListPage.refresh();
    //					}
    //				});
    //			} else {
    //				viewHolder.reject.setVisibility(View.VISIBLE);
    //				viewHolder.reject.setOnClickListener(new OnClickListener() {
    //					@Override
    //					public void onClick(View arg0) {
    //						notify.setRead(true);
    //						GotyeAPI.getInstance().markNotifyIsread(notify);
    //						notifyListPage.refresh();
    //					}
    //				});
    //				viewHolder.agree.setVisibility(View.VISIBLE);
    //				viewHolder.agree.setText("加入该群");
    //				viewHolder.agree.setOnClickListener(new OnClickListener() {
    //					@Override
    //					public void onClick(View arg0) {
    //						GotyeAPI.getInstance().joinGroup(
    //								new GotyeGroup(notify.getFrom().Id));
    //						notify.setRead(true);
    //						GotyeAPI.getInstance().markNotifyIsread(notify);
    //						ProgressDialogUtil.showProgress(notifyListPage, "正在加入..");
    //						notifyListPage.refresh();
    //					}
    //				});
    //			}
    //
    //
    //			break;
    //		case JoinGroupReply:
    //
    //			if (notify.isRead()) {
    //				viewHolder.reject.setVisibility(View.VISIBLE);
    //				viewHolder.agree.setVisibility(View.GONE);
    //				viewHolder.reject.setText("删除");
    //				viewHolder.reject.setOnClickListener(new OnClickListener() {
    //
    //					@Override
    //					public void onClick(View arg0) {
    //						GotyeAPI.getInstance().deleteNotify(notify);
    //						notifyListPage.refresh();
    //					}
    //				});
    //			} else {
    //				viewHolder.reject.setVisibility(View.GONE);
    //				viewHolder.agree.setVisibility(View.VISIBLE);
    //				viewHolder.agree.setText("知道了");
    //				viewHolder.agree.setOnClickListener(new OnClickListener() {
    //					@Override
    //					public void onClick(View arg0) {
    //						notify.setRead(true);
    //						GotyeAPI.getInstance().markNotifyIsread(notify);
    //						notifyListPage.refresh();
    //					}
    //				});
    //			}
    //
    //			break;
    //		case JoinGroupRequest:
    //			if (notify.isRead()) {
    //				viewHolder.reject.setVisibility(View.VISIBLE);
    //				viewHolder.agree.setVisibility(View.GONE);
    //				viewHolder.reject.setText("删除");
    //				viewHolder.reject.setOnClickListener(new OnClickListener() {
    //
    //					@Override
    //					public void onClick(View arg0) {
    //						GotyeAPI.getInstance().deleteNotify(notify);
    //						notifyListPage.refresh();
    //					}
    //				});
    //			} else {
    //				viewHolder.reject.setVisibility(View.VISIBLE);
    //				viewHolder.agree.setVisibility(View.VISIBLE);
    //				viewHolder.agree.setText("同意");
    //				viewHolder.agree.setOnClickListener(new OnClickListener() {
    //					@Override
    //					public void onClick(View arg0) {
    //						notify.setRead(true);
    //						GotyeAPI.getInstance().markNotifyIsread(notify);
    //						notifyListPage.refresh();
    //
    //	GotyeAPI.getInstance().replyJoinGroup((GotyeUser)notify.getSender(),(GotyeGroup)notify.getFrom(),"欢迎加入",true);
    //					}
    //				});
    //				viewHolder.reject.setText("拒绝");
    //				viewHolder.reject.setOnClickListener(new OnClickListener() {
    //					@Override
    //					public void onClick(View arg0) {
    //						notify.setRead(true);
    //						GotyeAPI.getInstance().markNotifyIsread(notify);
    //						notifyListPage.refresh();
    //
    //	GotyeAPI.getInstance().replyJoinGroup((GotyeUser)notify.getSender(),(GotyeGroup)notify.getFrom(),"不同意",false);
    //					}
    //				});
    //			}
    //			break;
    //		default:
    //			break;
    //		}

    viewHolder.count.setVisibility(notify.isRead() ? View.GONE : View.VISIBLE);
    return view;
  }
Esempio n. 6
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    final ViewHolder viewHolder;

    if (convertView == null) {
      LayoutInflater inflater = LayoutInflater.from(getContext());
      convertView = inflater.inflate(R.layout.item_drinks_list, parent, false);

      // initialize the view holder
      viewHolder = new ViewHolder();
      viewHolder.drinkIcon = (ImageView) convertView.findViewById(R.id.drinkIcon);
      viewHolder.drinkTitle = (TextView) convertView.findViewById(R.id.drinkTitle);
      viewHolder.minusButton = (Button) convertView.findViewById(R.id.minusButton);
      viewHolder.textView = (TextView) convertView.findViewById(R.id.textView);
      viewHolder.plusButton = (Button) convertView.findViewById(R.id.plusButton);
      viewHolder.count = Integer.parseInt(viewHolder.textView.getText().toString());

      viewHolder.minusButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (viewHolder.count > 0) {
                viewHolder.count--;

                viewHolder.textView.setText("" + viewHolder.count);
                if (viewHolder.drinkTitle.getText().equals("Beer")) {
                  DrinksFragment.setBeerCount(viewHolder.count);
                }
                if (viewHolder.drinkTitle.getText().equals("Shot")) {
                  DrinksFragment.setShotCount(viewHolder.count);
                }
                if (viewHolder.drinkTitle.getText().equals("Cocktail")) {
                  DrinksFragment.setCockCount(viewHolder.count);
                }
              }
            }
          });

      viewHolder.plusButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              viewHolder.count += 1;
              viewHolder.textView.setText("" + viewHolder.count);
              if (viewHolder.drinkTitle.getText().equals("Beer")) {
                DrinksFragment.setBeerCount(viewHolder.count);
              }
              if (viewHolder.drinkTitle.getText().equals("Shot")) {
                DrinksFragment.setShotCount(viewHolder.count);
              }
              if (viewHolder.drinkTitle.getText().equals("Cocktail")) {
                DrinksFragment.setCockCount(viewHolder.count);
              }
            }
          });

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

    // update the item view
    Drinks_ListItem item = getItem(position);
    viewHolder.drinkIcon.setImageDrawable(item.getIcon());
    viewHolder.drinkTitle.setText(item.getTitle());
    return convertView;
  }