So what I'm trying to achieve is the following:
I have a list of items in the recycler view (upto) 24 line items in the recycler.
In one list view item there will be a left and right item that a user can click on.
When the user clicks on one of the listviews (left or right item in the listview) the rest of the items should be disabled. Which means out of the 24 items listed the rest of the 23 items should be disabled as well as the list item not selected (if clicked the left item in the list view then the right one is also disabled and vice versa).
public class SheetAdapter extends RecyclerView.Adapter<SheetAdapter.ViewHolder> {
public SheetAdapter(Context mCtx, List<Items> listList) {
...Init all the items here
}
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mCtx).inflate(R.layout.list_layout, parent,false);
return new ViewHolder(view);
}
public void onBindViewHolder(ViewHolder holder, int position) {
final List listItem = list.get(position);
...(setup the view etc)
holder.leftImageView.setOnClickListener(v -> {
// Gray Out all the Left and Right list items not selected
}
holder.leftImageView.setOnClickListener(v -> {
// Gray Out all the Left and Right list items not selected
}
}
}
My question is how do i get a reference to the remaining items in the list (left and right) items so that I can disable them!?
UPDATE:
----------------------------------------------------
| | | |
| Left item 1| | Right item 1|
| | | |
|---------------------------------------------------
| | | |
| Left item 2| | Right item 2|
| | | |
|---------------------------------------------------
| | | |
| Left item 3| | Right item 3|
| | | |
|---------------------------------------------------
| |
| |
So if a user selects the Right item 2, the behavior I'm looking for would gray out/disable BOTH right and left item 1 as well as BOTH right and left item 3 and last but not least JUST the left item 2