I have a weird issue with my checkboxes in RecyclerView.
When I click once on it everything works perfectly (move and change style) but when I click twice (enough fast) it performs some part of the code (just move it down and uncheck). I want to prevent it but I don't know how.
I tried the solution from here https://stackoverflow.com/a/16514644/10802597 but it makes it even worse (maybe I do it in a wrong way).
Here is my code:
holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            int currentPosition = holder.getAdapterPosition();
            if(isChecked){
                    FinalListItem finalItemBefore = finalListItems.get(currentPosition);
                    FinalListItem finalItemAfter = new FinalListItem(finalItemBefore.getName(), true);
                    finalListItems.remove(finalItemBefore);
                    finalListItems.add(finalItemAfter);
                    recyclerView.scrollToPosition(0);
                    holder.linearLayout.setBackgroundResource(R.drawable.listitem_green);
                    notifyItemMoved(currentPosition, getItemCount() - 1);
            }
            else{
                finalListItems.get(currentPosition).setChecked(false);
                notifyItemChanged(currentPosition);
            }
        }
    });

 
     
    