Skip to content

Commit

Permalink
Update MyPatientsActivity UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasstrh committed Jun 4, 2020
1 parent 1503b96 commit 360db95
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 49 deletions.
59 changes: 42 additions & 17 deletions app/src/main/java/com/ensias/healthcareapp/FirstSigninActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@
import com.ensias.healthcareapp.fireStoreApi.PatientHelper;
import com.ensias.healthcareapp.fireStoreApi.UserHelper;

import static android.widget.AdapterView.*;

public class FirstSigninActivity extends AppCompatActivity {
private static final String TAG = "FirstSigninActivity";
private EditText fullName ;
private EditText birthday ;
private EditText teL ;
private EditText fullName;
private EditText birthday;
private EditText teL;
private Button btn;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first_signin);
btn =(Button) findViewById(R.id.confirmeBtn);
fullName = (EditText)findViewById(R.id.firstSignFullName);
birthday = (EditText)findViewById(R.id.firstSignBirthDay);
teL = (EditText)findViewById(R.id.firstSignTel);
btn = (Button) findViewById(R.id.confirmeBtn);
fullName = (EditText) findViewById(R.id.firstSignFullName);
birthday = (EditText) findViewById(R.id.firstSignBirthDay);
teL = (EditText) findViewById(R.id.firstSignTel);

final Spinner spinner = (Spinner) findViewById(R.id.spinner);
// Create an ArrayAdapter using the string array and a default spinner layout
Expand All @@ -46,24 +49,46 @@ protected void onCreate(Bundle savedInstanceState) {
R.array.specialite_spinner, android.R.layout.simple_spinner_item);
adapterSpecialiteList.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
specialiteList.setAdapter(adapterSpecialiteList);
String newAccountType = spinner.getSelectedItem().toString();
/*
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (newAccountType.equals("Patient")) {
specialiteList.setVisibility(View.GONE);
} else {
specialiteList.setVisibility(View.VISIBLE);
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
;
});
*/


btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

String fullname,birtDay,tel,type,specialite;
fullname=fullName.getText().toString();
birtDay=birthday.getText().toString();
tel=teL.getText().toString();
type=spinner.getSelectedItem().toString();
String fullname, birtDay, tel, type, specialite;
fullname = fullName.getText().toString();
birtDay = birthday.getText().toString();
tel = teL.getText().toString();
type = spinner.getSelectedItem().toString();
specialite = specialiteList.getSelectedItem().toString();
UserHelper.addUser(fullname,birtDay,tel,type);
if(type.equals("Patient")){
UserHelper.addUser(fullname, birtDay, tel, type);
if (type.equals("Patient")) {
PatientHelper.addPatient(fullname, "adress", tel);
System.out.println("Add patient "+fullname+" to patient collection");
System.out.println("Add patient " + fullname + " to patient collection");

}else{
DoctorHelper.addDoctor(fullname,"adress",tel,specialite);
} else {
DoctorHelper.addDoctor(fullname, "adress", tel, specialite);
}
Intent k = new Intent(FirstSigninActivity.this, MainActivity.class);
startActivity(k);
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_chat_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#0084FF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="https://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM6,9h12v2L6,11L6,9zM14,14L6,14v-2h8v2zM18,8L6,8L6,6h12v2z"/>
</vector>
34 changes: 30 additions & 4 deletions app/src/main/res/layout/activity_my_patients.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,37 @@
xmlns:tools="https://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cardview_dark_background"
android:background="#E5E5E5"
tools:context=".MyPatientsActivity">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/ListMyPatients"
<LinearLayout
android:id="@+id/activity_mentor_chat_recycler_view_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#22BEA9">

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/roboto"
android:gravity="center"
android:text="My Patients"
android:textColor="#FFFFFF"
android:textSize="26sp" />
</LinearLayout>
<!-- RECYCLER VIEW -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/ListMyPatients"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
66 changes: 38 additions & 28 deletions app/src/main/res/layout/my_patient_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="https://schemas.android.com/apk/res-auto"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:cardBackgroundColor="@color/cardview_light_background"
app:cardCornerRadius="8dp">
android:layout_marginBottom="8dp"
app:cardBackgroundColor="@color/cardview_light_background">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
android:layout_height="80dp"
android:id="@+id/parent_layout">

<ImageView
android:id="@+id/patient_item_image"
android:layout_width="70dp"
android:layout_height="77dp"
android:layout_width="65dp"
android:layout_height="58dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="9dp"
android:layout_marginLeft="9dp"
android:layout_marginTop="10dp"
app:srcCompat="@drawable/doctor"
tools:ignore="VectorDrawableCompat" />

Expand All @@ -29,44 +31,52 @@
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="88dp"
android:layout_marginLeft="96dp"
android:textColor="#000000"
android:layout_marginLeft="88dp"
android:layout_marginTop="9dp"
android:fontFamily="@font/roboto"
android:maxLines="1"
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="#22BE87" />

<TextView
android:id="@+id/text_view_telephone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/patient_view_title"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="88dp"
android:layout_marginLeft="88dp"
android:layout_marginTop="7dp"
android:textColor="#000000"
android:text="Telephone" />
android:layout_alignParentBottom="true"
android:layout_marginStart="87dp"
android:layout_marginLeft="87dp"
android:layout_marginBottom="13dp"
android:fontFamily="@font/roboto"
android:text="0612431582"
android:textColor="#B9B9B9" />

<Button
android:id="@+id/contact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="28dp"
android:layout_height="25dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="298dp"
android:layout_marginLeft="298dp"
android:text="Contact" />
android:layout_alignParentBottom="true"
android:layout_marginStart="365dp"
android:layout_marginLeft="365dp"
android:layout_marginBottom="23dp"
android:background="@drawable/ic_chat_black_24dp" />

<Button
android:id="@+id/callBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="203dp"
android:layout_marginLeft="203dp"
android:text="Call" />
android:layout_alignParentBottom="true"
android:layout_marginStart="316dp"
android:layout_marginLeft="316dp"
android:layout_marginBottom="23dp"
android:background="@drawable/ic_call_black_24dp" />
</RelativeLayout>
</androidx.cardview.widget.CardView>

0 comments on commit 360db95

Please sign in to comment.