Skip to content

Commit

Permalink
Adding call for Doctor
Browse files Browse the repository at this point in the history
  • Loading branch information
YassineBOUJNAH committed Jun 3, 2020
1 parent 9b8e812 commit a23d97b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<manifest xmlns:android="https://schemas.android.com/apk/res/android"
package="com.ensias.healthcareapp">

<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -12,7 +13,9 @@

import com.ensias.healthcareapp.ChatActivity;
import com.ensias.healthcareapp.DossierMedical;
import com.ensias.healthcareapp.FicheInfo;
import com.ensias.healthcareapp.R;
import com.ensias.healthcareapp.model.Fiche;
import com.ensias.healthcareapp.model.Patient;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
Expand Down Expand Up @@ -51,9 +54,19 @@ public void onClick(View v) {

}
});
myPatientsHolder.callBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openPage(myPatientsHolder.contactButton.getContext(),patient.getTel());
}
});


}
private void openPage(Context wf, String phoneNumber){
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber));
wf.startActivity(intent);
}

private void openPatientMedicalFolder(Context medicalFolder, Patient patient){
Intent intent = new Intent(medicalFolder, DossierMedical.class);
Expand All @@ -78,13 +91,15 @@ public MyPatientsHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewTy

class MyPatientsHolder extends RecyclerView.ViewHolder{
//Here we hold the MyDoctorItems
Button callBtn;
TextView textViewTitle;
TextView textViewTelephone;
ImageView imageViewPatient;
Button contactButton;
RelativeLayout parentLayout;
public MyPatientsHolder(@NonNull View itemView) {
super(itemView);
callBtn = itemView.findViewById(R.id.callBtn);
textViewTitle = itemView.findViewById(R.id.patient_view_title);
textViewTelephone = itemView.findViewById(R.id.text_view_telephone);
imageViewPatient = itemView.findViewById(R.id.patient_item_image);
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/layout/my_patient_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,15 @@
android:layout_marginStart="298dp"
android:layout_marginLeft="298dp"
android:text="Contact" />

<Button
android:id="@+id/callBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="203dp"
android:layout_marginLeft="203dp"
android:text="Call" />
</RelativeLayout>
</androidx.cardview.widget.CardView>

0 comments on commit a23d97b

Please sign in to comment.