public void setValue(DebtPackageInfoAppDto dto) {
    if (dto == null) return;

    this.dto = dto;

    fenqiHeadImageView.setDefaultImageResId(R.drawable.fenqi_head_default);
    fenqiHeadImageView.setErrorImageResId(R.drawable.fenqi_head_default);
    fenqiHeadImageView.setLocalImageBitmap(R.drawable.fenqi_head_default);
    fenqiHeadImageView.setImageUrl(
        dto.getLogoImg(), ImageCacheManager.getInstance().getImageLoader());

    nameTextView.setText(dto.getRealName());

    companyTextView.setText("(" + dto.getOrganization() + ")");

    fenqiDescTextView.setText("分期消费:" + dto.getGoodsName() + " ¥" + dto.getGoodsPrice());

    totalAmountTextView.setText(this.dto.getTotalMoney());
    transferMoneyTextView.setText(this.dto.getMaxMoney());
    surplusTextView.setText(this.dto.getMaxPeriod() + "");
    purchaseIncentivesTextView.setText(this.dto.getReward());
    expectedRateTextView.setText(this.dto.getMinRate() + "%");

    repaymentTypeTextView.setText("按天付息,到期还本");
    recordsCountTextView.setText(this.dto.getPeople() + "");

    if (null != dto.getRewardRate()) {
      rewardRateTextView.setText("加息" + dto.getRewardRate() + "%");
      handler.postDelayed(runnable, 1000); // 开始Timer
    }
  }
Exemple #2
0
  public void setPost(final Post post, final ThreadManager manager) {
    this.post = post;
    this.manager = manager;

    highlightQuotesNo = -1;

    boolean boardCatalogMode =
        manager.getLoadable().isBoardMode() || manager.getLoadable().isCatalogMode();

    TypedArray ta =
        context.obtainStyledAttributes(null, R.styleable.PostView, R.attr.post_style, 0);

    if (!isBuild) {
      buildView(context, ta);
      isBuild = true;
    }

    int dateColor = ta.getColor(R.styleable.PostView_date_color, 0);
    int savedReplyColor = ta.getColor(R.styleable.PostView_saved_reply_color, 0);
    int highlightedColor = ta.getColor(R.styleable.PostView_highlighted_color, 0);
    int detailSize = ta.getDimensionPixelSize(R.styleable.PostView_detail_size, 0);

    ta.recycle();

    if (post.hasImage) {
      imageView.setVisibility(View.VISIBLE);
      imageView.setImageUrl(post.thumbnailUrl, ChanApplication.getVolleyImageLoader());
    } else {
      imageView.setVisibility(View.GONE);
      imageView.setImageUrl(null, null);
    }

    CharSequence total = new SpannableString("");

    if (post.subjectSpan != null) {
      total = TextUtils.concat(total, post.subjectSpan);
    }

    if (isList()) {
      CharSequence relativeTime =
          DateUtils.getRelativeTimeSpanString(
              post.time * 1000L, Time.get(), DateUtils.SECOND_IN_MILLIS, 0);
      SpannableString date = new SpannableString("No." + post.no + " " + relativeTime);
      date.setSpan(new ForegroundColorSpan(dateColor), 0, date.length(), 0);
      date.setSpan(new AbsoluteSizeSpan(detailSize), 0, date.length(), 0);

      total =
          TextUtils.concat(
              total,
              post.subjectSpan == null ? "" : "\n",
              post.nameTripcodeIdCapcodeSpan,
              date,
              " ");
    }

    if (!TextUtils.isEmpty(total)) {
      titleView.setText(total);
      titleView.setVisibility(View.VISIBLE);
    } else {
      titleView.setVisibility(View.GONE);
    }

    commentView.setText(post.comment);

    if (manager.getLoadable().isThreadMode()) {
      post.setLinkableListener(this);
      commentView.setMovementMethod(new PostViewMovementMethod());
      commentView.setOnClickListener(this);
    } else {
      post.setLinkableListener(null);
      commentView.setOnClickListener(null);
      commentView.setClickable(false);
      commentView.setMovementMethod(null);
    }

    if (isGrid()
        || ((post.isOP && boardCatalogMode && post.replies > 0) || (post.repliesFrom.size() > 0))) {
      repliesCountView.setVisibility(View.VISIBLE);

      String text = "";

      int count = boardCatalogMode ? post.replies : post.repliesFrom.size();

      if (count != 1) {
        text = count + " " + context.getString(R.string.multiple_replies);
      } else if (count == 1) {
        text = count + " " + context.getString(R.string.one_reply);
      }

      if (boardCatalogMode && post.images > 0) {
        if (post.images != 1) {
          text += ", " + post.images + " " + context.getString(R.string.multiple_images);
        } else {
          text += ", " + post.images + " " + context.getString(R.string.one_image);
        }
      }

      if (manager.getLoadable().isThreadMode()) {
        repliesCountView.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                manager.showPostReplies(post);
              }
            });
      }

      repliesCountView.setText(text);
    } else {
      repliesCountView.setVisibility(View.GONE);
      repliesCountView.setOnClickListener(null);
    }

    boolean showCountryFlag =
        isList() && !TextUtils.isEmpty(post.country) && !TextUtils.isEmpty(post.countryUrl);
    boolean showStickyIcon = isList() && post.sticky;
    boolean showDeletedIcon = isList() && post.deleted;
    boolean showArchivedIcon = isList() && post.archived;
    boolean showClosedIcon = isList() && post.closed && !showArchivedIcon;

    iconsView.setVisibility(
        (showCountryFlag || showStickyIcon || showClosedIcon || showDeletedIcon || showArchivedIcon)
            ? View.VISIBLE
            : View.GONE);

    stickyView.setVisibility(showStickyIcon ? View.VISIBLE : View.GONE);
    closedView.setVisibility(showClosedIcon ? View.VISIBLE : View.GONE);
    deletedView.setVisibility(showDeletedIcon ? View.VISIBLE : View.GONE);
    archivedView.setVisibility(showArchivedIcon ? View.VISIBLE : View.GONE);
    if (showCountryFlag) {
      countryView.setVisibility(View.VISIBLE);
      countryView.setImageUrl(post.countryUrl, ChanApplication.getVolleyImageLoader());
    } else {
      countryView.setVisibility(View.GONE);
      countryView.setImageUrl(null, null);
    }

    if (post.isSavedReply) {
      full.setBackgroundColor(savedReplyColor);
    } else if (manager.isPostHightlighted(post)) {
      full.setBackgroundColor(highlightedColor);
    } else {
      full.setBackgroundColor(0x00000000);
    }

    if (manager.isPostLastSeen(post)) {
      lastSeen.setVisibility(View.VISIBLE);
    } else {
      lastSeen.setVisibility(View.GONE);
    }
  }