I have an issue with recycler view. I implemented a collapse logic as you can see on the code below. But when I close the second item the view disappear as you can see on the video. What am I doing wrong. Please assist. Thanks
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.report_layout, viewGroup, false);
final ReportHolder holder = new ReportHolder(v);
//hide half of the view
holder.linearLayout.setVisibility(View.GONE);
holder.tvPrintReceipt.setVisibility(View.INVISIBLE);
holder.tvClose.setOnClickListener(v1 -> {
TransitionManager.beginDelayedTransition(viewGroup, new AutoTransition());
holder.linearLayout.setVisibility(View.GONE);
holder.tvViewRecords.setVisibility(View.VISIBLE);
});
holder.tvViewRecords.setOnClickListener(v2 ->{
TransitionManager.beginDelayedTransition(viewGroup, new AutoTransition());
holder.linearLayout.setVisibility(View.VISIBLE);
holder.tvViewRecords.setVisibility(View.GONE);
});
return holder;
}