@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { viewHolder = new ViewHolder(); convertView = mInflater.inflate(R.layout.home_list_item, null); viewHolder.pictureView = (ImageView) convertView.findViewById(R.id.iv_picture); viewHolder.summary = (TextView) convertView.findViewById(R.id.tv_summary); viewHolder.price = (TextView) convertView.findViewById(R.id.tv_price); viewHolder.publishPPhoto = (ImageView) convertView.findViewById(R.id.iv_publisher_photo); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } ViewData viewData = (ViewData) getItem(position); if (viewData != null) { viewHolder.pictureView.setBackgroundResource(viewData.getImageUrl()); viewHolder.summary.setText(viewData.getSummary()); viewHolder.price.setText("¥" + viewData.getPrice() + "/人"); // viewHolder.publishPPhoto.setBackgroundResource(viewData.getPublishPPhoto()); ImageLoader.getInstance() .displayImage( viewData.getPublishPPhoto(), viewHolder.publishPPhoto, options, new AnimateFirstDisplayListener()); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { viewHolder = new ViewHolder(); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(layoutId, null); viewHolder.gridViewItem = (CardView) convertView.findViewById(R.id.historyOrderItemHOI); viewHolder.price = (TextView) convertView.findViewById(R.id.productPriceHOI); viewHolder.productImage = (ImageView) convertView.findViewById(R.id.productImageHOI); viewHolder.productName = (TextView) convertView.findViewById(R.id.productNameHOI); viewHolder.ratingBar = (RatingBar) convertView.findViewById(R.id.ratingBarGridItemHOI); viewHolder.quantity = (TextView) convertView.findViewById(R.id.productQuantityHOI); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } final ParseObject item = items.get(position); final ParseObject product = item.getParseObject(CART_PRODUCT_ID); final ViewHolder finalViewHolder = viewHolder; Log.w(TAG, position + ""); finalViewHolder.quantity.setText( context.getString(R.string.quantity) + item.getNumber(SHIP_QUANTITY).toString()); imageLoader.displayImage( product.getString(PRODUCT_THUMBNAIL_IMAGE), finalViewHolder.productImage, options); finalViewHolder.productName.setText(product.getString(PRODUCT_NAME)); finalViewHolder.ratingBar.setRating(Float.parseFloat(product.getString(NUMBER_STAR))); finalViewHolder.price.setText( StringProcess.formatPrice((Integer) product.getNumber(PRODUCT_PRICE))); finalViewHolder.gridViewItem.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, ProductDetailActivity.class); intent.putExtra("productName", product.getString(PRODUCT_NAME)); intent.putExtra("productId", product.getObjectId()); context.startActivity(intent); } }); return convertView; }
@Override public View getView(int position, View view, ViewGroup parent) { ViewHolder viewHolder; if (view == null) { view = layoutInflater.inflate(R.layout.events_item, null); viewHolder = new ViewHolder(); viewHolder.name = (TextView) view.findViewById(R.id.event_title); viewHolder.price = (TextView) view.findViewById(R.id.event_price); viewHolder.place = (TextView) view.findViewById(R.id.event_place); viewHolder.time = (TextView) view.findViewById(R.id.event_time); viewHolder.icon = (ImageView) view.findViewById(R.id.event_image); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } EventItem item = getItem(position); /** Sets the icon. */ int iconRes = 0; String category = item.getCategoryID(); if (category.equals("SPORT")) iconRes = (R.drawable.category_sport); else if (category.equals("PERFORMANCES")) iconRes = (R.drawable.category_performances); else if (category.equals("MUSIC")) iconRes = (R.drawable.category_music); else if (category.equals("EXHIBITIONS")) iconRes = (R.drawable.category_exhibitions); else if (category.equals("NIGHTLIFE")) iconRes = (R.drawable.category_nightlife); else if (category.equals("PRESENTATIONS")) iconRes = (R.drawable.category_presentations); else if (category.equals("DEBATE")) iconRes = (R.drawable.category_debate); else if (category.equals("OTHER")) iconRes = (R.drawable.category_other); viewHolder.icon.setImageResource(iconRes); /** Sets the rest of the fields. */ viewHolder.name.setText(item.getTitle()); viewHolder.place.setText(item.getPlaceName()); SimpleTimeFormat time = new SimpleTimeFormat(item.getDateStart()); viewHolder.time.setText(time.getUserTimeDate()); String free = getContext().getString(R.string.free); String cost = item.getPrice() <= 0 ? free : ((int) item.getPrice()) + " kr"; viewHolder.price.setText(cost); return view; }
/** To get valid information which will display in the ViewList */ @Override public View getView(int position, View convertView, ViewGroup parent) { Restaurant score = (Restaurant) this.getItem(position); ViewHolder viewHolder; if (convertView == null) { viewHolder = new ViewHolder(); convertView = inflater.inflate(R.layout.favorite_list_item, null); viewHolder.name = (TextView) convertView.findViewById(R.id.item_name); viewHolder.address = (TextView) convertView.findViewById(R.id.item_address); viewHolder.price = (TextView) convertView.findViewById(R.id.item_price); viewHolder.cuisine = (TextView) convertView.findViewById(R.id.item_cuisine); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.name.setText(score.getName()); viewHolder.price.setText(score.getPrice()); viewHolder.address.setText(score.getAddress()); viewHolder.cuisine.setText(score.getCuisine()); 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; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder vh = null; if (convertView == null) { vh = new ViewHolder(); convertView = inflate(R.layout.common_chat_gift_smile_grid_item); vh.gift = (ImageView) convertView.findViewById(R.id.chat_gift); vh.name = (TextView) convertView.findViewById(R.id.chat_gift_name); vh.price = (TextView) convertView.findViewById(R.id.chat_gift_price); vh.info = (TextView) convertView.findViewById(R.id.chat_gift_info); vh.mask = convertView.findViewById(R.id.mask_view); vh.mask.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) {} }); convertView.setTag(vh); } else { vh = (ViewHolder) convertView.getTag(); } GiftItem item = getItem(position); ModuleMgr.getSmileMgr().reqImage(vh.gift, item.getImg()); vh.name.setText(item.getName()); vh.price.setText("" + item.getPrice() + "钻石"); vh.info.setText(item.getInfo()); if (ModuleMgr.getSmileMgr().getGiftLevel(chatAdapter.getLWhisperId()) < item.getLevel()) { vh.mask.setVisibility(View.VISIBLE); } else { vh.mask.setVisibility(View.GONE); } return convertView; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { viewHolder = null; ItemPartial currentItem = (ItemPartial) getItem(position); if (convertView == null) { LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = layoutInflater.inflate(R.layout.item_list_fragment_adapter, parent, false); viewHolder = new ViewHolder(); viewHolder.tick = convertView.findViewById(R.id.tick); viewHolder.qtyEditText = (EditText) convertView.findViewById(R.id.price_edtxt); viewHolder.itemName = (TextView) convertView.findViewById(R.id.itemname_textview); viewHolder.subHeading = (TextView) convertView.findViewById(R.id.subheading_textview); viewHolder.price = (TextView) convertView.findViewById(R.id.price_textview); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.init(position, currentItem); return convertView; }
/** List view preparation */ public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; final RowItem rowItem = (RowItem) getItem(position); convertView = null; if (convertView == null) { LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.commodity_details_row, parent, false); holder = new ViewHolder(); holder.commodityName = (TextView) convertView.findViewById(R.id.commodityname); holder.varietyName = (TextView) convertView.findViewById(R.id.varietyname); holder.date = (TextView) convertView.findViewById(R.id.date); holder.price = (TextView) convertView.findViewById(R.id.price); holder.unit = (TextView) convertView.findViewById(R.id.unit); holder.id = (TextView) convertView.findViewById(R.id.id); holder.mainCategory = (TextView) convertView.findViewById(R.id.mainCategory); holder.unitTagVALue = (TextView) convertView.findViewById(R.id.unitTypeTagValue); holder.offer = (ImageView) convertView.findViewById(R.id.imageoffer); holder.priceHideOrShow = (ImageView) convertView.findViewById(R.id.imageHideShow); holder.commodityImage = (ImageView) convertView.findViewById(R.id.list_commodity_image); holder.discountPrice = (TextView) convertView.findViewById(R.id.discountPrice); holder.quantity = (TextView) convertView.findViewById(R.id.quantity); holder.discountInPercentage = (TextView) convertView.findViewById(R.id.discountInPercentage); typeface = Typeface.createFromAsset(context.getAssets(), "fonts/Sanchez-Regular_0.ttf"); holder.commodityName.setTypeface(typeface); holder.varietyName.setTypeface(typeface); holder.date.setTypeface(typeface); holder.price.setTypeface(typeface); holder.unit.setTypeface(typeface); holder.id.setTypeface(typeface); holder.discountPrice.setTypeface(typeface); holder.quantity.setTypeface(typeface); holder.discountInPercentage.setTypeface(typeface); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } /*try { if (Build.VERSION.SDK_INT >= 16) { userId.setBackground(customBg); password.setBackground(customBg); } else { userId.setBackgroundDrawable(customBg); password.setBackgroundDrawable(customBg); } } catch (Exception e) { Toast.makeText(getActivity(), "Something wrong..", Toast.LENGTH_LONG).show(); }*/ if (rowItem.getStatusPrice() != null && rowItem.getStatusPrice().equalsIgnoreCase("Hide")) { /* holder.priceHideOrShow.setBackground(context.getResources() .getDrawable(R.drawable.hide2));*/ if (Build.VERSION.SDK_INT >= 16) { holder.priceHideOrShow.setBackground(context.getResources().getDrawable(R.drawable.hide2)); } else { holder.priceHideOrShow.setBackgroundDrawable( context.getResources().getDrawable(R.drawable.hide2)); } } else { /*holder.priceHideOrShow.setBackground(context.getResources() .getDrawable(R.drawable.show2));*/ if (Build.VERSION.SDK_INT >= 16) { holder.priceHideOrShow.setBackground(context.getResources().getDrawable(R.drawable.show2)); } else { holder.priceHideOrShow.setBackgroundDrawable( context.getResources().getDrawable(R.drawable.show2)); } } holder.unitTagVALue.setText(rowItem.getUnitTag()); holder.commodityName.setText(rowItem.getCommodityName()); holder.varietyName.setText(rowItem.getVarietyName()); holder.date.setText(rowItem.getDate()); holder.mainCategory.setText(rowItem.getMainCategory()); holder.price.setText(rupeeSymbol + rowItem.getPrice()); holder.unit.setText(rowItem.getUnit()); holder.id.setText(rowItem.getId()); holder.discountPrice.setText(rupeeSymbol + rowItem.getDiscountPrice()); holder.discountInPercentage.setText(rowItem.getDiscountInPercentage() + " %"); if (!rowItem.getDiscountInPercentage().equalsIgnoreCase("No discount")) { holder.price.setPaintFlags(holder.price.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); holder.offer.setVisibility(View.VISIBLE); holder.discountInPercentage.setVisibility(View.VISIBLE); holder.price.setVisibility(View.VISIBLE); } else { holder.price.setPaintFlags(0); holder.offer.setVisibility(View.GONE); holder.price.setVisibility(View.GONE); holder.discountInPercentage.setVisibility(View.GONE); } holder.commodityImage.setTag(rowItem.getImageURL()); BitmapManager.INSTANCE.loadBitmap(rowItem.getImageURL(), holder.commodityImage, 200, 200); holder.priceHideOrShow.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { try { if (rowItem.getStatusPrice().equalsIgnoreCase("Hide")) { listener.DoTaskCompleted( rowItem.getId().toString(), CommodityDetailsActivity.VENDOR_ID, "Show"); } else { listener.DoTaskCompleted( rowItem.getId().toString(), CommodityDetailsActivity.VENDOR_ID, "Hide"); } } catch (Exception e) { e.printStackTrace(); } } }); holder.commodityImage.setOnClickListener( new OnClickListener() { public void onClick(View v) { if (holder.commodityImage != null) { BitmapDrawable drawable = (BitmapDrawable) holder.commodityImage.getDrawable(); Bitmap bitmap = drawable.getBitmap(); maximizeImage(bitmap); } } }); return convertView; }