Program: 111084
Project: 111084
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ultimate_recyclerview_activity);
  toolbar=(Toolbar)findViewById(R.id.tool_bar);
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayShowTitleEnabled(false);
  ultimateRecyclerView=(UltimateRecyclerView)findViewById(R.id.ultimate_recycler_view);
  ultimateRecyclerView.setHasFixedSize(false);
  List<String> stringList=new ArrayList<>();
  simpleRecyclerViewAdapter=new SimpleAdapter(stringList);
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  linearLayoutManager=new LinearLayoutManager(this);
  ultimateRecyclerView.setLayoutManager(linearLayoutManager);
  ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
  ultimateRecyclerView.enableLoadmore();
  simpleRecyclerViewAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar,null));
  ultimateRecyclerView.setParallaxHeader(getLayoutInflater().inflate(R.layout.parallax_recyclerview_header,ultimateRecyclerView.mRecyclerView,false));
  ultimateRecyclerView.setOnParallaxScroll(new UltimateRecyclerView.OnParallaxScroll(){
    @Override public void onParallaxScroll(    float percentage,    float offset,    View parallax){
      Drawable c=toolbar.getBackground();
      c.setAlpha(Math.round(127 + percentage * 128));
      toolbar.setBackgroundDrawable(c);
    }
  }
);
  ultimateRecyclerView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
    @Override public void onRefresh(){
      new Handler().postDelayed(new Runnable(){
        @Override public void run(){
          simpleRecyclerViewAdapter.insert("String_Node_Str",0);
          ultimateRecyclerView.setRefreshing(false);
          linearLayoutManager.scrollToPosition(0);
        }
      }
,1000);
    }
  }
);
  ultimateRecyclerView.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener(){
    @Override public void loadMore(    int itemsCount,    final int maxLastVisiblePosition){
      Handler handler=new Handler();
      handler.postDelayed(new Runnable(){
        public void run(){
          simpleRecyclerViewAdapter.insert("String_Node_Str" + moreNum++,simpleRecyclerViewAdapter.getAdapterItemCount());
          simpleRecyclerViewAdapter.insert("String_Node_Str" + moreNum++,simpleRecyclerViewAdapter.getAdapterItemCount());
          simpleRecyclerViewAdapter.insert("String_Node_Str" + moreNum++,simpleRecyclerViewAdapter.getAdapterItemCount());
        }
      }
,1000);
    }
  }
);
  ultimateRecyclerView.setScrollViewCallbacks(new ObservableScrollViewCallbacks(){
    @Override public void onScrollChanged(    int scrollY,    boolean firstScroll,    boolean dragging){
    }
    @Override public void onDownMotionEvent(){
    }
    @Override public void onUpOrCancelMotionEvent(    ObservableScrollState observableScrollState){
      if (observableScrollState == ObservableScrollState.DOWN) {
        ultimateRecyclerView.showToolbar(toolbar,ultimateRecyclerView,getScreenHeight());
      }
 else       if (observableScrollState == ObservableScrollState.UP) {
        ultimateRecyclerView.hideToolbar(toolbar,ultimateRecyclerView,getScreenHeight());
      }
 else       if (observableScrollState == ObservableScrollState.STOP) {
      }
    }
  }
);
  itemTouchListenerAdapter=new ItemTouchListenerAdapter(ultimateRecyclerView.mRecyclerView,new ItemTouchListenerAdapter.RecyclerViewOnItemClickListener(){
    @Override public void onItemClick(    RecyclerView parent,    View clickedView,    int position){
      Logs.d("String_Node_Str");
      if (actionMode != null && isDrag) {
        toggleSelection(position);
      }
    }
    @Override public void onItemLongClick(    RecyclerView parent,    View clickedView,    int position){
      Logs.d("String_Node_Str" + isDrag);
      if (isDrag) {
        Logs.d("String_Node_Str" + isDrag);
        toolbar.startActionMode(UltimateRecyclerViewActivity.this);
        toggleSelection(position);
        dragDropTouchListener.startDrag();
        ultimateRecyclerView.enableSwipeRefresh(false);
      }
    }
  }
);
  ultimateRecyclerView.mRecyclerView.addOnItemTouchListener(itemTouchListenerAdapter);
  ultimateRecyclerView.setSwipeToDismissCallback(new SwipeToDismissTouchListener.DismissCallbacks(){
    @Override public SwipeToDismissTouchListener.SwipeDirection dismissDirection(    int position){
      return SwipeToDismissTouchListener.SwipeDirection.BOTH;
    }
    @Override public void onDismiss(    RecyclerView view,    List<SwipeToDismissTouchListener.PendingDismissData> dismissData){
      for (      SwipeToDismissTouchListener.PendingDismissData data : dismissData) {
        simpleRecyclerViewAdapter.remove(data.position);
      }
    }
    @Override public void onResetMotion(){
      isDrag=true;
    }
    @Override public void onTouchDown(){
      isDrag=false;
    }
  }
);
  dragDropTouchListener=new DragDropTouchListener(ultimateRecyclerView.mRecyclerView,this){
    @Override protected void onItemSwitch(    RecyclerView recyclerView,    int from,    int to){
      simpleRecyclerViewAdapter.swapPositions(from,to);
      simpleRecyclerViewAdapter.clearSelection(from);
      simpleRecyclerViewAdapter.notifyItemChanged(to);
      if (actionMode != null)       actionMode.finish();
      Logs.d("String_Node_Str");
    }
    @Override protected void onItemDrop(    RecyclerView recyclerView,    int position){
      Logs.d("String_Node_Str");
      ultimateRecyclerView.enableSwipeRefresh(true);
    }
  }
