@Override public void onClick(View view) { PictureMemory memory = (PictureMemory) dataSet.get(getAdapterPosition()); Intent intent = new Intent(context, PhotoActivity.class); intent.putExtra(PhotoActivity.EXTRA_PLACE_NAME, memory.getTitle()); intent.putExtra(PhotoActivity.EXTRA_FILENAMES, memory.getPictures()); context.startActivity(intent); }
private void bindPictureViewHolder(RecyclerView.ViewHolder holder, int position) { PictureMemory memory = (PictureMemory) dataSet.get(position); PictureViewHolder pvh = (PictureViewHolder) holder; pvh.placeTv.setText(memory.getTitle()); pvh.timeTv.setText(memory.getTime()); String[] pictures = memory.getPictures(); if (pictures != null) { if (pictures.length < 3) { String firstPicName = pictures[0]; imageHelper.loadImage(pvh.imageView, firstPicName, 400, 400); pvh.imageView.setVisibility(View.VISIBLE); for (int i = 0; i < 9; i++) { pvh.nine[i].setVisibility(View.GONE); } } else if (pictures.length >= 3 && pictures.length < 6) { for (int i = 0; i < 3; i++) { String firstPicName = pictures[i]; imageHelper.loadSquareImage(pvh.nine[i], firstPicName, 300); pvh.nine[i].setVisibility(View.VISIBLE); } pvh.imageView.setVisibility(View.GONE); for (int i = 3; i < 9; i++) { pvh.nine[i].setVisibility(View.GONE); } } else if (pictures.length >= 6 && pictures.length < 9) { for (int i = 0; i < 6; i++) { String firstPicName = pictures[i]; imageHelper.loadSquareImage(pvh.nine[i], firstPicName, 300); pvh.nine[i].setVisibility(View.VISIBLE); } pvh.imageView.setVisibility(View.GONE); for (int i = 6; i < 9; i++) { pvh.nine[i].setVisibility(View.GONE); } } else if (pictures.length >= 9) { for (int i = 0; i < 9; i++) { String firstPicName = pictures[i]; imageHelper.loadSquareImage(pvh.nine[i], firstPicName, 300); pvh.nine[i].setVisibility(View.VISIBLE); } pvh.imageView.setVisibility(View.GONE); } } }