public List<Long> getPoiNodeRefToUpload() { List<Long> idsToUpload = new ArrayList<>(); for (PoiUpdateWrapper poiUpdateWrapper : poisWrapper) { if (poiUpdateWrapper.isSelected() && !poiUpdateWrapper.getIsPoi()) { idsToUpload.add(poiUpdateWrapper.getId()); } } return idsToUpload; }
@Override public void onBindViewHolder(final PoiViewHolder holder, final int position) { final PoiUpdateWrapper poiWrapper = poisWrapper.get(position); switch (poiWrapper.getAction()) { case CREATE: holder.getPoiAction().setText(context.getString(R.string.created)); break; case DELETED: holder.getPoiAction().setText(context.getString(R.string.deleted)); break; case UPDATE: holder.getPoiAction().setText(context.getString(R.string.updated)); break; } final LinearLayout wrapper = holder.getDetailsWrapper(); if (poiWrapper.getIsPoi()) { holder.getPoiType().setText(poiWrapper.getPoiType()); holder.getPoiName().setText(poiWrapper.getName()); holder.getExpandBtn().setVisibility(View.VISIBLE); populateDiffs(holder, holder.getDetailsWrapper(), poiWrapper); View.OnClickListener expendCardnew = new View.OnClickListener() { @Override public void onClick(View v) { poiWrapper.setOpen(!poiWrapper.isOpen()); ViewAnimation.animate(wrapper, poiWrapper.isOpen()); if (poiWrapper.isOpen()) { holder.getExpandBtn().setImageResource(R.drawable.chevron_up); } else { holder.getExpandBtn().setImageResource(R.drawable.chevron_down); } } }; holder.getExpandBtn().setOnClickListener(expendCardnew); holder.getHeader().setOnClickListener(expendCardnew); if (poiWrapper.isOpen()) { wrapper.setVisibility(View.VISIBLE); holder.getExpandBtn().setImageResource(R.drawable.chevron_up); } else { wrapper.setVisibility(View.GONE); holder.getExpandBtn().setImageResource(R.drawable.chevron_down); } } else { holder.getExpandBtn().setVisibility(View.GONE); wrapper.setVisibility(View.GONE); holder.getPoiType().setText(context.getString(R.string.node_ref_title)); holder.getPoiName().setText(""); } holder .getRevertBtn() .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { remove(poisWrapper.indexOf(poiWrapper)); } }); holder.getCheckbox().setChecked(poiWrapper.isSelected()); holder .getCheckbox() .setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { poiWrapper.setSelected(isChecked); } }); }