@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; View view = convertView; if (view == null) { view = LayoutInflater.from(mContext).inflate(R.layout.adapter_nodelist, parent, false); viewHolder = new ViewHolder(); viewHolder.tvDate = (TextView) view.findViewById(R.id.note_date_text); viewHolder.tvTitle = (TextView) view.findViewById(R.id.note_title_text); viewHolder.tvContent = (TextView) view.findViewById(R.id.note_content_text); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } Note note = noteList.get(position); viewHolder.tvTitle.setText(note.getTitle()); viewHolder.tvContent.setText(note.getContent()); viewHolder.tvDate.setText(note.getDateUpdated()); return view; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.item_listview_fragmentyou, parent, false); holder = new ViewHolder(); holder.ivAvatar = (CircleImageView) convertView.findViewById(R.id.ivAvatar); holder.ivButton = (ImageView) convertView.findViewById(R.id.ivButton); holder.tvContent = (TextView) convertView.findViewById(R.id.ivContent); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } // set content for item YouListViewItem youListViewItem = youListViewItems.get(position); holder.ivAvatar.setImageDrawable(youListViewItem.getAvatar()); holder.ivButton.setImageDrawable(youListViewItem.getButton()); holder.tvContent.setText(youListViewItem.getContent()); // set event for item holder.ivAvatar.setOnClickListener(new ItemsEvent(holder, convertView, position)); holder.ivButton.setOnClickListener(new ItemsEvent(holder, convertView, position)); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ChatMsg entity = coll.get(position); boolean isComMsg = entity.getMsgType(); ViewHolder viewHolder = null; if (convertView == null) { if (isComMsg) { convertView = mInflater.inflate(R.layout.chatting_item_msg_text_left, null); } else { convertView = mInflater.inflate(R.layout.chatting_item_msg_text_right, null); } viewHolder = new ViewHolder(); viewHolder.tvSendTime = (TextView) convertView.findViewById(R.id.tv_sendtime); viewHolder.tvContent = (TextView) convertView.findViewById(R.id.tv_chatcontent); viewHolder.isComMsg = isComMsg; convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.tvSendTime.setText(entity.getDate()); SpannableString spannableString = FaceConversionUtil.getInstace().getExpressionString(context, entity.getText()); viewHolder.tvContent.setText(spannableString); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { final ChatMsgEntity entity = chatLists.get(position); boolean isComMsg = entity.getMsgType(); ViewHolder viewHolder = null; if (convertView == null) { if (isComMsg) { convertView = mInflater.inflate(R.layout.chatting_item_msg_text_left, null); } else { convertView = mInflater.inflate(R.layout.chatting_item_msg_text_right, null); } viewHolder = new ViewHolder(); viewHolder.tvSendTime = (TextView) convertView.findViewById(R.id.tv_sendtime); viewHolder.tvUserName = (TextView) convertView.findViewById(R.id.tv_username); viewHolder.tvContent = (TextView) convertView.findViewById(R.id.tv_chatcontent); viewHolder.tvTime = (TextView) convertView.findViewById(R.id.tv_time); viewHolder.isComMsg = isComMsg; convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.tvSendTime.setText(entity.getDate()); if (entity.getText().contains(".amr")) { viewHolder.tvContent.setText(""); viewHolder.tvContent.setCompoundDrawablesWithIntrinsicBounds( 0, 0, R.drawable.chatto_voice_playing, 0); viewHolder.tvTime.setText(entity.getTime()); } else { viewHolder.tvContent.setText(entity.getText()); viewHolder.tvContent.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); viewHolder.tvTime.setText(""); } viewHolder.tvContent.setOnClickListener( new OnClickListener() { public void onClick(View v) { if (entity.getText().contains(".amr")) { playMusic( android.os.Environment.getExternalStorageDirectory() + "/" + entity.getText()); } } }); viewHolder.tvUserName.setText(entity.getName()); return convertView; }
@SuppressWarnings("unused") @Override public View getView(int arg0, View contentView, ViewGroup arg2) { // TODO Auto-generated method stub LinearLayout layout = null; ViewHolder viewHolder = null; if (layout == null) { layout = (LinearLayout) layoutInflater.inflate(R.layout.pinglun_listview_item, null); viewHolder = new ViewHolder(); viewHolder.tvName = (TextView) layout.findViewById(R.id.pinglunName); viewHolder.tvContent = (TextView) layout.findViewById(R.id.pinglunContent); } else { viewHolder = (ViewHolder) layout.getTag(); } viewHolder.tvContent.setText(allComment.get(arg0).getComment_detail()); viewHolder.tvName.setText(allComment.get(arg0).getComment_name()); return layout; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub final ViewHolder viewHolder; if (null == convertView) { convertView = mInflater.inflate(R.layout.interact_share_item, null); viewHolder = new ViewHolder(); viewHolder.ivIcon = (ImageView) convertView.findViewById(R.id.iv_icon); viewHolder.tvNickName = (TextView) convertView.findViewById(R.id.tv_nick_name); viewHolder.replyBtn = (TextView) convertView.findViewById(R.id.msg_reply_btn); viewHolder.tvContent = (TextView) convertView.findViewById(R.id.tv_content); viewHolder.tvTime = (TextView) convertView.findViewById(R.id.tv_time); viewHolder.msgReplyList = (LinearLayout) convertView.findViewById(R.id.msg_reply_list); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } final ShareBean shareBean = shareBeans.get(position); viewHolder.tvNickName.setText(shareBean.getNickName()); viewHolder.tvContent.setText(shareBean.getTitle()); final Calendar c = Calendar.getInstance(); int mYear = c.get(Calendar.YEAR); // 获取当前年份 int mMonth = c.get(Calendar.MONTH) + 1; // 获取当前月份 int mDay = c.get(Calendar.DAY_OF_MONTH); // 获取当前月份的日期号码 // try // { // String timeY = // DateUtil.Y_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // String timeM = // DateUtil.M_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // String timeD = // DateUtil.D_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // String timeHM = // DateUtil.TIME_H_M_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // String timeString = // DateUtil.M_D_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // if (timeM.startsWith("0")) // { // timeM = timeM.substring(1, timeM.length()); // } // if (timeD.startsWith("0")) // { // timeD = timeD.substring(1, timeD.length()); // } // if (timeY.equals(String.valueOf(mYear)) // && timeM.equals(String.valueOf(mMonth)) // && timeD.equals(String.valueOf(mDay))) // { // viewHolder.tvTime.setText(context.getResources() // .getString(R.string.unit_today) + " " + timeHM); // } // else // { // viewHolder.tvTime.setText(timeString); // } // // } // catch (ParseException e) // { // // TODO Auto-generated catch block // e.printStackTrace(); // } String url = Constant.URL_iconUrl + shareBean.getCreatorPicUrl(); Log.d(TAG, "url-->" + url); bitmapUtilsHead.display( viewHolder.ivIcon, url, new BitmapLoadCallBack<View>() { @Override public void onLoadCompleted( View container, String uri, Bitmap bitmap, BitmapDisplayConfig config, BitmapLoadFrom from) { // TODO Auto-generated method stub viewHolder.ivIcon.setImageBitmap( BitMapUtil.toRoundCorner(bitmap, Constant.BITMAP_PIXELS)); } @Override public void onLoadFailed(View container, String uri, Drawable drawable) { // TODO Auto-generated method stub } }); // bitmapUtilsHead.display(viewHolder.ivIcon, url); viewHolder.ivIcon.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(); // intent.setClass(context, FriendInfoActivity.class); intent.putExtra("userId", shareBean.getCreatorId()); // context.startActivity(intent); Log.d(TAG, "ivIcon.setOnClick---->"); } }); // viewHolder.msgReplyList.setVisibility(View.VISIBLE); // List<String> ss = new ArrayList<String>(); // ss.add("aa"); // ss.add("bb"); // ss.add("cc"); // dynamicAdd(viewHolder.msgReplyList, ss); viewHolder.replyBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Message msg = new Message(); msg.what = Constant.MSG_REPLY; handler.sendMessage(msg); } }); return convertView; }