Buggy code:
public class MainActivity extends ActionBarActivity implements ExCardViewAdapter . OnItemClickListener { private static final String TAG = "Flickresque<seq2seq4repair_space>Activity" ; private static final String PHOTOS_PER_PAGE = "40" ; private SwipeRefreshLayout mSwipeRefreshLayout ; @ InjectView ( id . explore_recycler_view ) public RecyclerView exRecyclerView ; @ InjectView ( id . progress_bar ) public ProgressBar mProgressbar ; private ExCardViewAdapter exCardViewAdapter ; private GridLayoutManager exLayoutManager ; @ InjectView ( id . main_toolbar ) public Toolbar toolbar ; private DrawerLayout drawerLayout ; private ActionBarDrawerToggle drawerToggle ; private ListView leftDrawerList ; private ArrayAdapter < String > navigationDrawerAdapter ; private String [ ] leftSliderData = new String [ ] { "<seq2seq4repair_space>About" } ; private final ImageFragment imageFragment = new ImageFragment ( ) ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( activity_main ) ; ButterKnife . inject ( this ) ; if ( ( toolbar ) != null ) setSupportActionBar ( toolbar ) ; getSupportActionBar ( ) . setTitle ( "Flickresque" ) ; final SwipeRefreshLayout mSwipeRefreshLayout = ( ( SwipeRefreshLayout ) ( findViewById ( activity_main_swipe_refresh_layout ) ) ) ; initView ( ) ; initDrawer ( ) ; final FlickresqueClient . FlickresqueService mFlickrService = new FlickresqueClient ( ) . getFlickrService ( ) ; exLayoutManager = new GridLayoutManager ( this , 7 ) ; exLayoutManager . setSpanSizeLookup ( new GridLayoutManager . SpanSizeLookup ( ) { @ Override public int getSpanSize ( int position ) { int test = 7 - ( position % 7 ) ; int valid = position % 7 ; if ( valid == 0 ) { return 7 ; } else if ( valid == 1 ) { return 3 ; } else if ( valid == 2 ) { return 4 ; } else if ( valid == 3 ) { return 2 ; } else if ( valid == 4 ) { return 5 ; } else if ( valid == 5 ) { return 4 ; } else if ( valid == 6 ) { return 3 ; } else { return test ; } } } ) ; exRecyclerView . setLayoutManager ( exLayoutManager ) ; int spacingInPixels = getResources ( ) . getDimensionPixelSize ( grid_margin ) ; exRecyclerView . addItemDecoration ( new SpaceItemDecoration ( spacingInPixels ) ) ; <START_BUG> View header = LayoutInflater . from ( this ) . inflate ( category_list_item , exRecyclerView , false ) ; <END_BUG> exCardViewAdapter = new ExCardViewAdapter ( this , null , header ) ; exCardViewAdapter . setOnItemClickListener ( this ) ; exRecyclerView . setAdapter ( exCardViewAdapter ) ; mFlickrService . getInterest ( MainActivity . PHOTOS_PER_PAGE , "1" , new retrofit . Callback < PhotoResponse > ( ) { @ Override public void success ( PhotoResponse photoResponse , Response response ) { Log . d ( MainActivity . TAG , photoResponse . toString ( ) ) ; displayPhotos ( photoResponse . getPhotos ( ) . getList ( ) ) ; mProgressbar . setVisibility ( GONE ) ; } @ Override public void failure ( RetrofitError retrofitError ) { if ( retrofitError . isNetworkError ( ) ) { Toast . makeText ( MainActivity . this , "Network<seq2seq4repair_space>isn't<seq2seq4repair_space>stable." , LENGTH_SHORT ) . show ( ) ; } mProgressbar . setVisibility ( GONE ) ; Log . e ( MainActivity . TAG , "Error<seq2seq4repair_space>retrieving<seq2seq4repair_space>photos" , retrofitError ) ; } } ) ; exRecyclerView . setOnScrollListener ( new RecyclerView . OnScrollListener ( ) { @ Override public void onScrollStateChanged ( RecyclerView recyclerView , int state ) { } @ Override public void onScrolled ( RecyclerView recyclerView , int i , int i2 ) { int topRowVerticalPosition = ( ( ( exRecyclerView ) == null ) || ( ( exRecyclerView . getChildCount ( ) ) == 0 ) ) ? 0 : exRecyclerView . getChildAt ( 0 ) . getTop ( ) ; mSwipeRefreshLayout . setEnabled ( ( topRowVerticalPosition >= 0 ) ) ; } } ) ; mSwipeRefreshLayout . setOnRefreshListener ( new SwipeRefreshLayout . OnRefreshListener ( ) { @ Override public void onRefresh ( ) { mSwipeRefreshLayout . setRefreshing ( true ) ; new Handler ( ) . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { exCardViewAdapter . notifyDataSetChanged ( ) ; mSwipeRefreshLayout . setRefreshing ( false ) ; } } , 2000 ) ; } } ) ; getSupportFragmentManager ( ) . beginTransaction ( ) . add ( content , imageFragment , "myfragment" ) . hide ( imageFragment ) . commit ( ) ; } private void displayPhotos ( List < Photo > photos ) { } private void initView ( ) { } private void initDrawer ( ) { } @ Override protected void onPostCreate ( Bundle savedInstanceState ) { } @ Override public void onConfigurationChanged ( Configuration newConfig ) { } @ Override public void onItemClick ( View view , int position ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public void onBackPressed ( ) { } }

Fix:
View header = LayoutInflater . from ( this ) . inflate ( gridlayout_header , exRecyclerView , false ) ;