I wanna show all check box in all item of recycler view . when i long click on them. I will show you what i want to do in this image.
When i long click on the picture folder in other folders a empty check box will appear then we can choose them and do what we want to them. at the end how can i do this when i click on item and this happen.
this my adapter .
public class NoteAdapter extends Adapter<NoteAdapter.MyView> {
List<Note> notes;
Activity activity1;
public NoteAdapter(List<Note> noteList, Activity activity) {
activity1 = activity;
notes = noteList;
}
@NonNull
@Override
public NoteAdapter.MyView onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_note, parent, false);
return new MyView(itemView);
}
@Override
public void onBindViewHolder(@NonNull final NoteAdapter.MyView holder, final int position) {
holder.note.setText(notes.get(position).note);
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
holder.checkbox.setVisibility(View.VISIBLE);
//the code at the line up just set visible the selected item but i want to set visible all items check boxs
return false;
}
});
}
@Override
public int getItemCount() {
return notes.size();
}
public class MyView extends RecyclerView.ViewHolder {
private TextView name;
private CheckBox checkBox;
public MyView(@NonNull View itemView) {
super(itemView);
note = itemView.findViewById(R.id.note);
chackbox = itemView.findViewById(R.id.chackBox);
}
}
}