;
  dragDropTouchListener.setCustomDragHighlight(getResources().getDrawable(R.drawable.custom_drag_frame));
  ultimateRecyclerView.mRecyclerView.addOnItemTouchListener(dragDropTouchListener);
  Spinner spinner=(Spinner)findViewById(R.id.spinner);
  ArrayAdapter<String> spinnerAdapter=new ArrayAdapter<>(this,android.R.layout.simple_list_item_1);
  for (  Type type : Type.values()) {
    spinnerAdapter.add(type.getTitle());
  }
  spinner.setAdapter(spinnerAdapter);
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      Logs.d("String_Node_Str" + Type.values()[position].getTitle());
      ultimateRecyclerView.setItemAnimator(Type.values()[position].getAnimator());
      ultimateRecyclerView.getItemAnimator().setAddDuration(300);
      ultimateRecyclerView.getItemAnimator().setRemoveDuration(300);
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  findViewById(R.id.add).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      simpleRecyclerViewAdapter.insert("String_Node_Str",1);
    }
  }
);
  findViewById(R.id.del).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      simpleRecyclerViewAdapter.remove(1);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ultimate_recyclerview_activity);
  toolbar=(Toolbar)findViewById(R.id.tool_bar);
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayShowTitleEnabled(false);
  ultimateRecyclerView=(UltimateRecyclerView)findViewById(R.id.ultimate_recycler_view);
  ultimateRecyclerView.setHasFixedSize(false);
  List<String> stringList=new ArrayList<>();
  simpleRecyclerViewAdapter=new SimpleAdapter(stringList);
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  stringList.add("String_Node_Str");
  linearLayoutManager=new LinearLayoutManager(this);
  ultimateRecyclerView.setLayoutManager(linearLayoutManager);
  ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
  ultimateRecyclerView.enableLoadmore();
  simpleRecyclerViewAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar,null));
  ultimateRecyclerView.setParallaxHeader(getLayoutInflater().inflate(R.layout.parallax_recyclerview_header,ultimateRecyclerView.mRecyclerView,false));
  ultimateRecyclerView.setOnParallaxScroll(new UltimateRecyclerView.OnParallaxScroll(){
    @Override public void onParallaxScroll(    float percentage,    float offset,    View parallax){
      Drawable c=toolbar.getBackground();
      c.setAlpha(Math.round(127 + percentage * 128));
      toolbar.setBackgroundDrawable(c);
    }
  }
);
  ultimateRecyclerView.setDefaultOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
    @Override public void onRefresh(){
      new Handler().postDelayed(new Runnable(){
        @Override public void run(){
          simpleRecyclerViewAdapter.insert("String_Node_Str",0);
          ultimateRecyclerView.setRefreshing(false);
          linearLayoutManager.scrollToPosition(0);
        }
      }
,1000);
    }
  }
);
  ultimateRecyclerView.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener(){
    @Override public void loadMore(    int itemsCount,    final int maxLastVisiblePosition){
      Handler handler=new Handler();
      handler.postDelayed(new Runnable(){
        public void run(){
          simpleRecyclerViewAdapter.insert("String_Node_Str" + moreNum++,simpleRecyclerViewAdapter.getAdapterItemCount());
          simpleRecyclerViewAdapter.insert("String_Node_Str" + moreNum++,simpleRecyclerViewAdapter.getAdapterItemCount());
          simpleRecyclerViewAdapter.insert("String_Node_Str" + moreNum++,simpleRecyclerViewAdapter.getAdapterItemCount());
        }
      }
,1000);
    }
  }
);
  ultimateRecyclerView.setScrollViewCallbacks(new ObservableScrollViewCallbacks(){
    @Override public void onScrollChanged(    int scrollY,    boolean firstScroll,    boolean dragging){
    }
    @Override public void onDownMotionEvent(){
    }
    @Override public void onUpOrCancelMotionEvent(    ObservableScrollState observableScrollState){
      if (observableScrollState == ObservableScrollState.DOWN) {
        ultimateRecyclerView.showToolbar(toolbar,ultimateRecyclerView,getScreenHeight());
      }
 else       if (observableScrollState == ObservableScrollState.UP) {
        ultimateRecyclerView.hideToolbar(toolbar,ultimateRecyclerView,getScreenHeight());
      }
 else       if (observableScrollState == ObservableScrollState.STOP) {
      }
    }
  }
);
  itemTouchListenerAdapter=new ItemTouchListenerAdapter(ultimateRecyclerView.mRecyclerView,new ItemTouchListenerAdapter.RecyclerViewOnItemClickListener(){
    @Override public void onItemClick(    RecyclerView parent,    View clickedView,    int position){
      Logs.d("String_Node_Str");
      if (actionMode != null && isDrag) {
        toggleSelection(position);
      }
    }
    @Override public void onItemLongClick(    RecyclerView parent,    View clickedView,    int position){
      Logs.d("String_Node_Str" + isDrag);
      if (isDrag) {
        Logs.d("String_Node_Str" + isDrag);
        toolbar.startActionMode(UltimateRecyclerViewActivity.this);
        toggleSelection(position);
        dragDropTouchListener.startDrag();
        ultimateRecyclerView.enableDefaultSwipeRefresh(false);
      }
    }
  }
);
  ultimateRecyclerView.mRecyclerView.addOnItemTouchListener(itemTouchListenerAdapter);
  ultimateRecyclerView.setSwipeToDismissCallback(new SwipeToDismissTouchListener.DismissCallbacks(){
    @Override public SwipeToDismissTouchListener.SwipeDirection dismissDirection(    int position){
      return SwipeToDismissTouchListener.SwipeDirection.BOTH;
    }
    @Override public void onDismiss(    RecyclerView view,    List<SwipeToDismissTouchListener.PendingDismissData> dismissData){
      for (      SwipeToDismissTouchListener.PendingDismissData data : dismissData) {
        simpleRecyclerViewAdapter.remove(data.position);
      }
    }
    @Override public void onResetMotion(){
      isDrag=true;
    }
    @Override public void onTouchDown(){
      isDrag=false;
    }
  }
);
  dragDropTouchListener=new DragDropTouchListener(ultimateRecyclerView.mRecyclerView,this){
    @Override protected void onItemSwitch(    RecyclerView recyclerView,    int from,    int to){
      simpleRecyclerViewAdapter.swapPositions(from,to);
      simpleRecyclerViewAdapter.clearSelection(from);
      simpleRecyclerViewAdapter.notifyItemChanged(to);
      if (actionMode != null)       actionMode.finish();
      Logs.d("String_Node_Str");
    }
    @Override protected void onItemDrop(    RecyclerView recyclerView,    int position){
      Logs.d("String_Node_Str");
      ultimateRecyclerView.enableDefaultSwipeRefresh(true);
    }
  }
;
  dragDropTouchListener.setCustomDragHighlight(getResources().getDrawable(R.drawable.custom_drag_frame));
  ultimateRecyclerView.mRecyclerView.addOnItemTouchListener(dragDropTouchListener);
  Spinner spinner=(Spinner)findViewById(R.id.spinner);
  ArrayAdapter<String> spinnerAdapter=new ArrayAdapter<>(this,android.R.layout.simple_list_item_1);
  for (  Type type : Type.values()) {
    spinnerAdapter.add(type.getTitle());
  }
  spinner.setAdapter(spinnerAdapter);
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      Logs.d("String_Node_Str" + Type.values()[position].getTitle());
      ultimateRecyclerView.setItemAnimator(Type.values()[position].getAnimator());
      ultimateRecyclerView.getItemAnimator().setAddDuration(300);
      ultimateRecyclerView.getItemAnimator().setRemoveDuration(300);
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  findViewById(R.id.add).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      simpleRecyclerViewAdapter.insert("String_Node_Str",1);
    }
  }
);
  findViewById(R.id.del).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      simpleRecyclerViewAdapter.remove(1);
    }
  }
);
}