esta guardar e nao esta a entar no perfil

This commit is contained in:
2026-03-12 10:38:07 +00:00
parent 453c3b0b3e
commit 1fcd2d0da5
71 changed files with 837 additions and 925 deletions

View File

@@ -18,12 +18,16 @@ public class Perfil {
@SerializedName("gmail")
private String gmail;
public Perfil(String id, String nome, int idade, String utente, String email) {
@SerializedName("sexo")
private String sexo;
public Perfil(String id, String nome, int idade, String utente, String email, String sexo) {
this.id = id;
this.nome_completo = nome;
this.idade = idade;
this.numero_utente = utente;
this.gmail = email;
this.sexo = sexo;
}
// Getters
@@ -47,6 +51,10 @@ public class Perfil {
return gmail;
}
public String getSexo() {
return sexo;
}
// Setters
public void setId(String id) {
this.id = id;
@@ -67,4 +75,8 @@ public class Perfil {
public void setGmail(String gmail) {
this.gmail = gmail;
}
public void setSexo(String sexo) {
this.sexo = sexo;
}
}

View File

@@ -46,17 +46,30 @@ public class AppointmentsViewModel extends AndroidViewModel {
}
List<Appointment> apps = new ArrayList<>();
java.util.Date now = new java.util.Date();
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm",
java.util.Locale.getDefault());
if (value != null) {
for (QueryDocumentSnapshot doc : value) {
apps.add(doc.toObject(Appointment.class));
Appointment app = doc.toObject(Appointment.class);
try {
java.util.Date appDate = format.parse(app.date + " " + app.time);
if (appDate != null && appDate.before(now)) {
// It passed out of date. Update in DB to move it to Past Appointments.
db.collection("consultas").document(doc.getId()).update("isPast", true);
} else {
apps.add(app);
}
} catch (java.text.ParseException e) {
apps.add(app);
}
}
}
// Sort locally
apps.sort((a, b) -> {
try {
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm",
java.util.Locale.getDefault());
java.util.Date dateA = format.parse(a.date + " " + a.time);
java.util.Date dateB = format.parse(b.date + " " + b.time);
return dateA.compareTo(dateB);

View File

@@ -26,6 +26,11 @@ public class RegisterActivity extends AppCompatActivity {
startActivity(new Intent(this, LoginActivity.class));
finish();
});
String[] genders = new String[]{"Masculino", "Feminino"};
android.widget.ArrayAdapter<String> adapter = new android.widget.ArrayAdapter<>(
this, android.R.layout.simple_dropdown_item_1line, genders);
binding.genderAutoComplete.setAdapter(adapter);
}
private void register() {
@@ -34,8 +39,9 @@ public class RegisterActivity extends AppCompatActivity {
String utenteStr = binding.utenteEditText.getText().toString();
String email = binding.emailEditText.getText().toString();
String password = binding.passwordEditText.getText().toString();
String gender = binding.genderAutoComplete.getText().toString();
if (name.isEmpty() || ageStr.isEmpty() || email.isEmpty() || password.isEmpty() || utenteStr.isEmpty()) {
if (name.isEmpty() || ageStr.isEmpty() || email.isEmpty() || password.isEmpty() || utenteStr.isEmpty() || gender.isEmpty()) {
Toast.makeText(this, "Preencha todos os campos", Toast.LENGTH_SHORT).show();
return;
}
@@ -68,6 +74,7 @@ public class RegisterActivity extends AppCompatActivity {
userMap.put("email", email);
userMap.put("age", age);
userMap.put("utenteNumber", utenteStr);
userMap.put("sexo", gender);
userMap.put("profilePictureUri", ""); // Init empty
db.collection("utilizadores").document(userId)

View File

@@ -57,10 +57,11 @@ public class Sns24Fragment extends Fragment {
binding.buttonFindHospital.setVisibility(View.GONE);
com.example.cuida.services.Gemini gemini = new com.example.cuida.services.Gemini();
String prompt = "Atua como um assistente de triagem médica (em português europeu). " +
"Analisa os seguintes sintomas de um paciente e dá uma resposta curta (1 ou 2 parágrafos no máximo) " +
"avaliando a situação. Se os sintomas indicarem uma situação grave ou emergência médica, a tua resposta DEVE conter a palavra [GRAVE]. " +
"Inclui sempre uma recomendação clara (ir às urgências, ligar ao SNS 24 ou marcar consulta local). " +
String prompt = "Atua como um assistente de triagem médica. " +
"Analisa os seguintes sintomas de um paciente e dá uma resposta MUITO CURTA e direta (máximo 2 a 3 frases). " +
"Regra de Ouro: Se o paciente mencionar a palavra 'dor', deves avaliar a situação com muito cuidado, inclinando-te para a classificar como severa. " +
"Se os sintomas indicarem uma situação grave, emergência ou necessidade de observação urgente de acordo com as tuas instruções, a tua resposta DEVE conter obrigatoriamente a palavra [GRAVE]. " +
"Recomenda sempre qual o próximo passo (ex: urgências, SNS 24, consulta). " +
"Sintomas: " + symptoms;
gemini.fazerPergunta(prompt, new com.example.cuida.services.Gemini.GeminiCallback() {