protected void bindViewData(DMViewHolder holder, int position) {

    final DMBean msg = bean.get(position);
    UserBean user = msg.getUser();
    if (user != null) {
      buildAvatar(holder.avatar, position, user);
    } else {
      holder.avatar.setVisibility(View.INVISIBLE);
    }

    if (!TextUtils.isEmpty(msg.getListViewSpannableString())) {
      holder.content.setText(msg.getListViewSpannableString());
    } else {
      TimeLineUtility.addJustHighLightLinks(msg);
      holder.content.setText(msg.getListViewSpannableString());
    }
    String time = msg.getListviewItemShowTime();

    if (!holder.time.getText().toString().equals(time)) {
      holder.time.setText(time);
    }
    holder.time.setTag(msg.getId());
  }
Exemple #2
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() + ")");
  }