/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.support.android.designlibdemo;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

public class CheeseDetailActivity extends AppCompatActivity {

    public static final String EXTRA_NAME = "cheese_name";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);

        Intent intent = getIntent();
        final String cheeseName = intent.getStringExtra(EXTRA_NAME);

        final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        CollapsingToolbarLayout collapsingToolbar =
                (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
        collapsingToolbar.setTitle(cheeseName);

        loadBackdrop();


        final RecyclerView rv = (RecyclerView)findViewById(R.id.rv);
        final LinearLayoutManager llm = new LinearLayoutManager(this);
        // rv.setLayoutManager(llm);
        //rv.setMinimumHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
        //rv.setLayoutManager(new CustomLinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true));
        rv.setLayoutManager(new MyLinearLayoutManager(this, LinearLayoutManager.VERTICAL, true));
        RVAdapter adapter = new RVAdapter();
        rv.setAdapter(adapter);
//        rv.setLayoutManager(new WrappingLinearLayoutManager(this));
//        rv.setNestedScrollingEnabled(false);
//        rv.setHasFixedSize(false);
    }

    private void loadBackdrop() {
        final ImageView imageView = (ImageView) findViewById(R.id.backdrop);
        Glide.with(this).load(Cheeses.getRandomCheeseDrawable()).centerCrop().into(imageView);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.sample_actions, menu);
        return true;
    }
}

@@ -1909,293 +1909,8 @@
 v);%0A
-        final LinearLayoutManager llm = new LinearLayoutManager(this);%0A        // rv.setLayoutManager(llm);%0A        //rv.setMinimumHeight(LinearLayout.LayoutParams.WRAP_CONTENT);%0A        //rv.setLayoutManager(new CustomLinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true));%0A
     
@@ -2084,162 +2084,8 @@
 r);%0A
-//        rv.setLayoutManager(new WrappingLinearLayoutManager(this));%0A//        rv.setNestedScrollingEnabled(false);%0A//        rv.setHasFixedSize(false);%0A
     

Update CheeseDetailActivity.java