package com.example.leudaemialikeme.Activity;

import android.os.Bundle;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.leudaemialikeme.Adapter.EventAdapter;
import com.example.leudaemialikeme.Model.Event;
import com.example.leudaemialikeme.R;

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

public class EventActivity extends BaseActivity {

    private List<Event> mData = new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_event);
        getData();//获得数据
        RecyclerView recycleView = (RecyclerView) findViewById(R.id.eventList);//获得视图
        LinearLayoutManager layoutManager;
        layoutManager = new LinearLayoutManager(this);
        recycleView.setLayoutManager(layoutManager);//建立线性布局
        EventAdapter adapter = new EventAdapter(mData);//创建适配器
        recycleView.setAdapter(adapter);//将视图与适配器连接起来
    }

    private void getData() {
        Event event1 = new Event("04","10月","第三次化疗","08:00");
        mData.add(event1);
        Event event2 = new Event("11","5月","检查","09:00");
        mData.add(event2);
    }
}
