@Override public View getView(int position, View convertView, ViewGroup parent) { CommentMyListItem commentMyListItem = null; if (convertView == null) { commentMyListItem = new CommentMyListItem(); convertView = this.inflater.inflate(R.layout.comment_my_list, null); commentMyListItem.userheader = (ImageView) convertView.findViewById(R.id.user_comment_header); commentMyListItem.username = (TextView) convertView.findViewById(R.id.user_name); commentMyListItem.time = (TextView) convertView.findViewById(R.id.comment_ctime); commentMyListItem.content = (TextView) convertView.findViewById(R.id.comment_content); commentMyListItem.myComment = (TextView) convertView.findViewById(R.id.comment_receive_me); convertView.setTag(commentMyListItem); } else { commentMyListItem = (CommentMyListItem) convertView.getTag(); } LinearLayout layout = (LinearLayout) convertView.findViewById(R.id.weibo_data); // this.loadingHeader(position, commentMyListItem.userheader); ReceiveComment comment = this.getItem(position); // mHeadImageFetcher.loadImage(comment.getHeadUrl(), commentMyListItem.userheader); mNetComTools.loadNetImage( commentMyListItem.userheader, comment.getHeadUrl(), R.drawable.header, mHeadImageSize, mHeadImageSize); layout.setTag(comment.getStatus()); commentMyListItem.username.setText(comment.getUname()); try { commentMyListItem.time.setText(TimeHelper.friendlyTimeFromeStringTime(comment.getcTime())); System.out.println(" ctime" + comment.getcTime()); } catch (Exception e) { commentMyListItem.time.setText(comment.getcTime()); } SpannableString ss = new SpannableString(SociaxUIUtils.filterHtml(comment.getContent())); SociaxUIUtils.highlightContent(mContext, ss); commentMyListItem.content.setText(ss); if (comment.isNullForReplyComment()) { SpannableString ss1 = new SpannableString( "回复我的微博:" + SociaxUIUtils.filterHtml(comment.getStatus().getContent())); SociaxUIUtils.highlightContent(mContext, ss1); commentMyListItem.myComment.setText(ss1); } else { SpannableString ss2 = new SpannableString( "回复我的评论:" + SociaxUIUtils.filterHtml(comment.getReplyComment().getContent())); SociaxUIUtils.highlightContent(mContext, ss2); commentMyListItem.myComment.setText(ss2); } return convertView; }
@Override public void doAction(int paramInt, String paramString) { // TODO Auto-generated method stub EditText localEditBlogView = mEditAnswer; int i = localEditBlogView.getSelectionStart(); int j = localEditBlogView.getSelectionStart(); String str1 = "[" + paramString + "]"; String str2 = localEditBlogView.getText().toString(); SpannableStringBuilder localSpannableStringBuilder = new SpannableStringBuilder(); localSpannableStringBuilder.append(str2, 0, i); localSpannableStringBuilder.append(str1); localSpannableStringBuilder.append(str2, j, str2.length()); SociaxUIUtils.highlightContent(QuestionDetailsActivity.this, localSpannableStringBuilder); localEditBlogView.setText(localSpannableStringBuilder, TextView.BufferType.SPANNABLE); localEditBlogView.setSelection(i + str1.length()); Log.v("Tag", localEditBlogView.getText().toString()); }