@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 int getItemViewType(int position) { ProjectVO vo = (ProjectVO) getItem(position).getData(); return vo.getPARENT_ID().equals(project_id) && !vo.getPROJECT_ID().equals(project_id) ? 0 : 1; }