@SuppressWarnings("unchecked") @Override public View getConvertView(Node node, int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.item_tree_list, parent, false); viewHolder = new ViewHolder(); viewHolder.icon = (ImageView) convertView.findViewById(R.id.treenode_icon); viewHolder.label = (TextView) convertView.findViewById(R.id.treenode_label); viewHolder.user = (TextView) convertView.findViewById(R.id.treenode_user); viewHolder.head = (CircleImageView) convertView.findViewById(R.id.treenode_head); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (node.getIcon() == -1) { viewHolder.icon.setVisibility(View.INVISIBLE); } else { viewHolder.icon.setVisibility(View.VISIBLE); viewHolder.icon.setImageResource(node.getIcon()); } viewHolder.label.setText(node.getName()); ProjectVO vo = (ProjectVO) node.getData(); viewHolder.user.setText(vo.getCREATE_USER_NAME()); imageLoader.displayImage( String.format(URLConstants.URL_IMG, vo.getCREATE_USER_HEAD()), viewHolder.head, options); return convertView; }
@Override public View getView(int position, View itemView, ViewGroup parent) { View v = itemView; if (v == null) { LayoutInflater vi = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.grocery_list_item, null); ViewHolder vh = new ViewHolder(); vh.label = (TextView) v.findViewById(R.id.label); vh.icon = (ImageView) v.findViewById(R.id.icon); v.setTag(vh); } TextView label = ((ViewHolder) v.getTag()).label; Row row = getRow(position); JsonNode item = row.getValueAsNode(); JsonNode itemText = item.get("text"); if (itemText != null) { label.setText(itemText.getTextValue()); } else { label.setText(""); } ImageView icon = ((ViewHolder) v.getTag()).icon; JsonNode checkNode = item.get("check"); if (checkNode != null) { if (checkNode.getBooleanValue()) { icon.setImageResource(R.drawable.list_area___checkbox___checked); } else { icon.setImageResource(R.drawable.list_area___checkbox___unchecked); } } return v; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = null; if (convertView == null) { LayoutInflater inflator = context.getLayoutInflater(); view = inflator.inflate(R.layout.marklist, null); final ViewHolder viewHolder = new ViewHolder(); viewHolder.name = (TextView) view.findViewById(R.id.name); viewHolder.created = (TextView) view.findViewById(R.id.createdAt); viewHolder.lat = (TextView) view.findViewById(R.id.lati); viewHolder.lon = (TextView) view.findViewById(R.id.longi); viewHolder.label = (TextView) view.findViewById(R.id.label); view.setTag(viewHolder); } else { view = convertView; } ViewHolder holder = (ViewHolder) view.getTag(); holder.name.setText(list.get(position).getName()); holder.created.setText(list.get(position).getCreated().toString()); holder.lat.setText( Location.convert(list.get(position).getLat() * 0.000001, Location.FORMAT_SECONDS)); holder.lon.setText( Location.convert(list.get(position).getLon() * 0.000001, Location.FORMAT_SECONDS)); holder.label.setText(list.get(position).getLabel()); return view; }
@Override public View getView(int i, View view, ViewGroup viewGroup) { ViewHolder holder; if (view == null) { holder = new ViewHolder(); view = inflater.inflate(R.layout.list_item_layout, null); holder.key = (TextView) view.findViewById(R.id.key_text2); holder.label = (TextView) view.findViewById(R.id.value_text2); holder.star = (ImageView) view.findViewById(R.id.start_item); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } holder.key.setText(objects.get(i).getLabel()); holder.label.setText(objects.get(i).getValue()); if (!objects.get(i).isFavorite()) { holder.star.setImageDrawable( view.getResources().getDrawable(R.drawable.ic_star_border_black_24dp)); holder.star.setColorFilter(R.color.secondary_text); } return view; }
@Override public View newView(LayoutInflater layoutInflater, ViewGroup parent) { ViewHolder holder = new ViewHolder(); holder.tag = new LinearLayout(mContext); holder.tag.setOrientation(LinearLayout.VERTICAL); holder.tagView = (LinearLayout) layoutInflater.inflate(R.layout.user_info_person_label, parent, false); holder.label = (FlowLayout) holder.tagView.findViewById(R.id.labels); holder.tag.setTag(holder); return holder.tag; }
@Override public View getConvertView( CommonContactNode node, int position, View convertView, ViewGroup parent) { final int index = position; // final CommonContactNode node2 = node; ViewHolder viewHolder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.commoncontact_list_item, parent, false); viewHolder = new ViewHolder(); viewHolder.icon = (ImageView) convertView.findViewById(R.id.id_treenode_icon); viewHolder.label = (TextView) convertView.findViewById(R.id.id_treenode_label); viewHolder.cb = (CheckBox) convertView.findViewById(R.id.item_cb); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (node.getIcon() == -1) { viewHolder.icon.setVisibility(View.INVISIBLE); } else { viewHolder.icon.setVisibility(View.VISIBLE); viewHolder.icon.setImageResource(node.getIcon()); } viewHolder.cb.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { mAllNodes.get(index).isChecked = true; s = ""; int i = 0; for (CommonContactNode n : mAllNodes) { if (n.isChecked && n.getId() > 10000) { i++; s = s + n.getName() + " "; } } s = "(已选" + String.valueOf(i) + "人)" + s; tx.setText(s); } else { mAllNodes.get(index).isChecked = false; s = ""; int i = 0; for (CommonContactNode n : mAllNodes) { if (n.isChecked && n.getId() > 10000) { i++; s = s + n.getName() + " "; } } s = "(已选" + String.valueOf(i) + "人)" + s; tx.setText(s); } List<CommonContactNode> fuckbug = mAllNodes.get(index).getChildren(); if (fuckbug != null) for (CommonContactNode myloly : fuckbug) { myloly.isChecked = isChecked; } notifyDataSetChanged(); } }); viewHolder.label.setText(node.getName()); viewHolder.cb.setChecked(node.isChecked); if (node.isChecked) viewHolder.cb.setChecked(true); else viewHolder.cb.setChecked(false); return convertView; }