-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1503b96
commit 955f89b
Showing
9 changed files
with
281 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
app/src/main/java/com/ensias/healthcareapp/PatientInfoActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.ensias.healthcareapp; | ||
|
||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
import android.widget.Spinner; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import com.ensias.healthcareapp.Common.Common; | ||
import com.google.android.gms.tasks.OnSuccessListener; | ||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.firestore.DocumentSnapshot; | ||
import com.google.firebase.firestore.FirebaseFirestore; | ||
|
||
import java.util.HashMap; | ||
|
||
import static com.ensias.healthcareapp.Common.Common.convertBloodToInt; | ||
|
||
public class PatientInfoActivity extends AppCompatActivity { | ||
|
||
EditText heightBtn; | ||
EditText weightBtn; | ||
Spinner bloodtypeSpinner; | ||
Button updateBtn; | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_patient_info); | ||
updateBtn = findViewById(R.id.updateInfoBtn); | ||
heightBtn = findViewById(R.id.heightBtn); | ||
weightBtn = findViewById(R.id.weightBtn); | ||
final Spinner specialiteList = (Spinner) findViewById(R.id.bloodType); | ||
ArrayAdapter<CharSequence> adapterSpecialiteList = ArrayAdapter.createFromResource(this, | ||
R.array.blood_spinner, android.R.layout.simple_spinner_item); | ||
adapterSpecialiteList.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); | ||
specialiteList.setAdapter(adapterSpecialiteList); | ||
|
||
String patient_name = getIntent().getStringExtra("patient_name"); | ||
String patient_email = getIntent().getStringExtra("patient_email"); | ||
|
||
FirebaseFirestore.getInstance().collection("Patient").document(patient_email).collection("moreInfo") | ||
.document(patient_email).get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() { | ||
@Override | ||
public void onSuccess(DocumentSnapshot documentSnapshot) { | ||
weightBtn.setText( ""+documentSnapshot.getString("weight")); | ||
heightBtn.setText( ""+documentSnapshot.getString("height")); | ||
specialiteList.setSelection(convertBloodToInt(documentSnapshot.getString("bloodType"))); | ||
} | ||
}); | ||
|
||
updateBtn.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
HashMap<String,Object> map = new HashMap<>(); | ||
map.put("height",""+heightBtn.getText()); | ||
map.put("weight",""+weightBtn.getText()); | ||
map.put("bloodType",""+specialiteList.getSelectedItem().toString()); | ||
Log.e("tag", "onClick: "+specialiteList.getTag() ); | ||
FirebaseFirestore.getInstance().collection("Patient").document(patient_email).collection("moreInfo") | ||
.document(patient_email).set(map); | ||
|
||
} | ||
}); | ||
if(Common.CurrentUserType.equals("patient")){ | ||
updateBtn.setVisibility(View.GONE); | ||
heightBtn.setEnabled(false); | ||
weightBtn.setEnabled(false); | ||
specialiteList.setEnabled(false); | ||
} | ||
} | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:android="http:https://schemas.android.com/apk/res/android" | ||
xmlns:app="http:https://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http:https://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="60dp" | ||
android:background="#22BEA9" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_marginLeft="20dp" | ||
android:layout_marginTop="8dp" | ||
android:fontFamily="@font/courgette" | ||
android:text="physical Information" | ||
android:textColor="#FFFFFF" | ||
android:textSize="30dp" /> | ||
</LinearLayout> | ||
<EditText | ||
android:id="@+id/heightBtn" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:ems="10" | ||
android:hint="Height" | ||
android:inputType="number" | ||
android:text="" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.419" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintVertical_bias="0.149" /> | ||
|
||
<Spinner | ||
android:id="@+id/bloodType" | ||
android:layout_width="299dp" | ||
android:layout_height="46dp" | ||
android:layout_margin="20dp" | ||
android:background="#ffffff" | ||
android:paddingLeft="20dp" | ||
android:spinnerMode="dropdown" | ||
android:textColor="#000000" | ||
android:visibility="visible" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/weightBtn" | ||
app:layout_constraintVertical_bias="0.237" /> | ||
|
||
<EditText | ||
android:id="@+id/weightBtn" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:ems="10" | ||
android:hint="Weight" | ||
android:inputType="number" | ||
android:text="" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.419" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/heightBtn" | ||
app:layout_constraintVertical_bias="0.115" /> | ||
|
||
<TextView | ||
android:id="@+id/textView9" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginEnd="40dp" | ||
android:layout_marginRight="40dp" | ||
android:text="kg" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.433" | ||
app:layout_constraintStart_toEndOf="@+id/weightBtn" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintVertical_bias="0.323" /> | ||
|
||
<TextView | ||
android:id="@+id/textView8" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginEnd="16dp" | ||
android:layout_marginRight="16dp" | ||
android:text="m" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.302" | ||
app:layout_constraintStart_toEndOf="@+id/heightBtn" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintVertical_bias="0.168" /> | ||
|
||
<Button | ||
android:id="@+id/updateInfoBtn" | ||
android:layout_width="310dp" | ||
android:layout_height="42dp" | ||
android:text="update info" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/bloodType" | ||
app:layout_constraintVertical_bias="0.244" /> | ||
|
||
<TextView | ||
android:id="@+id/textView7" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textSize="20dp" | ||
android:text="Blood Type" | ||
app:layout_constraintBottom_toTopOf="@+id/bloodType" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/weightBtn" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:android="http:https://schemas.android.com/apk/res/android" android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters