// 初始化视图控件
  private void initView() {
    _hisuid = getIntent().getIntExtra("his_id", 0);
    _hisname = getIntent().getStringExtra("his_name");
    _username = getIntent().getStringExtra("his_name");
    _uid = ((AppContext) getApplication()).getLoginUid();

    mBack = (ImageView) findViewById(R.id.user_center_back);
    mRefresh = (ImageView) findViewById(R.id.user_center_refresh);
    mHeadTitle = (TextView) findViewById(R.id.user_center_head_title);
    mProgressbar = (ProgressBar) findViewById(R.id.user_center_head_progress);
    mRelation = (RadioButton) findViewById(R.id.user_center_footbar_relation);
    mMessage = (RadioButton) findViewById(R.id.user_center_footbar_message);
    mAtme = (RadioButton) findViewById(R.id.user_center_footbar_atme);

    mTabActive = (Button) findViewById(R.id.user_center_btn_active);
    mTabBlog = (Button) findViewById(R.id.user_center_btn_blog);

    mUserinfoDialog = new UserInfoDialog(UserCenter.this);
    mUserface = (ImageView) mUserinfoDialog.findViewById(R.id.user_center_userface);
    mUsername = (TextView) mUserinfoDialog.findViewById(R.id.user_center_username);
    mFrom = (TextView) mUserinfoDialog.findViewById(R.id.user_center_from);
    mGender = (TextView) mUserinfoDialog.findViewById(R.id.user_center_gender);
    mJointime = (TextView) mUserinfoDialog.findViewById(R.id.user_center_jointime);
    mDevplatform = (TextView) mUserinfoDialog.findViewById(R.id.user_center_devplatform);
    mExpertise = (TextView) mUserinfoDialog.findViewById(R.id.user_center_expertise);
    mLatestonline = (TextView) mUserinfoDialog.findViewById(R.id.user_center_latestonline);

    mHeadTitle.setText(_username + " ▼");
    // 设置第一选中项
    mTabActive.setEnabled(false);
    mTabActive.setOnClickListener(tabBtnClick(mTabActive));
    mTabBlog.setOnClickListener(tabBtnClick(mTabBlog));

    mBack.setOnClickListener(UIHelper.finish(this));
    mRefresh.setOnClickListener(refreshClickListener);
    mHeadTitle.setOnClickListener(headTitleClickListener);
    mMessage.setOnClickListener(messageClickListener);
    mAtme.setOnClickListener(atmeClickListener);
    mUserinfoDialog.setOnCancelListener(dialogCancelListener);

    this.initLvActive();
    this.initLvBlog();
  }
