private void publishComment() {
    if (isPosting) {
      return;
    }

    if (TextUtils.isEmpty(etCommentContent.getText())) {
      //	    etCommentContent.setShakeAnimation();
      etCommentContent.requestFocus();
      return;
    }

    isPosting = true;
    PublishArticleCommentPostParams postParams = new PublishArticleCommentPostParams();
    postParams.articleId = targetArticle.getId();
    if (mCurrentReplyComment != null) {
      postParams.parentCommentId = mCurrentReplyComment.getId();
    }
    postParams.content = etCommentContent.getText().toString();

    AppServiceExtendImpl.getInstance()
        .publishArticleComment(
            postParams,
            new OnPublishArticleCommentResponseListener() {

              @Override
              public void onSuccess(ArticleComment comment) {
                // TODO Auto-generated method stub

                // 发布成功, 恢复原状
                etCommentContent.setText("");
                mCurrentReplyComment = null;
                layoutReply.setVisibility(View.GONE);
                // 隐藏表情 view
                findViewById(R.id.layout_emo).setVisibility(View.GONE);
                // 软键盘
                ActivityUtil.hideSoftInput(ArticleCommentsActivity.this);

                isPosting = false;
                mCommentsAdapter.add(comment);

                // 隐藏头部提示加载的textview
                tvLoading.setVisibility(View.GONE);
              }

              @Override
              public void onFailure(String errorMsg) {
                // TODO Auto-generated method stub
                ActivityUtil.show(ArticleCommentsActivity.this, errorMsg);
                isPosting = false;
              }
            });
  }
  private void init() {

    Object o = getIntent().getSerializableExtra("article");
    if (o != null) {
      targetArticle = (Article) o;
    } else {
      ActivityUtil.show(this, "没有指定帖子");
      finish();
    }

    TextView tvTopTitle =
        (TextView) findViewById(R.id.layout_nav_top).findViewById(R.id.tv_top_title);
    TextView tvTopAction =
        (TextView) findViewById(R.id.layout_nav_top).findViewById(R.id.tv_top_action);
    tvTopTitle.setText("查看帖子");
    tvTopTitle.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
          }
        });

    if (targetArticle.getUserId()
        == MyApplication.getInstance().getCurrentLoginedUser().getUserId()) {
      tvTopAction.setVisibility(View.VISIBLE);
      tvTopAction.setText("");
    } else {
      tvTopAction.setVisibility(View.GONE);
      tvTopAction.setText("");
    }

    // 输入框上面的回复谁布局容器
    layoutReply = findViewById(R.id.layout_article_comment_reply);
    layoutReply.setVisibility(View.GONE);
    // 回复 谁:
    tvReply = (TextView) findViewById(R.id.tv_article_comment_reply);
    // 取消回复 按钮
    tvReplyCancle = (TextView) findViewById(R.id.tv_article_comment_reply_cancle);
    tvReplyCancle.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            mCurrentReplyComment = null;
            layoutReply.setVisibility(View.GONE);
            tvReply.setText("");
          }
        });

    tvShowEmo = (TextView) findViewById(R.id.tv_article_comment_emo);
    tvShowEmo.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            // 显示或隐藏表情视图
            View view = findViewById(R.id.layout_emo);
            if (view.getVisibility() == View.VISIBLE) {
              view.setVisibility(View.GONE);
              //		    ActivityUtil.showSoftInputView(UserNewsCommentActivity.this,
              // etCommentContent);

            } else {
              view.setVisibility(View.VISIBLE);
              ActivityUtil.closeSoftInput(ArticleCommentsActivity.this, etCommentContent);
            }
          }
        });

    etCommentContent = (EmoticonsEditText) findViewById(R.id.et_article_comment_content);
    etCommentContent.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            View view = findViewById(R.id.layout_emo);
            view.setVisibility(View.GONE);
            ActivityUtil.showSoftInputView(ArticleCommentsActivity.this, etCommentContent);
          }
        });

    // 发布评论
    tvPublishComment = (TextView) findViewById(R.id.tv_article_comment_publish);

    tvPublishComment.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            publishComment();
          }
        });

    mListView = (me.himi.love.view.list.XListView) findViewById(R.id.listview_article_comments);
    // 使用代理 设置ImageLoader  在 ListView 滚动时不加载图片
    //	mNewsCommentListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(),
    // true, true));

    // 顶部的帖子布局容器

    RelativeLayout layoutFooterLoading =
        (RelativeLayout)
            LayoutInflater.from(this).inflate(R.layout.user_news_comment_loading, null);

    pbLoading = (ProgressBar) layoutFooterLoading.findViewById(R.id.pb_user_news_comment_loading);
    tvLoading = (TextView) layoutFooterLoading.findViewById(R.id.tv_user_news_comment_loading);

    // 底部提示加载中
    mListView.addFooterView(layoutFooterLoading);

    // 设置无数据时显示的view
    //	mNewsCommentListView.setEmptyView(v);

    mCommentsAdapter = new ArticleCommentsAdapter(this, new ArrayList<ArticleComment>());

    mListView.setAdapter(mCommentsAdapter);

    // 顶部帖子详细
    View v = createArticleView();
    mListView.addHeaderView(v);

    mListView.setPullLoadEnable(true);
    mListView.setPullRefreshEnable(false); // 因按评论时间升序,所以不提供刷新,只能加载更多
    mListView.pullRefreshing();

    mListView.setXListViewListener(
        new IXListViewListener() {

          @Override
          public void onRefresh() {
            // TODO Auto-generated method stub
            pageNumber = 1;
            loadArticleComments();
            tvLoading.setVisibility(View.GONE);
            pbLoading.setVisibility(View.GONE);
          }

          @Override
          public void onLoadMore() {
            // TODO Auto-generated method stub
            loadArticleComments();
          }
        });

    loadArticleComments();

    //
    mListView.setOnItemClickListener(this);

    // 默认先隐藏软键盘
    ActivityUtil.hideSoftInput(this);

    // 表情view
    initEmoView();
  }