.
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
|
||||
@@ -9,7 +9,6 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.example.cuida.R;
|
||||
import com.example.cuida.databinding.FragmentAppointmentsBinding;
|
||||
|
||||
public class AppointmentsFragment extends Fragment {
|
||||
@@ -41,10 +40,6 @@ public class AppointmentsFragment extends Fragment {
|
||||
pastAdapter.setAppointments(appointments);
|
||||
});
|
||||
|
||||
binding.fabAddAppointment.setOnClickListener(v -> {
|
||||
androidx.navigation.Navigation.findNavController(v).navigate(R.id.action_appointments_to_schedule);
|
||||
});
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,25 @@ import com.example.cuida.data.model.User;
|
||||
import com.example.cuida.databinding.ActivityLoginBinding;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
//gvjhbk
|
||||
// gvjhbk
|
||||
private ActivityLoginBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Check if user is already logged in
|
||||
// Check if user is already logged in and wants to be remembered
|
||||
SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
|
||||
boolean isLoggedIn = prefs.getBoolean("is_logged_in", false);
|
||||
boolean rememberMe = prefs.getBoolean("remember_me", false);
|
||||
|
||||
if (isLoggedIn && rememberMe) {
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
binding = ActivityLoginBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
@@ -48,9 +61,14 @@ public class LoginActivity extends AppCompatActivity {
|
||||
User user = userDao.login(email, password);
|
||||
runOnUiThread(() -> {
|
||||
if (user != null) {
|
||||
// Login Success
|
||||
// Login Success
|
||||
SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
|
||||
boolean rememberMe = binding.checkboxRememberMe.isChecked();
|
||||
|
||||
prefs.edit().putBoolean("is_logged_in", true).apply();
|
||||
prefs.edit().putBoolean("remember_me", rememberMe).apply();
|
||||
|
||||
prefs.edit().putString("user_name", user.name).apply();
|
||||
prefs.edit().putString("user_email", user.email).apply();
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
@@ -47,40 +45,14 @@ public class HomeFragment extends Fragment {
|
||||
|
||||
// --- Book Appointment ---
|
||||
appointmentsViewModel = new ViewModelProvider(this).get(AppointmentsViewModel.class);
|
||||
binding.buttonBookAppointment.setOnClickListener(v -> showTimePicker());
|
||||
binding.buttonBookAppointment.setOnClickListener(v -> {
|
||||
androidx.navigation.Navigation.findNavController(v)
|
||||
.navigate(com.example.cuida.R.id.action_home_to_schedule_appointment);
|
||||
});
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void showTimePicker() {
|
||||
Calendar mcurrentTime = Calendar.getInstance();
|
||||
int hour = mcurrentTime.get(Calendar.HOUR_OF_DAY);
|
||||
int minute = mcurrentTime.get(Calendar.MINUTE);
|
||||
|
||||
TimePickerDialog mTimePicker;
|
||||
mTimePicker = new TimePickerDialog(getContext(), (timePicker, selectedHour, selectedMinute) -> {
|
||||
// Round to 15 minutes
|
||||
int roundedMinute = (selectedMinute / 15) * 15;
|
||||
String time = String.format(Locale.getDefault(), "%02d:%02d", selectedHour, roundedMinute);
|
||||
|
||||
// For MVP, assume date is tomorrow (or let user pick date, but brief said
|
||||
// "Hora" mostly)
|
||||
// Let's assume a default date for now or just "Amanhã" text logic
|
||||
String date = "Amanhã";
|
||||
|
||||
// Save to DB
|
||||
Appointment newAppt = new Appointment("Consulta Geral", date, time, false);
|
||||
appointmentsViewModel.insert(newAppt);
|
||||
|
||||
binding.buttonBookAppointment.setText("Consulta marcada: " + time);
|
||||
Toast.makeText(getContext(), "Consulta marcada para " + time, Toast.LENGTH_SHORT).show();
|
||||
|
||||
}, hour, minute, true);
|
||||
|
||||
mTimePicker.setTitle("Selecione a hora");
|
||||
mTimePicker.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
@@ -1,55 +1,56 @@
|
||||
package com.example.cuida.ui.sns24;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.example.cuida.databinding.FragmentSns24Binding;
|
||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||
import com.google.android.gms.location.LocationServices;
|
||||
|
||||
public class Sns24Fragment extends Fragment {
|
||||
|
||||
private FragmentSns24Binding binding;
|
||||
private FusedLocationProviderClient fusedLocationClient;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
binding = FragmentSns24Binding.inflate(inflater, container, false);
|
||||
|
||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(requireActivity());
|
||||
|
||||
// Initialize Gemini
|
||||
// generativeModel = new GenerativeModel("gemini-pro", GEMINI_API_KEY); //
|
||||
// Removed
|
||||
|
||||
binding.buttonCallSns.setOnClickListener(v -> {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_DIAL);
|
||||
intent.setData(Uri.parse("tel:808242424"));
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
// In case no dialer app is found
|
||||
e.printStackTrace();
|
||||
Toast.makeText(getContext(), "Não foi possível realizar a chamada.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
binding.buttonTriage.setOnClickListener(v -> performTriage());
|
||||
// binding.buttonTriage.setOnClickListener(v -> performTriage()); // Removed
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void performTriage() {
|
||||
boolean fever = binding.checkFever.isChecked();
|
||||
boolean breath = binding.checkBreath.isChecked();
|
||||
boolean pain = binding.checkPain.isChecked();
|
||||
// AI Triage methods removed
|
||||
|
||||
if (breath || pain) {
|
||||
binding.textTriageResult.setText("URGENTE: Dirija-se imediatamente ao hospital ou ligue 112.");
|
||||
binding.textTriageResult.setTextColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||
} else if (fever) {
|
||||
binding.textTriageResult.setText("GRAVE: Ligue SNS 24 para aconselhamento antes de sair de casa.");
|
||||
binding.textTriageResult.setTextColor(getResources().getColor(android.R.color.holo_orange_dark));
|
||||
} else {
|
||||
binding.textTriageResult.setText("NÃO GRAVE: Fique em casa e monitorize os sintomas.");
|
||||
binding.textTriageResult.setTextColor(getResources().getColor(android.R.color.holo_green_dark));
|
||||
}
|
||||
}
|
||||
// Nearest Hospital feature removed with AI Triage
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 1017 KiB |
@@ -71,6 +71,14 @@
|
||||
android:inputType="textPassword" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/checkbox_remember_me"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lembrar-me"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/login_button"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -46,13 +46,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab_add_appointment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:contentDescription="Agendar Consulta"
|
||||
android:src="@android:drawable/ic_input_add" />
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -27,69 +27,5 @@
|
||||
app:iconGravity="textStart"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Triagem Inteligente"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Sente algum destes sintomas?"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_fever"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Febre Alta (> 38ºC)"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_breath"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Dificuldade Respiratória"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_pain"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Dor no Peito"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_triage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Avaliar Sintomas"
|
||||
android:layout_marginTop="16dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_triage_result"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/error_color"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<!-- Triage AI removed -->
|
||||
</LinearLayout>
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
android:id="@+id/navigation_home"
|
||||
android:name="com.example.cuida.ui.home.HomeFragment"
|
||||
android:label="@string/title_home"
|
||||
tools:layout="@layout/fragment_home" />
|
||||
tools:layout="@layout/fragment_home">
|
||||
<action
|
||||
android:id="@+id/action_home_to_schedule_appointment"
|
||||
app:destination="@id/navigation_schedule_appointment" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_appointments"
|
||||
|
||||
Reference in New Issue
Block a user