Exemple #2
0
  // 初始化视图控件
  private void initView() {
    mBack = (ImageView) findViewById(R.id.friend_head_back);
    mBack.setOnClickListener(UIHelper.finish(this));
    mProgressbar = (ProgressBar) findViewById(R.id.friend_head_progress);

    friend_type_fans = (Button) findViewById(R.id.friend_type_fans);
    friend_type_follower = (Button) findViewById(R.id.friend_type_follower);

    friend_type_fans.setOnClickListener(
        this.friendBtnClick(friend_type_fans, FriendList.TYPE_FANS));
    friend_type_follower.setOnClickListener(
        this.friendBtnClick(friend_type_follower, FriendList.TYPE_FOLLOWER));

    // 设置当前分类
    curLvCatalog = getIntent().getIntExtra("friend_type", FriendList.TYPE_FOLLOWER);
    if (curLvCatalog == FriendList.TYPE_FANS) {
      friend_type_fans.setEnabled(false);
    } else {
      friend_type_follower.setEnabled(false);
    }

    // 设置粉丝与关注的数量
    int followers = getIntent().getIntExtra("friend_followers", 0);
    int fans = getIntent().getIntExtra("friend_fans", 0);
    friend_type_follower.setText(getString(R.string.user_friend_follower, followers));
    friend_type_fans.setText(getString(R.string.user_friend_fans, fans));

    lvFriend_footer = getLayoutInflater().inflate(R.layout.listview_footer, null);
    lvFriend_foot_more = (TextView) lvFriend_footer.findViewById(R.id.listview_foot_more);
    lvFriend_foot_progress =
        (ProgressBar) lvFriend_footer.findViewById(R.id.listview_foot_progress);

    lvFriendAdapter = new ListViewFriendAdapter(this, lvFriendData, R.layout.friend_listitem);
    mlvFriend = (PullToRefreshListView) findViewById(R.id.friend_listview);

    mlvFriend.addFooterView(lvFriend_footer); // 添加底部视图  必须在setAdapter前
    mlvFriend.setAdapter(lvFriendAdapter);
    mlvFriend.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // 点击头部、底部栏无效
            if (position == 0 || view == lvFriend_footer) return;

            TextView name = (TextView) view.findViewById(R.id.friend_listitem_name);
            Friend friend = (Friend) name.getTag();

            if (friend == null) return;

            // 跳转
            UIHelper.showUserCenter(view.getContext(), friend.getUserid(), friend.getName());
          }
        });
    mlvFriend.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          public void onScrollStateChanged(AbsListView view, int scrollState) {
            mlvFriend.onScrollStateChanged(view, scrollState);

            // 数据为空--不用继续下面代码了
            if (lvFriendData.size() == 0) return;

            // 判断是否滚动到底部
            boolean scrollEnd = false;
            try {
              if (view.getPositionForView(lvFriend_footer) == view.getLastVisiblePosition())
                scrollEnd = true;
            } catch (Exception e) {
              scrollEnd = false;
            }

            if (scrollEnd && curLvDataState == UIHelper.LISTVIEW_DATA_MORE) {
              lvFriend_foot_more.setText(R.string.load_ing);
              lvFriend_foot_progress.setVisibility(View.VISIBLE);
              // 当前pageIndex
              int pageIndex = lvSumData / 20;
              loadLvFriendData(
                  curLvCatalog, pageIndex, mFriendHandler, UIHelper.LISTVIEW_ACTION_SCROLL);
            }
          }

          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            mlvFriend.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
          }
        });
    mlvFriend.setOnRefreshListener(
        new PullToRefreshListView.OnRefreshListener() {
          public void onRefresh() {
            loadLvFriendData(curLvCatalog, 0, mFriendHandler, UIHelper.LISTVIEW_ACTION_REFRESH);
          }
        });
  }
        public void onClick(View v) {
          if (mUser == null) return;
          // 判断登录
          final AppContext ac = (AppContext) getApplication();
          if (!ac.isLogin()) {
            UIHelper.showLoginDialog(UserCenter.this);
            return;
          }

          final Handler handler =
              new Handler() {
                public void handleMessage(Message msg) {
                  if (msg.what == 1) {
                    Result res = (Result) msg.obj;
                    if (res.OK()) {
                      switch (mUser.getRelation()) {
                        case User.RELATION_TYPE_BOTH:
                          mRelation.setCompoundDrawablesWithIntrinsicBounds(
                              R.drawable.widget_bar_relation_add, 0, 0, 0);
                          mRelation.setText("加关注");
                          mUser.setRelation(User.RELATION_TYPE_FANS_ME);
                          break;
                        case User.RELATION_TYPE_FANS_HIM:
                          mRelation.setCompoundDrawablesWithIntrinsicBounds(
                              R.drawable.widget_bar_relation_add, 0, 0, 0);
                          mRelation.setText("加关注");
                          mUser.setRelation(User.RELATION_TYPE_NULL);
                          break;
                        case User.RELATION_TYPE_FANS_ME:
                          mRelation.setCompoundDrawablesWithIntrinsicBounds(
                              R.drawable.widget_bar_relation_del, 0, 0, 0);
                          mRelation.setText("取消互粉");
                          mUser.setRelation(User.RELATION_TYPE_BOTH);
                          break;
                        case User.RELATION_TYPE_NULL:
                          mRelation.setCompoundDrawablesWithIntrinsicBounds(
                              R.drawable.widget_bar_relation_del, 0, 0, 0);
                          mRelation.setText("取消关注");
                          mUser.setRelation(User.RELATION_TYPE_FANS_HIM);
                          break;
                      }
                    }
                    UIHelper.ToastMessage(UserCenter.this, res.getErrorMessage());
                  } else {
                    ((AppException) msg.obj).makeToast(UserCenter.this);
                  }
                }
              };
          final Thread thread =
              new Thread() {
                public void run() {
                  Message msg = new Message();
                  try {
                    Result res = ac.updateRelation(_uid, _hisuid, relationAction);
                    msg.what = 1;
                    msg.obj = res;
                  } catch (AppException e) {
                    e.printStackTrace();
                    msg.what = -1;
                    msg.obj = e;
                  }
                  handler.sendMessage(msg);
                }
              };
          String dialogTitle = "";
          switch (mUser.getRelation()) {
            case User.RELATION_TYPE_BOTH:
              dialogTitle = "确定取消互粉吗?";
              relationAction = User.RELATION_ACTION_DELETE;
              break;
            case User.RELATION_TYPE_FANS_HIM:
              dialogTitle = "确定取消关注吗?";
              relationAction = User.RELATION_ACTION_DELETE;
              break;
            case User.RELATION_TYPE_FANS_ME:
              dialogTitle = "确定关注他吗?";
              relationAction = User.RELATION_ACTION_ADD;
              break;
            case User.RELATION_TYPE_NULL:
              dialogTitle = "确定关注他吗?";
              relationAction = User.RELATION_ACTION_ADD;
              break;
          }
          new AlertDialog.Builder(v.getContext())
              .setIcon(android.R.drawable.ic_dialog_info)
              .setTitle(dialogTitle)
              .setPositiveButton(
                  R.string.sure,
                  new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                      thread.start();
                      dialog.dismiss();
                    }
                  })
              .setNegativeButton(
                  R.string.cancle,
                  new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                      dialog.dismiss();
                    }
                  })
              .create()
              .show();
        }
 public void onClick(View v) {
   if (mUser == null) return;
   UIHelper.showTweetPub(UserCenter.this, "@" + mUser.getName() + " ", mUser.getUid());
 }
 public void onClick(View v) {
   if (mUser == null) return;
   UIHelper.showMessagePub(UserCenter.this, mUser.getUid(), mUser.getName());
 }
 private void lvBlogHandleMessage(Message msg) {
   if (msg.what >= 0) {
     BlogList bloglist = (BlogList) msg.obj;
     Notice notice = bloglist.getNotice();
     // 显示用户博客数量
     String tabBlogText = String.format("博客(%d)", bloglist.getBlogsCount());
     mTabBlog.setText(tabBlogText);
     // 处理listview数据
     switch (msg.arg1) {
       case UIHelper.LISTVIEW_ACTION_INIT:
       case UIHelper.LISTVIEW_ACTION_REFRESH:
       case UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG:
         lvBlogSumData = msg.what;
         lvBlogData.clear(); // 先清除原有数据
         lvBlogData.addAll(bloglist.getBloglist());
         break;
       case UIHelper.LISTVIEW_ACTION_SCROLL:
         lvBlogSumData += msg.what;
         if (lvBlogData.size() > 0) {
           for (Blog blog1 : bloglist.getBloglist()) {
             boolean b = false;
             for (Blog blog2 : lvBlogData) {
               if (blog1.getId() == blog2.getId()) {
                 b = true;
                 break;
               }
             }
             if (!b) lvBlogData.add(blog1);
           }
         } else {
           lvBlogData.addAll(bloglist.getBloglist());
         }
         break;
     }
     if (msg.what < _pageSize) {
       curLvBlogDataState = UIHelper.LISTVIEW_DATA_FULL;
       lvBlogAdapter.notifyDataSetChanged();
       lvBlog_foot_more.setText(R.string.load_full);
     } else if (msg.what == _pageSize) {
       curLvBlogDataState = UIHelper.LISTVIEW_DATA_MORE;
       lvBlogAdapter.notifyDataSetChanged();
       lvBlog_foot_more.setText(R.string.load_more);
     }
     // 发送通知广播
     if (msg.obj != null) {
       UIHelper.sendBroadCast(UserCenter.this, notice);
     }
   } else if (msg.what == -1) {
     // 有异常--显示加载出错 & 弹出错误消息
     curLvBlogDataState = UIHelper.LISTVIEW_DATA_MORE;
     lvBlog_foot_more.setText(R.string.load_error);
     ((AppException) msg.obj).makeToast(UserCenter.this);
   }
   if (lvBlogData.size() == 0) {
     curLvBlogDataState = UIHelper.LISTVIEW_DATA_EMPTY;
     lvBlog_foot_more.setText(R.string.load_empty);
   }
   lvBlog_foot_progress.setVisibility(View.GONE);
   if (msg.arg1 == UIHelper.LISTVIEW_ACTION_REFRESH) {
     mLvBlog.onRefreshComplete(
         getString(R.string.pull_to_refresh_update) + new Date().toLocaleString());
     mLvBlog.setSelection(0);
   } else if (msg.arg1 == UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG) {
     mLvBlog.setSelection(0);
   }
 }
 private void lvActiveHandleMessage(Message msg) {
   if (msg.what >= 0) {
     UserInformation uinfo = (UserInformation) msg.obj;
     Notice notice = uinfo.getNotice();
     // 处理listview数据
     switch (msg.arg1) {
       case UIHelper.LISTVIEW_ACTION_INIT:
       case UIHelper.LISTVIEW_ACTION_REFRESH:
       case UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG:
         lvActiveSumData = msg.what;
         lvActiveData.clear(); // 先清除原有数据
         lvActiveData.addAll(uinfo.getActivelist());
         break;
       case UIHelper.LISTVIEW_ACTION_SCROLL:
         lvActiveSumData += msg.what;
         if (lvActiveData.size() > 0) {
           for (Active active1 : uinfo.getActivelist()) {
             boolean b = false;
             for (Active active2 : lvActiveData) {
               if (active1.getId() == active2.getId()) {
                 b = true;
                 break;
               }
             }
             if (!b) lvActiveData.add(active1);
           }
         } else {
           lvActiveData.addAll(uinfo.getActivelist());
         }
         break;
     }
     if (msg.what < _pageSize) {
       curLvActiveDataState = UIHelper.LISTVIEW_DATA_FULL;
       lvActiveAdapter.notifyDataSetChanged();
       lvActive_foot_more.setText(R.string.load_full);
     } else if (msg.what == _pageSize) {
       curLvActiveDataState = UIHelper.LISTVIEW_DATA_MORE;
       lvActiveAdapter.notifyDataSetChanged();
       lvActive_foot_more.setText(R.string.load_more);
     }
     // 发送通知广播
     if (msg.obj != null) {
       UIHelper.sendBroadCast(UserCenter.this, notice);
     }
   } else if (msg.what == -1) {
     // 有异常--显示加载出错 & 弹出错误消息
     curLvActiveDataState = UIHelper.LISTVIEW_DATA_MORE;
     lvActive_foot_more.setText(R.string.load_error);
     ((AppException) msg.obj).makeToast(UserCenter.this);
   }
   if (lvActiveData.size() == 0) {
     curLvActiveDataState = UIHelper.LISTVIEW_DATA_EMPTY;
     lvActive_foot_more.setText(R.string.load_empty);
   }
   lvActive_foot_progress.setVisibility(View.GONE);
   if (msg.arg1 == UIHelper.LISTVIEW_ACTION_REFRESH) {
     mLvActive.onRefreshComplete(
         getString(R.string.pull_to_refresh_update) + new Date().toLocaleString());
     mLvActive.setSelection(0);
   } else if (msg.arg1 == UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG) {
     mLvActive.setSelection(0);
   }
 }
 public void handleMessage(Message msg) {
   if (msg.what == 1) {
     UIHelper.ToastMessage(AppContext.this, getString(R.string.msg_login_error));
     UIHelper.showLoginDialog(AppContext.this);
   }
 }
