o login esta a dar erro
This commit is contained in:
19
app/src/main/java/com/example/cuida/CuidaApplication.java
Normal file
19
app/src/main/java/com/example/cuida/CuidaApplication.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.example.cuida;
|
||||
|
||||
import android.app.Application;
|
||||
import com.google.firebase.firestore.FirebaseFirestore;
|
||||
import com.google.firebase.firestore.FirebaseFirestoreSettings;
|
||||
|
||||
public class CuidaApplication extends Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
// Ativar persistência offline globalmente para toda a aplicação
|
||||
FirebaseFirestore db = FirebaseFirestore.getInstance();
|
||||
FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
|
||||
.setPersistenceEnabled(true)
|
||||
.build();
|
||||
db.setFirestoreSettings(settings);
|
||||
}
|
||||
}
|
||||
@@ -99,12 +99,13 @@ public class AppointmentsViewModel extends AndroidViewModel {
|
||||
}
|
||||
|
||||
// Sort locally descending
|
||||
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm",
|
||||
java.util.Locale.getDefault());
|
||||
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);
|
||||
if (dateA == null || dateB == null) return 0;
|
||||
return dateB.compareTo(dateA); // Reverse for descending
|
||||
} catch (java.text.ParseException e) {
|
||||
return 0;
|
||||
|
||||
@@ -124,7 +124,6 @@ public class MedicationDialog extends DialogFragment {
|
||||
});
|
||||
}
|
||||
|
||||
radioGroupRoute = view.findViewById(R.id.radio_group_route);
|
||||
radioOral = view.findViewById(R.id.radio_oral);
|
||||
radioTopical = view.findViewById(R.id.radio_topical);
|
||||
radioInhalatory = view.findViewById(R.id.radio_inhalatory);
|
||||
@@ -140,6 +139,7 @@ public class MedicationDialog extends DialogFragment {
|
||||
for (String t : times) {
|
||||
if (!t.isEmpty()) selectedTimes.add(t);
|
||||
}
|
||||
java.util.Collections.sort(selectedTimes);
|
||||
refreshTimeChips();
|
||||
}
|
||||
|
||||
@@ -262,10 +262,10 @@ public class MedicationDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
private void refreshTimeChips() {
|
||||
if (chipGroupTimes == null) return;
|
||||
if (chipGroupTimes == null || getContext() == null) return;
|
||||
chipGroupTimes.removeAllViews();
|
||||
for (String time : selectedTimes) {
|
||||
Chip chip = new Chip(requireContext());
|
||||
Chip chip = new Chip(getContext());
|
||||
chip.setText(time);
|
||||
chip.setCloseIconVisible(true);
|
||||
chip.setOnCloseIconClickListener(v -> {
|
||||
|
||||
@@ -407,7 +407,7 @@ public class ProfileFragment extends Fragment {
|
||||
requireContext().getPackageName() + ".fileprovider", file);
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("application/pdf");
|
||||
intent.setDataAndType(uri, "application/pdf");
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, "Relatório de Saúde Cuida+");
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
@@ -73,6 +73,7 @@ public class Sns24Fragment extends Fragment {
|
||||
public void onSuccess(String result) {
|
||||
if (getActivity() != null && binding != null) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (binding == null) return;
|
||||
// Limpar a marcação da palavra [GRAVE] para não aparecer ao utilizador
|
||||
String displayResult = result.replace("[GRAVE]", "").trim();
|
||||
binding.textAiResult.setText(displayResult);
|
||||
|
||||
Reference in New Issue
Block a user