tou a editar o perfil e deixar a pp mais bonita
This commit is contained in:
@@ -15,7 +15,7 @@ import com.example.cuida.data.model.Medication;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@Database(entities = { User.class, Appointment.class, Medication.class }, version = 3, exportSchema = false)
|
||||
@Database(entities = { User.class, Appointment.class, Medication.class }, version = 4, exportSchema = false)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
public abstract UserDao userDao();
|
||||
@@ -56,9 +56,9 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
medDao.insert(new Medication("Vitamina C", "20:00", "1 comp", "Antes de dormir"));
|
||||
|
||||
AppointmentDao apptDao = INSTANCE.appointmentDao();
|
||||
apptDao.insert(new Appointment("Medicina Geral", "25/01/2026", "10:00", false));
|
||||
apptDao.insert(new Appointment("Cardiologia", "02/02/2026", "15:30", false));
|
||||
apptDao.insert(new Appointment("Oftalmologia", "10/01/2025", "09:00", true));
|
||||
apptDao.insert(new Appointment("Medicina Geral", "25/01/2026", "10:00", "Check-up anual", false));
|
||||
apptDao.insert(new Appointment("Cardiologia", "02/02/2026", "15:30", "Dor no peito", false));
|
||||
apptDao.insert(new Appointment("Oftalmologia", "10/01/2025", "09:00", "Renovação óculos", true));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,12 +11,14 @@ public class Appointment {
|
||||
public String type; // e.g. "Medicina Geral", "Cardiologia"
|
||||
public String date; // dd/MM/yyyy
|
||||
public String time; // HH:mm
|
||||
public String reason;
|
||||
public boolean isPast;
|
||||
|
||||
public Appointment(String type, String date, String time, boolean isPast) {
|
||||
public Appointment(String type, String date, String time, String reason, boolean isPast) {
|
||||
this.type = type;
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
this.reason = reason;
|
||||
this.isPast = isPast;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ public class AppointmentAdapter extends RecyclerView.Adapter<AppointmentAdapter.
|
||||
holder.textType.setText(appointment.type);
|
||||
holder.textDate.setText(appointment.date);
|
||||
holder.textTime.setText(appointment.time);
|
||||
holder.textReason.setText("Motivo: " + (appointment.reason != null ? appointment.reason : "--"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,13 +42,14 @@ public class AppointmentAdapter extends RecyclerView.Adapter<AppointmentAdapter.
|
||||
}
|
||||
|
||||
public static class AppointmentViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView textType, textDate, textTime;
|
||||
TextView textType, textDate, textTime, textReason;
|
||||
|
||||
public AppointmentViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
textType = itemView.findViewById(R.id.text_type);
|
||||
textDate = itemView.findViewById(R.id.text_date);
|
||||
textTime = itemView.findViewById(R.id.text_time);
|
||||
textReason = itemView.findViewById(R.id.text_reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,31 @@ public class LoginActivity extends AppCompatActivity {
|
||||
String email = binding.emailEditText.getText().toString();
|
||||
String password = binding.passwordEditText.getText().toString();
|
||||
|
||||
if (email.equals("admin") && password.equals("123")) {
|
||||
SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
|
||||
prefs.edit().putBoolean("is_logged_in", true).apply();
|
||||
// Mock data for admin
|
||||
String adminEmail = "admin@papcuida.com";
|
||||
prefs.edit().putString("user_email", adminEmail).apply();
|
||||
prefs.edit().putString("user_name", "Administrador").apply();
|
||||
|
||||
// Ensure admin exists in DB
|
||||
UserDao userDao = AppDatabase.getDatabase(this).userDao();
|
||||
AppDatabase.databaseWriteExecutor.execute(() -> {
|
||||
if (userDao.checkUser(adminEmail) == null) {
|
||||
User adminUser = new User("Administrador", adminEmail, "123", 99, "000000000");
|
||||
// Set empty profile picture URI if needed to avoid null issues later, though
|
||||
// it's optional
|
||||
userDao.insert(adminUser);
|
||||
}
|
||||
});
|
||||
|
||||
Toast.makeText(this, "Login de Administrador", Toast.LENGTH_SHORT).show();
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (email.isEmpty() || password.isEmpty()) {
|
||||
Toast.makeText(this, "Preencha todos os campos", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
@@ -94,8 +94,10 @@ public class ProfileFragment extends Fragment {
|
||||
});
|
||||
|
||||
private void showEditDialog() {
|
||||
if (currentUser == null)
|
||||
if (currentUser == null) {
|
||||
Toast.makeText(getContext(), "Erro: Utilizador não carregado.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset temp uri
|
||||
tempProfileUri = null;
|
||||
|
||||
@@ -41,7 +41,16 @@ public class ScheduleAppointmentFragment extends Fragment {
|
||||
setupRecyclerView();
|
||||
setupObservers();
|
||||
|
||||
btnConfirm.setOnClickListener(v -> scheduleViewModel.confirmAppointment());
|
||||
btnConfirm.setOnClickListener(v -> {
|
||||
com.google.android.material.textfield.TextInputEditText editReason = getView()
|
||||
.findViewById(R.id.edit_reason);
|
||||
String reason = editReason.getText().toString();
|
||||
if (reason.isEmpty()) {
|
||||
Toast.makeText(getContext(), "Por favor indique o motivo", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
scheduleViewModel.confirmAppointment(reason);
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -95,12 +95,12 @@ public class ScheduleViewModel extends AndroidViewModel {
|
||||
slots.add(new TimeSlot(time, isBooked, isSelected));
|
||||
}
|
||||
|
||||
public void confirmAppointment() {
|
||||
public void confirmAppointment(String reason) {
|
||||
String date = selectedDate.getValue();
|
||||
String time = selectedTime.getValue();
|
||||
|
||||
if (date != null && time != null) {
|
||||
Appointment appointment = new Appointment("Consulta Geral", date, time, false);
|
||||
Appointment appointment = new Appointment("Consulta Geral", date, time, reason, false);
|
||||
executorService.execute(() -> {
|
||||
appointmentDao.insert(appointment);
|
||||
saveSuccess.postValue(true);
|
||||
|
||||
5
app/src/main/res/drawable-v26/ic_launcher_final.xml
Normal file
5
app/src/main/res/drawable-v26/ic_launcher_final.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@android:color/white" />
|
||||
<foreground android:drawable="@drawable/ic_logo_scaled" />
|
||||
</adaptive-icon>
|
||||
4
app/src/main/res/drawable/ic_launcher_final.xml
Normal file
4
app/src/main/res/drawable/ic_launcher_final.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_logo" />
|
||||
</layer-list>
|
||||
12
app/src/main/res/drawable/ic_logo_scaled.xml
Normal file
12
app/src/main/res/drawable/ic_logo_scaled.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="-35dp"
|
||||
android:bottom="-35dp"
|
||||
android:left="-35dp"
|
||||
android:right="-35dp">
|
||||
<bitmap
|
||||
android:src="@drawable/ic_logo"
|
||||
android:gravity="center" />
|
||||
</item>
|
||||
</layer-list>
|
||||
10
app/src/main/res/drawable/ic_placeholder.xml
Normal file
10
app/src/main/res/drawable/ic_placeholder.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
||||
@@ -23,8 +23,6 @@
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="4dp"
|
||||
app:cardBackgroundColor="@color/surface_color">
|
||||
|
||||
<LinearLayout
|
||||
@@ -88,7 +86,6 @@
|
||||
android:text="@string/login_button"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:cornerRadius="28dp"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="4dp"
|
||||
app:cardBackgroundColor="@color/surface_color">
|
||||
|
||||
@@ -131,7 +130,6 @@
|
||||
android:text="@string/register_button"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:cornerRadius="28dp"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
51
app/src/main/res/layout/dialog_change_password.xml
Normal file
51
app/src/main/res/layout/dialog_change_password.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Alterar Palavra-passe"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="24dp"/>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/new_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Nova Palavra-passe"
|
||||
android:inputType="textPassword" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="end">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_cancel_password"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Cancelar"
|
||||
android:layout_marginEnd="8dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_save_password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Salvar" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -21,8 +21,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_greeting">
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="4dp"
|
||||
app:cardBackgroundColor="@color/surface_color"
|
||||
android:layout_marginBottom="32dp">
|
||||
@@ -111,7 +110,6 @@
|
||||
android:layout_height="60dp"
|
||||
android:text="Editar Dados"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cornerRadius="30dp"
|
||||
android:backgroundTint="@color/secondary_color"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
@@ -121,7 +119,6 @@
|
||||
android:layout_height="60dp"
|
||||
android:text="Terminar Sessão"
|
||||
app:strokeColor="@color/error_color"
|
||||
android:textColor="@color/error_color"
|
||||
app:cornerRadius="30dp"/>
|
||||
android:textColor="@color/error_color"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -46,6 +46,22 @@
|
||||
android:layout_weight="1"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edit_reason"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Motivo da Consulta"
|
||||
android:inputType="textMultiLine"
|
||||
android:minLines="2"
|
||||
android:maxLines="4"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_confirm_appointment"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -42,5 +42,14 @@
|
||||
android:text="HH:mm"
|
||||
android:textStyle="italic"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_reason"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Motivo: --"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:layout_marginTop="8dp"/>
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#90CAF9</color>
|
||||
<color name="purple_500">#2196F3</color>
|
||||
<color name="purple_700">#1976D2</color>
|
||||
<color name="teal_200">#80DEEA</color>
|
||||
<color name="teal_700">#0097A7</color>
|
||||
<color name="black">#000000</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
|
||||
<!-- App Brand Colors -->
|
||||
<color name="primary_color">#1976D2</color> <!-- Strong Blue -->
|
||||
<color name="primary_light_color">#BBDEFB</color>
|
||||
<color name="primary_color">#0066CC</color> <!-- Modern Medical Blue -->
|
||||
<color name="primary_light_color">#E3F2FD</color>
|
||||
<color name="primary_dark_color">#004C99</color>
|
||||
<color name="secondary_color">#000000</color> <!-- Black -->
|
||||
<color name="secondary_dark_color">#000000</color>
|
||||
|
||||
<color name="background_color">#F5F7FA</color>
|
||||
<color name="background_color">#F8F9FA</color> <!-- Soft White -->
|
||||
<color name="surface_color">#FFFFFF</color>
|
||||
<color name="text_primary">#000000</color>
|
||||
<color name="text_secondary">#424242</color>
|
||||
|
||||
<color name="text_primary">#202124</color> <!-- Softer Black -->
|
||||
<color name="text_secondary">#5F6368</color> <!-- Grey text -->
|
||||
<color name="error_color">#B00020</color>
|
||||
|
||||
<!-- Standard overrides -->
|
||||
<color name="purple_200">#90CAF9</color>
|
||||
<color name="purple_500">#0066CC</color>
|
||||
<color name="purple_700">#004C99</color>
|
||||
<color name="teal_200">#69F0AE</color>
|
||||
<color name="teal_700">#000000</color>
|
||||
<color name="black">#000000</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
</resources>
|
||||
|
||||
@@ -3,14 +3,34 @@
|
||||
<style name="Theme.Cuida" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/primary_color</item>
|
||||
<item name="colorPrimaryVariant">@color/primary_color</item>
|
||||
<item name="colorPrimaryVariant">@color/primary_dark_color</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/secondary_color</item>
|
||||
<item name="colorSecondaryVariant">@color/secondary_color</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<item name="colorSecondaryVariant">@color/secondary_dark_color</item>
|
||||
<item name="colorOnSecondary">@color/white</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
|
||||
<!-- Button Style -->
|
||||
<item name="materialButtonStyle">@style/Widget.Cuida.Button</item>
|
||||
<!-- Card Style -->
|
||||
<item name="materialCardViewStyle">@style/Widget.Cuida.CardView</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Cuida.Button" parent="Widget.MaterialComponents.Button">
|
||||
<item name="cornerRadius">100dp</item>
|
||||
<item name="android:paddingTop">12dp</item>
|
||||
<item name="android:paddingBottom">12dp</item>
|
||||
<item name="android:fontFamily">sans-serif-medium</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Cuida.CardView" parent="Widget.MaterialComponents.CardView">
|
||||
<item name="cardCornerRadius">24dp</item>
|
||||
<item name="cardElevation">0dp</item>
|
||||
<item name="strokeWidth">1dp</item>
|
||||
<item name="strokeColor">#E0E0E0</item>
|
||||
<item name="cardBackgroundColor">@color/surface_color</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user