-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
13 changed files
with
331 additions
and
34 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
78 changes: 78 additions & 0 deletions
78
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,78 @@ | ||
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 android.widget.Toast; | ||
|
||
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); | ||
Toast.makeText(PatientInfoActivity.this,"Update Success!",Toast.LENGTH_SHORT).show(); | ||
|
||
} | ||
}); | ||
if(Common.CurrentUserType.equals("patient")){ | ||
updateBtn.setVisibility(View.GONE); | ||
heightBtn.setEnabled(false); | ||
weightBtn.setEnabled(false); | ||
specialiteList.setEnabled(false); | ||
} | ||
} | ||
|
||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.