Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tgs.app.absensi;
- import android.support.annotation.NonNull;
- import android.support.v7.widget.RecyclerView;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.TextView;
- import org.w3c.dom.Text;
- import java.util.List;
- import tgs.app.absensi.model.Sekretaris;
- public class SekretarisAdapter extends RecyclerView.Adapter<SekretarisAdapter.ViewHolder> {
- private List<Sekretaris.Siswa> dataSiswa;
- private List<Sekretaris.Kelas> dataKelas;
- public SekretarisAdapter(List<Sekretaris.Siswa> dataSiswa, List<Sekretaris.Kelas> dataKelas) {
- this.dataSiswa = dataSiswa;
- this.dataKelas = dataKelas;
- }
- @NonNull
- @Override
- public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
- View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.adapter_sekretaris, viewGroup, false);
- return new ViewHolder(view);
- }
- @Override
- public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
- viewHolder.text_no.setText(dataSiswa.get(i).getId_siswa());
- viewHolder.text_nis.setText(dataSiswa.get(i).getNIS());
- viewHolder.text_nama.setText(dataSiswa.get(i).getNama_lengkap());
- viewHolder.text_jenisk.setText(dataSiswa.get(i).getJenis_kelamin());
- viewHolder.text_kelas.setText(dataKelas.get(i).getNama_kelas());
- viewHolder.text_jurusan.setText(null);
- viewHolder.text_status.setText(dataSiswa.get(i).getStatus());
- }
- @Override
- public int getItemCount() {
- return dataSiswa.size();
- }
- public class ViewHolder extends RecyclerView.ViewHolder {
- TextView text_no, text_nis, text_nama, text_jenisk, text_kelas, text_jurusan, text_status;
- public ViewHolder(@NonNull View itemView) {
- super(itemView);
- text_no = itemView.findViewById(R.id.text_no);
- text_nis = itemView.findViewById(R.id.text_nis);
- text_nama = itemView.findViewById(R.id.text_nama);
- text_jenisk = itemView.findViewById(R.id.text_jenisKelamin);
- text_kelas = itemView.findViewById(R.id.text_kelas);
- text_jurusan = itemView.findViewById(R.id.text_jurusan);
- text_status = itemView.findViewById(R.id.text_status);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement