Program: 164600
Project: 164600
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ac_main);
  if (getSupportActionBar() != null) {
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
  }
  mRecyclerView=(RecyclerView)findViewById(R.id.recycler_view);
  final GridLayoutManager layoutManager=new GridLayoutManager(this,3);
  layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup(){
    @Override public int getSpanSize(    int position){
      if (!mAdapter.isContentView(position)) {
        return layoutManager.getSpanCount();
      }
 else {
        return 1;
      }
    }
  }
);
  mRecyclerView.setLayoutManager(layoutManager);
  mAdapter=new SimpleAdapter(values);
  mRecyclerView.setAdapter(mAdapter);
  mAdapter.setLoadMoreFooterView(new BaseLoadMoreFooterView(this){
    @Override public int getLoadMoreLayoutResource(){
      return R.layout.list_load_more;
    }
  }
);
  final PtrFrameLayout ptrFrameLayout=(PtrFrameLayout)findViewById(R.id.material_style_ptr_frame);
  final MaterialHeader header=new MaterialHeader(this);
  int[] colors=getResources().getIntArray(R.array.google_colors);
  header.setColorSchemeColors(colors);
  header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1,-2));
  header.setPadding(0,PtrLocalDisplay.dp2px(15),0,PtrLocalDisplay.dp2px(10));
  header.setPtrFrameLayout(ptrFrameLayout);
  ptrFrameLayout.setDurationToCloseHeader(1500);
  ptrFrameLayout.setHeaderView(header);
  ptrFrameLayout.addPtrUIHandler(header);
  ptrFrameLayout.setEnabledNextPtrAtOnce(false);
  ptrFrameLayout.setPtrHandler(new PtrHandler(){
    @Override public boolean checkCanDoRefresh(    PtrFrameLayout frame,    View content,    View header){
      return layoutManager.findFirstCompletelyVisibleItemPosition() <= 0;
    }
    @Override public void onRefreshBegin(    PtrFrameLayout frame){
      mLoadMoreListener.setPagination(1);
      ptrFrameLayout.postDelayed(new Runnable(){
        @Override public void run(){
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.notifyItemRangeInserted(0,10);
          ptrFrameLayout.refreshComplete();
          mRecyclerView.scrollToPosition(0);
        }
      }
,500);
    }
  }
);
  mLoadMoreListener=new EndlessRecyclerOnScrollListener(layoutManager){
    @Override public void onLoadMore(    final int pagination,    int pageSize){
      mRecyclerView.post(new Runnable(){
        @Override public void run(){
          mAdapter.showLoadMoreView();
        }
      }
);
      mRecyclerView.postDelayed(new Runnable(){
        @Override public void run(){
          int position=mAdapter.getItemCount();
          if (mAdapter.getItemCount() > 50) {
            mAdapter.showNoMoreDataView();
          }
 else {
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
          }
          mAdapter.notifyDataSetChanged();
          mRecyclerView.scrollToPosition(position);
          loadComplete();
          mAdapter.hideFooterView();
        }
      }
,1500);
    }
  }
;
  mRecyclerView.addOnScrollListener(mLoadMoreListener);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ac_main);
  if (getSupportActionBar() != null) {
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
  }
  mRecyclerView=(RecyclerView)findViewById(R.id.recycler_view);
  final GridLayoutManager layoutManager=new GridLayoutManager(this,3);
  layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup(){
    @Override public int getSpanSize(    int position){
      if (mAdapter.isContentView(position)) {
        return 1;
      }
 else {
        return layoutManager.getSpanCount();
      }
    }
  }
);
  mRecyclerView.setLayoutManager(layoutManager);
  mAdapter=new SimpleAdapter(values);
  mRecyclerView.setAdapter(mAdapter);
  mAdapter.setLoadMoreFooterView(new BaseLoadMoreFooterView(this){
    @Override public int getLoadMoreLayoutResource(){
      return R.layout.list_load_more;
    }
  }
);
  final PtrFrameLayout ptrFrameLayout=(PtrFrameLayout)findViewById(R.id.material_style_ptr_frame);
  final MaterialHeader header=new MaterialHeader(this);
  int[] colors=getResources().getIntArray(R.array.google_colors);
  header.setColorSchemeColors(colors);
  header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1,-2));
  header.setPadding(0,PtrLocalDisplay.dp2px(15),0,PtrLocalDisplay.dp2px(10));
  header.setPtrFrameLayout(ptrFrameLayout);
  ptrFrameLayout.setDurationToCloseHeader(1500);
  ptrFrameLayout.setHeaderView(header);
  ptrFrameLayout.addPtrUIHandler(header);
  ptrFrameLayout.setEnabledNextPtrAtOnce(false);
  ptrFrameLayout.setPtrHandler(new PtrHandler(){
    @Override public boolean checkCanDoRefresh(    PtrFrameLayout frame,    View content,    View header){
      return layoutManager.findFirstCompletelyVisibleItemPosition() <= 0;
    }
    @Override public void onRefreshBegin(    PtrFrameLayout frame){
      mLoadMoreListener.setPagination(1);
      ptrFrameLayout.postDelayed(new Runnable(){
        @Override public void run(){
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.appendToTop(mAdapter.getItemCount() + "String_Node_Str");
          mAdapter.notifyItemRangeInserted(0,10);
          ptrFrameLayout.refreshComplete();
          mRecyclerView.scrollToPosition(0);
        }
      }
,500);
    }
  }
);
  mLoadMoreListener=new EndlessRecyclerOnScrollListener(layoutManager){
    @Override public void onLoadMore(    final int pagination,    int pageSize){
      mRecyclerView.post(new Runnable(){
        @Override public void run(){
          mAdapter.showLoadMoreView();
        }
      }
);
      mRecyclerView.postDelayed(new Runnable(){
        @Override public void run(){
          int position=mAdapter.getItemCount();
          if (mAdapter.getItemCount() > 50) {
            mAdapter.showNoMoreDataView();
          }
 else {
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
            mAdapter.append(pagination + "String_Node_Str" + mAdapter.getItemCount());
          }
          mAdapter.notifyDataSetChanged();
          mRecyclerView.scrollToPosition(position);
          loadComplete();
          mAdapter.hideFooterView();
        }
      }
,1500);
    }
  }
;
  mRecyclerView.addOnScrollListener(mLoadMoreListener);
}