コード例 #1
0
 @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());
 }
コード例 #2
0
  @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;
  }
コード例 #3
0
  private void answerQuestion(String txt) {
    String url =
        MyConfig.QUESTION_ANSWER_URL
            + Utils.getTokenString(this)
            + "&qid="
            + mQid
            + "&auid="
            + mAuid
            + "&content="
            + txt;
    NetComTools netComTools = NetComTools.getInstance(this);
    netComTools.getNetJson(
        url,
        new JsonDataListener() {
          @Override
          public void OnReceive(JSONObject jsonObject) {
            Log.d(TAG, "Question answer data:" + jsonObject.toString());
            try {
              int ret = jsonObject.getInt("code");
              if (ret == 0) {
                Utils.showToast(QuestionDetailsActivity.this, "回答成功!");
                mEditAnswer.setText("");
                initData(mQid);
              } else {
                String txt = jsonObject.optString("message");
                if (!TextUtils.isEmpty(txt)) Utils.showToast(QuestionDetailsActivity.this, txt);
              }
            } catch (Exception e) {
              e.printStackTrace();
            }
          }

          @Override
          public void OnError(String error) {
            Log.d(TAG, "Get Question answer error, " + error);
          }
        });
    SociaxUIUtils.hideSoftKeyboard(this, mEditAnswer);
  }