Newer
Older
NemophilaClient / app / src / main / java / com / example / nemophila / RequestedAdapter.java
package com.example.nemophila;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.nemophila.entities.Account;
import com.example.nemophila.viewmodels.AccountViewModel;

import java.util.List;

public class RequestedAdapter extends RecyclerView.Adapter<RequestedViewHolder> {
    private List<Account> list;
    public RequestedAdapter(List<Account> list) {
        this.list = list;
    }
    public void setList(List<Account> list) {
        this.list = list;
    }

    @NonNull
    @Override
    public RequestedViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_requested_activity, parent,false);
        RequestedViewHolder vh = new RequestedViewHolder(inflate);
        return vh;
    }

    @Override
    public void onBindViewHolder(@NonNull RequestedViewHolder holder, int position) {
        holder.nameView.setText(list.get(position).getName());
    }

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