Mugumya A
01/27/2025, 8:30 AMprivate fun loadDoctorInfo(doctorId: String) {
db!!.collection("doctorProfileInfo").document(doctorId)
.get()
.addOnSuccessListener(OnSuccessListener { documentSnapshot: DocumentSnapshot? ->
if (documentSnapshot!!.exists()) {
doctorName!!.text = if (documentSnapshot.getString("D_name") != null) documentSnapshot.getString("D_name") else "N/A"
doctorContact!!.text = if (documentSnapshot.getString("contact") != null) documentSnapshot.getString("contact") else "N/A"
doctorDegree!!.text = if (documentSnapshot.getString("degree") != null) documentSnapshot.getString("degree") else "N/A"
doctorSpeciality!!.text = if (documentSnapshot.getString("speciality") != null) documentSnapshot.getString("speciality") else "N/A"
doctorDescription!!.text = if (documentSnapshot.getString("description") != null) documentSnapshot.getString("description") else "N/A"
doctorEmail!!.text = if (documentSnapshot.getString("email") != null) documentSnapshot.getString("email") else "N/A"
val imageUrl = documentSnapshot.getString("D_profileImageUrl")
if (imageUrl != null && !imageUrl.isEmpty()) {
Glide.with(requireActivity())
.asBitmap()
.load(imageUrl)
.placeholder(R.drawable.ic_person_white) //.apply(RequestOptions.bitmapTransform(WebpTranscoder()))
.into(doctorProfileImage!!)
} else {
doctorProfileImage!!.setImageResource(R.drawable.ic_person_white)
}
doctorProfileImage!!.tag = imageUrl
} else {
Toast.makeText(activity, "Doctor profile not found", Toast.LENGTH_SHORT)
.show()
}
})
.addOnFailureListener(OnFailureListener { e: Exception? ->
Toast.makeText(
activity,
"Failed to load doctor information",
Toast.LENGTH_SHORT
).show()
})
}
Chrimaeon
01/27/2025, 10:50 AMChrimaeon
01/27/2025, 10:52 AM