コード例 #1
0
  @Override
  public void setData(RecommendContent data) {

    super.setData(data);
    recommendContent = data;
    simpleDraweeView1.setImageURI(Uri.parse(recommendContent.getImgUrl1()));
    simpleDraweeView2.setImageURI(Uri.parse(recommendContent.getImgUrl2()));
    title1.setText(recommendContent.getTitle1());
    title2.setText(recommendContent.getTitle2());
    content1.setText(recommendContent.getContent1());
    content2.setText(recommendContent.getContent2());
    cardView1.setOnClickListener(this);
    cardView2.setOnClickListener(this);
  }
コード例 #2
0
  @Override
  public void setData(Article data) {
    super.setData(data);
    tvAuthor.setText(data.getSlug());
    tvComment.setText(data.getCommentsCount() + "评论");
    tvTitle.setText(data.getTitle());

    Glide.with(getContext())
        .load(data.getTitleImage())
        .centerCrop()
        .error(R.drawable.error)
        .placeholder(R.drawable.error) // 占位图
        .diskCacheStrategy(DiskCacheStrategy.SOURCE)
        .into(imageview);
  }
コード例 #3
0
ファイル: RegionView.java プロジェクト: Hi-Mike/EmotionShow
 @Override
 public void OnBindViewHolder(BaseViewHolder holder, int position) {
   holder.setData(getItem(position));
 }
コード例 #4
0
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  @Override
  public void setData(SubCommentDataModel data) {
    super.setData(data);
    this.data = data;
    try {
      String result = URLDecoder.decode(data.getSubCommentContent(), Xml.Encoding.UTF_8.name());
      commentContent.setText(result);
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
    userName.setText(data.getUserName());
    userIcon.setImageURI(Uri.parse(data.getUserImg()));
    time.setText(data.getSubTime());
    if (data.getLikeNumber() == 0) {
      likeNumber.setText("点赞");
    } else {
      likeNumber.setText(String.valueOf(data.getLikeNumber()));
    }
    levels.setText(String.valueOf(getAdapterPosition() + 1) + "楼");

    if (SubCommentAdapter.isNotLike.get(data.getCid()) == null) {
      HashMap<Integer, Boolean> hashMap = new HashMap<>();
      hashMap.put(getAdapterPosition(), false);
      ArrayList<HashMap<Integer, Boolean>> list = new ArrayList<>();
      list.add(getAdapterPosition(), hashMap);
      SubCommentAdapter.isNotLike.put(data.getCid(), list);
      likeIcon.setBackground(getContext().getResources().getDrawable(R.mipmap.like));
      isNotLike = false;
    } else {
      if (getAdapterPosition() == SubCommentAdapter.isNotLike.get(data.getCid()).size()) {
        HashMap<Integer, Boolean> hashMap = new HashMap<>();
        hashMap.put(getAdapterPosition(), false);
        SubCommentAdapter.isNotLike.get(data.getCid()).add(getAdapterPosition(), hashMap);
      }
      likeIcon.setBackground(getContext().getResources().getDrawable(R.mipmap.like));
      isNotLike = false;
    }

    if (SubCommentAdapter.isNotLike.get(data.getCid()) != null
        && SubCommentAdapter.isNotLike.get(data.getCid()).get(getAdapterPosition()) != null) {
      if (SubCommentAdapter.isNotLike
              .get(data.getCid())
              .get(getAdapterPosition())
              .get(getAdapterPosition())
          != null) {
        if (SubCommentAdapter.isNotLike
            .get(data.getCid())
            .get(getAdapterPosition())
            .get(getAdapterPosition())) {
          likeIcon.setBackground(getContext().getResources().getDrawable(R.mipmap.like_click));
          isNotLike = true;
        } else {
          likeIcon.setBackground(getContext().getResources().getDrawable(R.mipmap.like));
          isNotLike = false;
        }
      }
    }

    likeIcon.setOnClickListener(this);
  }