Program: 171703
Project: 171703
Buggy source:
@Nullable @Override public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_movies_now_showing,container,false);
  mRecyclerView=(RecyclerView)view.findViewById(R.id.recyclerview_now_showing);
  mMovies=new ArrayList<>();
  mMoviesAdapter=new MoviesAdapter(getContext(),mMovies,new MoviesAdapter.OnBindViewHolderListener(){
    @Override public void onBindViewHolder(    MoviesAdapter.MoviesViewHolder holder,    int position){
      if (position % mMoviesAdapter.getLargeViewInterval() == 0) {
        holder.movieTitleTextView.setText(mMovies.get(position).getTitle());
        Glide.with(getContext()).load("String_Node_Str" + mMovies.get(position).getBackdropPath()).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).into(holder.movieImageView);
      }
 else {
        holder.movieTitleTextView.setText(mMovies.get(position).getTitle());
        Glide.with(getContext()).load("String_Node_Str" + mMovies.get(position).getPosterPath()).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).into(holder.movieImageView);
      }
    }
  }
);
  mMoviesAdapter.setLargeViewIntervalEnabled(true);
  mMoviesAdapter.setLargeViewInterval(3);
  mRecyclerView.setAdapter(mMoviesAdapter);
  final GridLayoutManager gridLayoutManager=new GridLayoutManager(getContext(),2);
  gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup(){
    @Override public int getSpanSize(    int position){
      if (position % mMoviesAdapter.getLargeViewInterval() == 0)       return 2;
 else       return 1;
    }
  }
);
  mRecyclerView.setLayoutManager(gridLayoutManager);
  mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){
    @Override public void onScrolled(    RecyclerView recyclerView,    int dx,    int dy){
      int visibleItemCount=gridLayoutManager.getChildCount();
      int totalItemCount=gridLayoutManager.getItemCount();
      int firstVisibleItem=gridLayoutManager.findFirstVisibleItemPosition();
      if (loading) {
        if (totalItemCount > previousTotal) {
          loading=false;
          previousTotal=totalItemCount;
        }
      }
      if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) {
        loadMovies();
        loading=true;
      }
    }
  }
);
  loadMovies();
  return view;
}

Fixed version (ground truth):
@Nullable @Override public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_movies_now_showing,container,false);
  pagesOver=false;
  presentPage=1;
  loading=true;
  previousTotal=0;
  visibleThreshold=5;
  mRecyclerView=(RecyclerView)view.findViewById(R.id.recyclerview_now_showing);
  mMovies=new ArrayList<>();
  mMoviesAdapter=new MoviesAdapter(getContext(),mMovies,new MoviesAdapter.OnBindViewHolderListener(){
    @Override public void onBindViewHolder(    MoviesAdapter.MoviesViewHolder holder,    int position){
      if (position % mMoviesAdapter.getLargeViewInterval() == 0) {
        holder.movieTitleTextView.setText(mMovies.get(position).getTitle());
        Glide.with(getContext()).load("String_Node_Str" + mMovies.get(position).getBackdropPath()).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).into(holder.movieImageView);
      }
 else {
        holder.movieTitleTextView.setText(mMovies.get(position).getTitle());
        Glide.with(getContext()).load("String_Node_Str" + mMovies.get(position).getPosterPath()).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).into(holder.movieImageView);
      }
    }
  }
);
  mMoviesAdapter.setLargeViewIntervalEnabled(true);
  mMoviesAdapter.setLargeViewInterval(3);
  mRecyclerView.setAdapter(mMoviesAdapter);
  final GridLayoutManager gridLayoutManager=new GridLayoutManager(getContext(),2);
  gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup(){
    @Override public int getSpanSize(    int position){
      if (position % mMoviesAdapter.getLargeViewInterval() == 0)       return 2;
 else       return 1;
    }
  }
);
  mRecyclerView.setLayoutManager(gridLayoutManager);
  mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){
    @Override public void onScrolled(    RecyclerView recyclerView,    int dx,    int dy){
      int visibleItemCount=gridLayoutManager.getChildCount();
      int totalItemCount=gridLayoutManager.getItemCount();
      int firstVisibleItem=gridLayoutManager.findFirstVisibleItemPosition();
      if (loading) {
        if (totalItemCount > previousTotal) {
          loading=false;
          previousTotal=totalItemCount;
        }
      }
      if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) {
        loadMovies();
        loading=true;
      }
    }
  }
);
  loadMovies();
  return view;
}