Skip to content

Commit

Permalink
Add doctor images "MyDoctorsActivity"
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasstrh committed Jun 10, 2020
1 parent 2a30fbc commit 6107442
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void onSuccess(Uri uri) {
.placeholder(R.mipmap.ic_launcher)
.fit()
.centerCrop()
.into(doctoreHolder.image);//hna fin kayn Image view
.into(doctoreHolder.image);//Image location

// profileImage.setImageURI(uri);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@
import com.ensias.healthcareapp.model.Doctor;
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;

public class MyDoctorsAdapter extends FirestoreRecyclerAdapter<Doctor, MyDoctorsAdapter.MyDoctorAppointementHolder> {
StorageReference pathReference ;

/**
* Create a new RecyclerView adapter that listens to a Firestore Query.
Expand All @@ -48,6 +54,27 @@ public void onClick(View v) {
openPage(myDoctorsHolder.sendMessageButton.getContext(),doctor.getTel());
}
});

String imageId = FirebaseAuth.getInstance().getCurrentUser().getEmail()+".jpg"; //add a title image
pathReference = FirebaseStorage.getInstance().getReference().child("DoctorProfile/"+ imageId); //storage the image
pathReference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Picasso.with(myDoctorsHolder.imageViewDoctor.getContext())
.load(uri)
.placeholder(R.mipmap.ic_launcher)
.fit()
.centerCrop()
.into(myDoctorsHolder.imageViewDoctor);//Image location

// profileImage.setImageURI(uri);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
}
});
}

private void openPage(Context wf, String phoneNumber){
Expand Down

0 comments on commit 6107442

Please sign in to comment.