Exemple #9
0
        public void onClick(View v) {
          _id = curId;

          if (curId == 0) {
            return;
          }

          _catalog = curCatalog;

          _content = mFootEditer.getText().toString();
          if (StringUtils.isEmpty(_content)) {
            UIHelper.ToastMessage(v.getContext(), "请输入评论内容");
            return;
          }

          final AppContext ac = (AppContext) getApplication();
          if (!ac.isLogin()) {
            UIHelper.showLoginDialog(TweetDetail.this);
            return;
          }

          //			if(mZone.isChecked())
          //				_isPostToMyZone = 1;

          _uid = ac.getLoginUid();

          mProgress = ProgressDialog.show(v.getContext(), null, "发布中···", true, true);

          final Handler handler =
              new Handler() {
                public void handleMessage(Message msg) {

                  if (mProgress != null) mProgress.dismiss();

                  if (msg.what == 1) {
                    Result res = (Result) msg.obj;
                    UIHelper.ToastMessage(TweetDetail.this, res.getErrorMessage());
                    if (res.OK()) {
                      // 发送通知广播
                      if (res.getNotice() != null) {
                        UIHelper.sendBroadCast(TweetDetail.this, res.getNotice());
                      }
                      // 恢复初始底部栏
                      mFootViewSwitcher.setDisplayedChild(0);
                      mFootEditer.clearFocus();
                      mFootEditer.setText("");
                      mFootEditer.setVisibility(View.GONE);
                      // 更新评论列表
                      lvCommentData.add(0, res.getComment());
                      lvCommentAdapter.notifyDataSetChanged();
                      mLvComment.setSelection(0);
                      // 清除之前保存的编辑内容
                      ac.removeProperty(tempCommentKey);
                    }
                  } else {
                    ((AppException) msg.obj).makeToast(TweetDetail.this);
                  }
                }
              };
          new Thread() {
            public void run() {
              Message msg = new Message();
              Result res = new Result();
              try {
                // 发表评论
                res = ac.pubComment(_catalog, _id, _uid, _content, _isPostToMyZone);
                msg.what = 1;
                msg.obj = res;
              } catch (AppException e) {
                e.printStackTrace();
                msg.what = -1;
                msg.obj = e;
              }
              handler.sendMessage(msg);
            }
          }.start();
        }
