package com.example.leudaemialikeme.Activity;

import android.os.Bundle;

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

import com.example.leudaemialikeme.Adapter.AttentionAdapter;
import com.example.leudaemialikeme.Model.Attention;
import com.example.leudaemialikeme.R;

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

public class AttentionActivity extends BaseActivity {

    private List<Attention> attentionList = new ArrayList<>();

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

    private void getData() {
        Attention attention1 = new Attention(R.mipmap.img_my_person,"小白帮","管住嘴，迈开腿，多喝水");
        attentionList.add(attention1);
        Attention attention2 = new Attention(R.mipmap.img_my_person,"小白帮","管住嘴，多饮水，常保暖");
        attentionList.add(attention2);

    }
}
