@Override
  public void onFriendshipCreated(WeiBoUser targetUser) {
    if (mFriendship != null) mFriendship.getSource().setFollowing(true);

    mUser.setRecentStatusId(targetUser.getRecentStatusId());
    if (mNewUser != null) mNewUser.setRecentStatusId(targetUser.getRecentStatusId());

    mGroupMemberListed = new GroupMemberListed();
    mGroupMemberListed.setLists(new ArrayList<GroupListed>());
    mGroupMemberListed.setUid(mUser.getIdstr());

    setProfileView();

    setGroupList();

    getActivity().invalidateOptionsMenu();

    getAdapter().notifyDataSetChanged();
  }
  private void setGroupList() {
    if (groupDialog != null && groupDialog.isShowing()) groupDialog.dismiss();

    String[] items = new String[AppContext.getGroups().getLists().size()];
    final boolean[] checkedItems = new boolean[AppContext.getGroups().getLists().size()];
    final boolean[] editCheckedItems = new boolean[AppContext.getGroups().getLists().size()];

    for (int i = 0; i < AppContext.getGroups().getLists().size(); i++) {
      Group group = AppContext.getGroups().getLists().get(i);

      items[i] = group.getName();
      checkedItems[i] = false;
      editCheckedItems[i] = false;
      for (GroupListed groupListed : mGroupMemberListed.getLists()) {
        if (groupListed.getIdstr().equals(group.getIdstr())) {
          checkedItems[i] = true;
          editCheckedItems[i] = true;
          break;
        }
      }
    }

    View customTitle = View.inflate(getActivity(), R.layout.lay_group_dialogtitle, null);
    customTitle
        .findViewById(R.id.btnSettings)
        .setOnClickListener(
            new OnClickListener() {

              @Override
              public void onClick(View v) {
                // 设置分组
                GroupSortFragment.lanuch(getActivity());
              }
            });
    groupDialog =
        new AlertDialog.Builder(getActivity())
            .setCustomTitle(customTitle)
            .setMultiChoiceItems(
                items,
                editCheckedItems,
                new DialogInterface.OnMultiChoiceClickListener() {

                  @Override
                  public void onClick(DialogInterface dialog, int which, boolean isChecked) {
                    editCheckedItems[which] = isChecked;
                  }
                })
            .setOnDismissListener(
                new DialogInterface.OnDismissListener() {

                  @Override
                  public void onDismiss(DialogInterface dialog) {
                    groupDialog = null;
                  }
                })
            .setNegativeButton(R.string.cancel, null)
            .setPositiveButton(
                R.string.confirm,
                new DialogInterface.OnClickListener() {

                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    new SetGroupTask().execute(checkedItems, editCheckedItems);
                  }
                })
            .show();
  }
  private void setProfileView() {
    ImageView imgPhoto = (ImageView) viewProfile.findViewById(R.id.imgPhoto);
    BitmapLoader.getInstance()
        .display(
            this, AisenUtil.getUserPhoto(mUser), imgPhoto, ImageConfigUtils.getLargePhotoConfig());

    TextView txtName = (TextView) viewProfile.findViewById(R.id.txtName);
    txtName.setText(mUser.getName());
    // f**k 2014-09-04 当名字过长大于6个字时,截取部分文字
    int maxLength = AisenUtil.getStrLength("当名字过长大于个");
    if (AisenUtil.getStrLength(mUser.getName()) > maxLength) {
      StringBuffer sb = new StringBuffer();
      int index = 0;
      while (AisenUtil.getStrLength(sb.toString()) < maxLength) {
        if (index >= mUser.getName().length()) break;

        sb.append(mUser.getName().charAt(index));
        index++;
      }
      sb.append("...");
      txtName.setText(sb.toString());
    }

    // 性别
    ImageView imgGender = (ImageView) viewProfile.findViewById(R.id.imgGender);
    imgGender.setVisibility(View.VISIBLE);
    if ("m".equals(mUser.getGender())) imgGender.setImageResource(R.drawable.list_male);
    else if ("f".equals(mUser.getGender())) imgGender.setImageResource(R.drawable.list_female);
    else imgGender.setVisibility(View.GONE);

    // 认证
    ImageView imgVerified = (ImageView) viewProfile.findViewById(R.id.imgVerified);
    AisenUtil.setImageVerified(imgVerified, mUser);

    // 简介
    TextView txtDesc = (TextView) viewProfile.findViewById(R.id.txtDesc);
    if (!TextUtils.isEmpty(mUser.getDescription()))
      txtDesc.setText(String.format(getString(R.string.profile_des_hint), mUser.getDescription()));
    else
      txtDesc.setText(
          String.format(
              String.format(
                  getString(R.string.profile_des_hint), getString(R.string.profile_des_none))));

    // 认证原因
    TextView txtVerifiedReason = (TextView) viewProfile.findViewById(R.id.txtVerifiedReason);
    txtVerifiedReason.setVisibility(
        !TextUtils.isEmpty(mUser.getVerified_reason()) ? View.VISIBLE : View.GONE);
    txtVerifiedReason.setText(
        String.format(getString(R.string.profile_ver_reason), mUser.getVerified_reason() + ""));

    // 备注
    TextView txtRemark = (TextView) viewProfile.findViewById(R.id.txtRemark);
    txtRemark.setVisibility(
        mFriendship == null || !mFriendship.getSource().getFollowing() ? View.GONE : View.VISIBLE);
    if (mFriendship != null) {
      try {
        BizFragment.getBizFragment(this).modifyUserMark(txtRemark, mUser, this);
      } catch (Exception e) {
      }
      if (!TextUtils.isEmpty(mUser.getRemark()))
        txtRemark.setText(String.format(getString(R.string.profile_remark), mUser.getRemark()));
      else txtRemark.setText(R.string.profile_remark_none);
    }

    // 分组
    TextView txtGroups = (TextView) viewProfile.findViewById(R.id.txtGroups);
    txtGroups.setVisibility(mGroupMemberListed == null ? View.GONE : View.VISIBLE);
    txtGroups.setOnClickListener(this);
    if (mGroupMemberListed != null) {
      if (mGroupMemberListed.getLists().size() == 0) {
        txtGroups.setText(R.string.profile_group_none);
      } else {
        StringBuffer sb = new StringBuffer();
        for (GroupListed groupListed : mGroupMemberListed.getLists())
          sb.append(groupListed.getName()).append(" ");

        txtGroups.setText(
            String.format(getString(R.string.profile_group_hint), sb.toString().trim()));
      }
    }

    // 所在地
    TextView txtLocation = (TextView) viewProfile.findViewById(R.id.txtLocation);
    txtLocation.setText(mUser.getLocation());

    // 微博数
    TextView txtStatusCount = (TextView) viewProfile.findViewById(R.id.txtStatusCount);
    txtStatusCount.setText(AisenUtil.getCounter(mUser.getStatuses_count()));

    // 关注数
    viewProfile.findViewById(R.id.btnFriendCounter).setOnClickListener(this);
    TextView txtFriendCount = (TextView) viewProfile.findViewById(R.id.txtFriendCount);
    txtFriendCount.setText(AisenUtil.getCounter(mUser.getFriends_count()));

    // 粉丝数
    viewProfile.findViewById(R.id.btnFollowerCounter).setOnClickListener(this);
    TextView txtFollowerCount = (TextView) viewProfile.findViewById(R.id.txtFollowerCount);
    txtFollowerCount.setText(AisenUtil.getCounter(mUser.getFollowers_count()));
  }