Skip to content

Commit

Permalink
Update image "PatientAppointmentAdapter"
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasstrh committed Jun 10, 2020
1 parent dccb925 commit b3dd8bc
Showing 1 changed file with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
package com.ensias.healthcareapp.adapter;

import android.app.AlertDialog;
import android.graphics.Color;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.ensias.healthcareapp.ProfilePatientActivity;
import com.ensias.healthcareapp.R;
import com.ensias.healthcareapp.model.ApointementInformation;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.squareup.picasso.Picasso;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import dmax.dialog.SpotsDialog;

public class PatientAppointmentsAdapter extends FirestoreRecyclerAdapter<ApointementInformation, PatientAppointmentsAdapter.PatientAppointmentsHolder> {
StorageReference pathReference ;
final String doctorID = FirebaseAuth.getInstance().getCurrentUser().getEmail().toString();
public PatientAppointmentsAdapter(@NonNull FirestoreRecyclerOptions<ApointementInformation> options) {
super(options);
}
Expand All @@ -25,7 +38,27 @@ protected void onBindViewHolder(@NonNull PatientAppointmentsHolder patientAppoin
patientAppointmentsHolder.patientName.setText(apointementInformation.getDoctorName());
patientAppointmentsHolder.appointementType.setText(apointementInformation.getApointementType());
patientAppointmentsHolder.type.setText(apointementInformation.getType());
//#3700B3

//display profile image
String imageId = FirebaseAuth.getInstance().getCurrentUser().getEmail().toString();
pathReference = FirebaseStorage.getInstance().getReference().child("DoctorProfile/"+ imageId+".jpg");
pathReference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Picasso.with(patientAppointmentsHolder.image.getContext())
.load(uri)
.placeholder(R.mipmap.ic_launcher)
.fit()
.centerCrop()
.into(patientAppointmentsHolder.image);
// profileImage.setImageURI(uri);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
}
});

if(apointementInformation.getApointementType().equals("Consultation")){
//patientAppointmentsHolder.appointementType.setBackgroundColor((patientAppointmentsHolder.type.getContext().getResources().getColor(R.color.colorPrimaryDark)));
Expand Down Expand Up @@ -56,6 +89,7 @@ class PatientAppointmentsHolder extends RecyclerView.ViewHolder{
TextView appointementType;
TextView type;
TextView phone;
ImageView image;

public PatientAppointmentsHolder(@NonNull View itemView) {
super(itemView);
Expand All @@ -64,6 +98,7 @@ public PatientAppointmentsHolder(@NonNull View itemView) {
appointementType = itemView.findViewById(R.id.appointement_type);
type = itemView.findViewById(R.id.type);
phone = itemView.findViewById(R.id.patient_phone);
image = itemView.findViewById(R.id.patient_image);
}
}
}

0 comments on commit b3dd8bc

Please sign in to comment.