Пример #1
0
  @Override
  public void onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    if (bean.isFollowing()) {
      menu.findItem(R.id.menu_follow).setVisible(false);
      menu.findItem(R.id.menu_unfollow).setVisible(true);
      menu.findItem(R.id.menu_manage_group).setVisible(true);
    } else {
      menu.findItem(R.id.menu_follow).setVisible(true);
      menu.findItem(R.id.menu_unfollow).setVisible(false);
      menu.findItem(R.id.menu_manage_group).setVisible(false);
    }

    if (!bean.isFollowing() && bean.isFollow_me()) {
      menu.findItem(R.id.menu_remove_fan).setVisible(true);
    } else {
      menu.findItem(R.id.menu_remove_fan).setVisible(false);
    }
  }
Пример #2
0
  protected void buildAvatar(TimeLineAvatarImageView view, int position, final UserBean user) {
    ((IWeiciyuanDrawable) view).checkVerified(user);
    String image_url = user.getProfile_image_url();
    if (!TextUtils.isEmpty(image_url)) {
      view.setVisibility(View.VISIBLE);
      commander.downloadAvatar(view.getImageView(), user, (AbstractTimeLineFragment) fragment);
      view.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent intent = new Intent(getActivity(), UserInfoActivity.class);
              intent.putExtra("token", GlobalContext.getInstance().getSpecialToken());
              intent.putExtra("user", user);
              getActivity().startActivity(intent);
            }
          });

    } else {
      view.setVisibility(View.GONE);
    }
  }
Пример #3
0
  private void setValue() {
    getActivity().getActionBar().setTitle(bean.getScreen_name());
    if (TextUtils.isEmpty(bean.getRemark())) {
      layout.username.setText(bean.getScreen_name());
    } else {
      layout.username.setText(bean.getScreen_name() + "(" + bean.getRemark() + ")");
    }

    if (bean.isVerified()) {
      layout.isVerified.setVisibility(View.VISIBLE);
      layout.isVerified.setText(getString(R.string.verified_user));
      layout.verified_reason.setText(bean.getVerified_reason());
      layout.verified_layout.setVisibility(View.VISIBLE);
    } else {
      layout.verified_layout.setVisibility(View.GONE);
    }

    if (!TextUtils.isEmpty(bean.getDescription())) {
      layout.info.setText(bean.getDescription());
      layout.intro_layout.setVisibility(View.VISIBLE);
    } else {
      layout.intro_layout.setVisibility(View.GONE);
    }

    String avatarUrl = bean.getAvatar_large();
    if (!TextUtils.isEmpty(avatarUrl)) {
      avatarTask = new ProfileAvatarReadWorker(layout.avatar, avatarUrl);
      avatarTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
    }
    if (!TextUtils.isEmpty(bean.getUrl())) {

      layout.blog_url.setText(bean.getUrl());
      TimeLineUtility.addLinks(layout.blog_url);
      layout.blog_url_layout.setVisibility(View.VISIBLE);
      layout.blog_url.setVisibility(View.VISIBLE);
    } else {
      layout.blog_url_layout.setVisibility(View.GONE);
      layout.blog_url.setVisibility(View.GONE);
    }

    if (!TextUtils.isEmpty(bean.getLocation())) {
      layout.location.setText(bean.getLocation());
      layout.location_layout.setVisibility(View.VISIBLE);
    } else {
      layout.location_layout.setVisibility(View.GONE);
    }
    String s = bean.getGender();
    if (!TextUtils.isEmpty(s)) {
      if (s.equals("m")) layout.sex.setText(getString(R.string.m));
      else if (s.equals("f")) layout.sex.setText(getString(R.string.f));
      else layout.sex.setVisibility(View.GONE);
    }
    setTextViewNum(layout.fans_number, bean.getFollowers_count());
    setTextViewNum(layout.following_number, bean.getFriends_count());

    boolean he = bean.isFollow_me();
    boolean me = bean.isFollowing();

    if (he && me) {
      layout.relationship.setText(getString(R.string.following_each_other));
    } else if (he && !me) {
      layout.relationship.setText(getString(R.string.he_is_following_you));
    } else if (!he && me) {
      layout.relationship.setText(getString(R.string.you_is_following_he));
    } else {
      layout.relationship.setText(getString(R.string.stranger_each_other));
    }

    getActivity()
        .getActionBar()
        .getTabAt(1)
        .setText(getString(R.string.weibo) + "(" + bean.getStatuses_count() + ")");
  }