Exemple #10
0
 public void onClick(View v) {
   if (tweetDetail != null)
     UIHelper.showImageZoomDialog(v.getContext(), tweetDetail.getImgBig());
 }
Exemple #11
0
 public void onClick(View v) {
   if (tweetDetail != null)
     UIHelper.showUserCenter(
         v.getContext(), tweetDetail.getAuthorId(), tweetDetail.getAuthor());
 }
Exemple #12
0
  // 初始化视图控件
  private void initView() {
    curId = getIntent().getIntExtra("tweet_id", 0);
    curCatalog = CommentList.CATALOG_TWEET;

    if (curId > 0) tempCommentKey = AppConfig.TEMP_COMMENT + "_" + curCatalog + "_" + curId;

    mBack = (ImageView) findViewById(R.id.tweet_detail_back);
    mRefresh = (ImageView) findViewById(R.id.tweet_detail_refresh);
    mLinearlayout = (LinearLayout) findViewById(R.id.tweet_detail_linearlayout);
    mProgressbar = (ProgressBar) findViewById(R.id.tweet_detail_head_progress);

    mBack.setOnClickListener(UIHelper.finish(this));
    mRefresh.setOnClickListener(refreshClickListener);

    imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);

    mFootViewSwitcher = (ViewSwitcher) findViewById(R.id.tweet_detail_foot_viewswitcher);
    mFootPubcomment = (Button) findViewById(R.id.tweet_detail_foot_pubcomment);
    mFootPubcomment.setOnClickListener(commentpubClickListener);
    mFootEditebox = (ImageView) findViewById(R.id.tweet_detail_footbar_editebox);
    mFootEditebox.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            mFootViewSwitcher.showNext();
            mFootEditer.setVisibility(View.VISIBLE);
            mFootEditer.requestFocus();
            mFootEditer.requestFocusFromTouch();
          }
        });
    mFootEditer = (EditText) findViewById(R.id.tweet_detail_foot_editer);
    mFootEditer.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
              imm.showSoftInput(v, 0);
            } else {
              imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
            }
          }
        });
    mFootEditer.setOnKeyListener(
        new View.OnKeyListener() {
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK) {
              if (mFootViewSwitcher.getDisplayedChild() == 1) {
                mFootViewSwitcher.setDisplayedChild(0);
                mFootEditer.clearFocus();
                mFootEditer.setVisibility(View.GONE);
              }
              return true;
            }
            return false;
          }
        });
    // 编辑器添加文本监听
    mFootEditer.addTextChangedListener(UIHelper.getTextWatcher(this, tempCommentKey));

    // 显示临时编辑内容
    UIHelper.showTempEditContent(this, mFootEditer, tempCommentKey);

    lvHeader = View.inflate(this, R.layout.tweet_detail_content, null);
    userface = (ImageView) lvHeader.findViewById(R.id.tweet_listitem_userface);
    username = (TextView) lvHeader.findViewById(R.id.tweet_listitem_username);
    date = (TextView) lvHeader.findViewById(R.id.tweet_listitem_date);
    commentCount = (TextView) lvHeader.findViewById(R.id.tweet_listitem_commentCount);
    image = (ImageView) lvHeader.findViewById(R.id.tweet_listitem_image);

    content = (WebView) lvHeader.findViewById(R.id.tweet_listitem_content);
    content.getSettings().setJavaScriptEnabled(false);
    content.getSettings().setSupportZoom(true);
    content.getSettings().setBuiltInZoomControls(true);
    content.getSettings().setDefaultFontSize(12);

    lvComment_footer = getLayoutInflater().inflate(R.layout.listview_footer, null);
    lvComment_foot_more = (TextView) lvComment_footer.findViewById(R.id.listview_foot_more);
    lvComment_foot_progress =
        (ProgressBar) lvComment_footer.findViewById(R.id.listview_foot_progress);

    lvCommentAdapter = new ListViewCommentAdapter(this, lvCommentData, R.layout.comment_listitem);
    mLvComment = (PullToRefreshListView) findViewById(R.id.tweet_detail_commentlist);

    mLvComment.addHeaderView(lvHeader); // 把动弹详情放进listview头部
    mLvComment.addFooterView(lvComment_footer); // 添加底部视图  必须在setAdapter前
    mLvComment.setAdapter(lvCommentAdapter);
    mLvComment.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // 点击头部、底部栏无效
            if (position == 0 || view == lvComment_footer || position == 1 || view == lvHeader)
              return;

            Comment com = null;
            // 判断是否是TextView
            if (view instanceof TextView) {
              com = (Comment) view.getTag();
            } else {
              ImageView img = (ImageView) view.findViewById(R.id.comment_listitem_userface);
              com = (Comment) img.getTag();
            }
            if (com == null) return;

            // 跳转--回复评论界面
            UIHelper.showCommentReply(
                TweetDetail.this,
                curId,
                curCatalog,
                com.getId(),
                com.getAuthorId(),
                com.getAuthor(),
                com.getContent());
          }
        });
    mLvComment.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          public void onScrollStateChanged(AbsListView view, int scrollState) {
            mLvComment.onScrollStateChanged(view, scrollState);

            // 数据为空--不用继续下面代码了
            if (lvCommentData.size() == 0) return;

            // 判断是否滚动到底部
            boolean scrollEnd = false;
            try {
              if (view.getPositionForView(lvComment_footer) == view.getLastVisiblePosition())
                scrollEnd = true;
            } catch (Exception e) {
              scrollEnd = false;
            }

            if (scrollEnd && curLvDataState == UIHelper.LISTVIEW_DATA_MORE) {
              lvComment_foot_more.setText(R.string.load_ing);
              lvComment_foot_progress.setVisibility(View.VISIBLE);
              // 当前pageIndex
              int pageIndex = lvSumData / 20;
              loadLvCommentData(
                  curId, curCatalog, pageIndex, mCommentHandler, UIHelper.LISTVIEW_ACTION_SCROLL);
            }
          }

          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            mLvComment.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
          }
        });
    mLvComment.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            // 点击头部、底部栏无效
            if (position == 0 || view == lvComment_footer || position == 1 || view == lvHeader)
              return false;

            Comment _com = null;
            // 判断是否是TextView
            if (view instanceof TextView) {
              _com = (Comment) view.getTag();
            } else {
              ImageView img = (ImageView) view.findViewById(R.id.comment_listitem_userface);
              _com = (Comment) img.getTag();
            }
            if (_com == null) return false;

            final Comment com = _com;

            final AppContext ac = (AppContext) getApplication();
            // 操作--回复 & 删除
            int uid = ac.getLoginUid();
            // 判断该评论是否是当前登录用户发表的:true--有删除操作  false--没有删除操作
            if (uid == com.getAuthorId()) {
              final Handler handler =
                  new Handler() {
                    public void handleMessage(Message msg) {
                      if (msg.what == 1) {
                        Result res = (Result) msg.obj;
                        if (res.OK()) {
                          lvSumData--;
                          lvCommentData.remove(com);
                          lvCommentAdapter.notifyDataSetChanged();
                        }
                        UIHelper.ToastMessage(TweetDetail.this, res.getErrorMessage());
                      } else {
                        ((AppException) msg.obj).makeToast(TweetDetail.this);
                      }
                    }
                  };
              final Thread thread =
                  new Thread() {
                    public void run() {
                      Message msg = new Message();
                      try {
                        Result res =
                            ac.delComment(curId, curCatalog, com.getId(), com.getAuthorId());
                        msg.what = 1;
                        msg.obj = res;
                      } catch (AppException e) {
                        e.printStackTrace();
                        msg.what = -1;
                        msg.obj = e;
                      }
                      handler.sendMessage(msg);
                    }
                  };
              UIHelper.showCommentOptionDialog(TweetDetail.this, curId, curCatalog, com, thread);
            } else {
              UIHelper.showCommentOptionDialog(TweetDetail.this, curId, curCatalog, com, null);
            }
            return true;
          }
        });
    mLvComment.setOnRefreshListener(
        new PullToRefreshListView.OnRefreshListener() {
          public void onRefresh() {
            loadLvCommentData(
                curId, curCatalog, 0, mCommentHandler, UIHelper.LISTVIEW_ACTION_REFRESH);
          }
        });
  }
 @Override
 public void onItemClick(int position, Friend friend) {
   // 跳转
   UIHelper.showUserCenter(getActivity(), friend.getUserid(), friend.getName());
 }