package com.lee.lib.support;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.lee.base.activity.BaseActivity;
import com.lee.lib.R;
import com.lee.lib.support.v7.widget.LinearLayoutManager;
import com.lee.lib.support.v7.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

/**
 * RecyclerView Activity
 * </p>
 * Created by LiYang on 2017/7/15.
 */

public class RecyclerViewActivity extends BaseActivity {

    private RecyclerView recyclerView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycler_view);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView = (RecyclerView)findViewById(R.id.rv_content);
        recyclerView.setLayoutManager(linearLayoutManager);

        List<String> data = new ArrayList<>();
        for (int i=0; i<100; i++) {
            data.add("title " + i);
        }
        RecyclerViewAdapter adapter = new RecyclerViewAdapter(this, data);
        recyclerView.setAdapter(adapter);
    }

}
