Created
April 26, 2021 20:20
-
-
Save Ochornma/3245328d348a65822b6e13fd92d01357 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VerifyAdapter(private val list: List<UnverifiedData>, val listener: OnItemClickListener): RecyclerView.Adapter<VerifyAdapter.VerifyHolder>() { | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VerifyHolder { | |
val binding = VerifyBvnListBinding | |
.inflate(LayoutInflater.from(parent.context), parent, false) | |
return VerifyHolder(binding) | |
} | |
override fun onBindViewHolder(holder: VerifyHolder, position: Int) { | |
with(holder){ | |
with(list[position]){ | |
binding.bvn.text = bvn | |
binding.phoneNumber.text = bvn_phone_number.toString() | |
binding.firstName.text = first_name.toString() | |
binding.lastName.text = last_name.toString() | |
val date = Utils.convertStringToDate(date_of_birth as String) | |
binding.dob.text = date | |
binding.verify.setOnClickListener { | |
listener.onItemClick(id.toString()) | |
} | |
} | |
} | |
} | |
override fun getItemCount() = list.size | |
interface OnItemClickListener{ | |
fun onItemClick(id: String) | |
} | |
class VerifyHolder(val binding: VerifyBvnListBinding): RecyclerView.ViewHolder(binding.root){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment