package com.cpm.lorealbaMabeline.dailyactivity;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cpm.lorealbaMabeline.R;
import com.cpm.lorealbaMabeline.gsonGetterSetter.NotificationData;

import java.util.ArrayList;


public class NotificationAdapter extends RecyclerView.Adapter<NotificationAdapter.ViewHolder> {

        ArrayList<NotificationData> notificationList = new ArrayList<>();

        public NotificationAdapter(ArrayList<NotificationData> notificationList) {
            this.notificationList = notificationList;
        }

        @NonNull
        @Override
        public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.notification_list, parent, false);
            return new ViewHolder(view);
        }

        @Override
        public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) {

            viewHolder.title_txt.setText(notificationList.get(position).getTitle());
            viewHolder.body_txt.setText(notificationList.get(position).getBody());
            viewHolder.path_txt.setText(notificationList.get(position).getPath());
        }

        @Override
        public int getItemCount() {
            return notificationList.size();
        }

        public class ViewHolder extends RecyclerView.ViewHolder {
            TextView title_txt,path_txt,body_txt;
            public ViewHolder(@NonNull View itemView) {
                super(itemView);
                title_txt = (TextView)itemView.findViewById(R.id.title_txt);
                body_txt  = (TextView)itemView.findViewById(R.id.body_txt);

            }
        }
}
