-
Notifications
You must be signed in to change notification settings - Fork 0
/
AttendanceAdapter.java
55 lines (43 loc) · 1.59 KB
/
AttendanceAdapter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.example.fbans.projecthm;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.fbans.projecthm.utils.Absent;
import java.util.ArrayList;
import java.util.List;
public class AttendanceAdapter extends RecyclerView.Adapter<AttendanceAdapter.ViewHolder>{
List<Absent> absents = new ArrayList<>();
Context context;
public AttendanceAdapter(){}
public AttendanceAdapter(Context context, List<Absent> absents){
this.context = context;
this.absents = absents;
}
@NonNull
@Override
public AttendanceAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.attendence_display,parent,false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull AttendanceAdapter.ViewHolder holder, int position) {
Absent absent = absents.get(position);
holder.date.setText(absent.getDate());
}
@Override
public int getItemCount() {
return absents.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView date;
public ViewHolder(@NonNull View itemView) {
super(itemView);
date = itemView.findViewById(R.id.Abdate);
}
}
}