@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder instanceof AtyViewHolder) { // ViewCompat.setTransitionName( ((AtyViewHolder) holder).activityItem.user_name,"1"); // ((AtyViewHolder) holder).activityItem.user_name.setText(atyItem.getUserName()); // ((AtyViewHolder) holder).activityItem.user_photo.setImageResource(atyItem.getUserIcon()); ((AtyViewHolder) holder).aty_name.setText(atyItem.getAtyName()); ((AtyViewHolder) holder).aty_content.setText(atyItem.getAtyContent()); ((AtyViewHolder) holder).total_comment.setText(atyItem.getAtyComment()); ((AtyViewHolder) holder).totle_plus.setText(atyItem.getAtyPlus()); ((AtyViewHolder) holder) .publish_time.setText(atyItem.getAtyStartTime() + "-\n" + atyItem.getAtyEndTime()); ((AtyViewHolder) holder).activity_tag.setText(atyItem.getAtyType()); ((AtyViewHolder) holder).imageViewContainer.removeAllViews(); ((AtyViewHolder) holder).atyPlace.setText(atyItem.getAtyPlace()); ((AtyViewHolder) holder).total_member.setText(atyItem.getAtyMembers()); if (atyItem.getAtyPlused().equals("false")) { ((AtyViewHolder) holder) .plus_fab.setBackgroundTintList( ColorStateList.valueOf(activity.getResources().getColor(R.color.fab_gray))); ((AtyViewHolder) holder) .plus_fab.setImageDrawable( activity.getResources().getDrawable(R.drawable.ic_action_plus_one)); } else if (atyItem.getAtyPlused().equals("true")) { ((AtyViewHolder) holder) .plus_fab.setBackgroundTintList( ColorStateList.valueOf(activity.getResources().getColor(R.color.primary))); ((AtyViewHolder) holder) .plus_fab.setImageDrawable( activity.getResources().getDrawable(R.drawable.ic_action_plus_one_white)); } if (atyItem.getAtyJoined().equals("true")) { ((AtyViewHolder) holder).mjoinBtn.setText("已加入"); ((AtyViewHolder) holder) .mjoinBtn.setTextColor(activity.getResources().getColor(R.color.primary)); } else if (atyItem.getAtyJoined().equals("false")) { ((AtyViewHolder) holder).mjoinBtn.setText("加入"); ((AtyViewHolder) holder) .mjoinBtn.setTextColor(activity.getResources().getColor(R.color.black)); } for (int i = 0; i < atyItem.getAtyAlbum().size(); i++) { ImageView imageView = (ImageView) activity.getLayoutInflater().inflate(R.layout.image, null); WindowManager windowManager = activity.getWindowManager(); DisplayMetrics dm = new DisplayMetrics(); Display display = windowManager.getDefaultDisplay(); int width = display.getWidth() - 7; int height = display.getHeight(); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(width, height * 2 / 5); Glide.with(activity).load(atyItem.getAtyAlbum().get(i)).into(imageView); imageView.setLayoutParams(layoutParams); imageView.setTag(i); imageView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // Uri uri = atyItem.getAtyAlbum().get((Integer)v.getTag()); MyDialog dialog = new MyDialog(); dialog.setUri(atyItem.getAtyAlbum().get((Integer) v.getTag())); dialog.show(activity.getSupportFragmentManager(), "showPicture"); } }); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); ((AtyViewHolder) holder).imageViewContainer.addView(imageView); } setAnimation(((AtyViewHolder) holder).cardView, position); } else if (holder instanceof CommentViewHolder) { CommentData item = commentDatas.get(position - 1); // ((CommentViewHolder) holder).user_name.setText(item.getUserName()); ((CommentViewHolder) holder).time.setText(item.getTime()); // ((CommentViewHolder) holder).user_photo.setImageResource(item.getUserIcon()); ((CommentViewHolder) holder).user_comment.setText(item.getComment()); } }
@Provides LayoutInflater layoutInflater() { return activity.getLayoutInflater(); }