a ia esta a dar eero
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -60,11 +60,10 @@ dependencies {
|
|||||||
// Location
|
// Location
|
||||||
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
||||||
|
|
||||||
// Biblioteca oficial do Google AI para Java/Android (versão 0.11.0 - Última Estável)
|
// Biblioteca oficial do Google AI para Java/Android (versão 0.9.0 - Estável para Java)
|
||||||
implementation 'com.google.ai.client.generativeai:generativeai:0.11.0'
|
implementation 'com.google.ai.client.generativeai:generativeai:0.9.0'
|
||||||
|
|
||||||
// Necessário para lidar com operações assíncronas (Guava)
|
// Necessário para lidar com operações assíncronas (Guava)
|
||||||
implementation 'com.google.common.util.concurrent.ListenableFuture:9999.0-empty-to-avoid-conflict-with-guava'
|
|
||||||
implementation 'com.google.guava:guava:31.1-android'
|
implementation 'com.google.guava:guava:31.1-android'
|
||||||
|
|
||||||
// Para chamadas de rede e JSON
|
// Para chamadas de rede e JSON
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
#Tue Apr 21 16:18:45 WEST 2026
|
#Tue Apr 21 17:07:01 WEST 2026
|
||||||
com.example.cuida.app-main-56\:/drawable-v26/ic_launcher_final.xml=/Users/230405/Desktop/papcuida/app/build/intermediates/merged_res/debug/mergeDebugResources/drawable-v26_ic_launcher_final.xml.flat
|
com.example.cuida.app-main-56\:/drawable-v26/ic_launcher_final.xml=/Users/230405/Desktop/papcuida/app/build/intermediates/merged_res/debug/mergeDebugResources/drawable-v26_ic_launcher_final.xml.flat
|
||||||
com.example.cuida.app-main-56\:/drawable/bg_search_results.xml=/Users/230405/Desktop/papcuida/app/build/intermediates/merged_res/debug/mergeDebugResources/drawable_bg_search_results.xml.flat
|
com.example.cuida.app-main-56\:/drawable/bg_search_results.xml=/Users/230405/Desktop/papcuida/app/build/intermediates/merged_res/debug/mergeDebugResources/drawable_bg_search_results.xml.flat
|
||||||
com.example.cuida.app-main-56\:/drawable/btn_outline_error.xml=/Users/230405/Desktop/papcuida/app/build/intermediates/merged_res/debug/mergeDebugResources/drawable_btn_outline_error.xml.flat
|
com.example.cuida.app-main-56\:/drawable/btn_outline_error.xml=/Users/230405/Desktop/papcuida/app/build/intermediates/merged_res/debug/mergeDebugResources/drawable_btn_outline_error.xml.flat
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
|
||||||
app:cardCornerRadius="16dp"
|
|
||||||
app:cardElevation="4dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:src="@android:drawable/ic_menu_agenda"
|
|
||||||
app:tint="@color/secondary_color"
|
|
||||||
android:layout_marginEnd="16dp"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_med_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Nome Medicamento"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:textColor="@color/primary_color"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_med_dosage"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Dosagem"
|
|
||||||
android:layout_marginTop="4dp"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_med_notes"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Observações"
|
|
||||||
android:textStyle="italic"
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:layout_marginTop="2dp"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_med_time"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="HH:mm"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:layout_marginTop="6dp"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/checkbox_taken"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:buttonTint="@color/primary_color"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#Tue Apr 21 16:42:34 WEST 2026
|
#Tue Apr 21 17:07:50 WEST 2026
|
||||||
base.0=/Users/230405/Desktop/papcuida/app/build/intermediates/dex/debug/mergeExtDexDebug/classes.dex
|
base.0=/Users/230405/Desktop/papcuida/app/build/intermediates/dex/debug/mergeExtDexDebug/classes.dex
|
||||||
base.1=/Users/230405/Desktop/papcuida/app/build/intermediates/dex/debug/mergeProjectDexDebug/0/classes.dex
|
base.1=/Users/230405/Desktop/papcuida/app/build/intermediates/dex/debug/mergeProjectDexDebug/0/classes.dex
|
||||||
base.10=/Users/230405/Desktop/papcuida/app/build/intermediates/global_synthetics_dex/debug/generateDebugGlobalSynthetics/classes.dex
|
base.10=/Users/230405/Desktop/papcuida/app/build/intermediates/global_synthetics_dex/debug/generateDebugGlobalSynthetics/classes.dex
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,14 +7,14 @@
|
|||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_dialog_add_medication.xml.flat",
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_dialog_add_medication.xml.flat",
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/dialog_add_medication.xml"
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/dialog_add_medication.xml"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_item_medication.xml.flat",
|
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/item_medication.xml"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_activity_forgot_password.xml.flat",
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_activity_forgot_password.xml.flat",
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/activity_forgot_password.xml"
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/activity_forgot_password.xml"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_item_medication.xml.flat",
|
||||||
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/item_medication.xml"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/menu_bottom_nav_menu.xml.flat",
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/menu_bottom_nav_menu.xml.flat",
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/menu/bottom_nav_menu.xml"
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/menu/bottom_nav_menu.xml"
|
||||||
@@ -27,10 +27,6 @@
|
|||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_item_comprimido_search.xml.flat",
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_item_comprimido_search.xml.flat",
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/item_comprimido_search.xml"
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/item_comprimido_search.xml"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"merged": "com.example.cuida.app-debug-54:/layout_item_medication.xml.flat",
|
|
||||||
"source": "com.example.cuida.app-main-56:/layout/item_medication.xml"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_fragment_home.xml.flat",
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_fragment_home.xml.flat",
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/fragment_home.xml"
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/fragment_home.xml"
|
||||||
@@ -43,6 +39,10 @@
|
|||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/drawable_ic_launcher_round.xml.flat",
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/drawable_ic_launcher_round.xml.flat",
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/drawable/ic_launcher_round.xml"
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/drawable/ic_launcher_round.xml"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"merged": "com.example.cuida.app-debug-54:/drawable_btn_outline_error.xml.flat",
|
||||||
|
"source": "com.example.cuida.app-main-56:/drawable/btn_outline_error.xml"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/drawable_ic_logo.png.flat",
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/drawable_ic_logo.png.flat",
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/drawable/ic_logo.png"
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/drawable/ic_logo.png"
|
||||||
@@ -71,6 +71,10 @@
|
|||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_item_time_slot.xml.flat",
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_item_time_slot.xml.flat",
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/item_time_slot.xml"
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/item_time_slot.xml"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"merged": "com.example.cuida.app-debug-54:/drawable_btn_outline_primary.xml.flat",
|
||||||
|
"source": "com.example.cuida.app-main-56:/drawable/btn_outline_primary.xml"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_activity_reset_password.xml.flat",
|
"merged": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-debug-54:/layout_activity_reset_password.xml.flat",
|
||||||
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/activity_reset_password.xml"
|
"source": "/Users/230405/.gradle/daemon/9.4.1/com.example.cuida.app-main-56:/layout/activity_reset_password.xml"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,23 +1,16 @@
|
|||||||
package com.example.cuida.services;
|
package com.example.cuida.services;
|
||||||
|
|
||||||
// Imports básicos do SDK do Google AI
|
|
||||||
import com.google.ai.client.generativeai.GenerativeModel;
|
import com.google.ai.client.generativeai.GenerativeModel;
|
||||||
import com.google.ai.client.generativeai.java.GenerativeModelFutures;
|
import com.google.ai.client.generativeai.java.GenerativeModelFutures;
|
||||||
|
|
||||||
// Imports de tipos e configurações
|
|
||||||
import com.google.ai.client.generativeai.type.BlockThreshold;
|
|
||||||
import com.google.ai.client.generativeai.type.Content;
|
import com.google.ai.client.generativeai.type.Content;
|
||||||
import com.google.ai.client.generativeai.type.GenerateContentResponse;
|
import com.google.ai.client.generativeai.type.GenerateContentResponse;
|
||||||
import com.google.ai.client.generativeai.type.GenerationConfig;
|
|
||||||
import com.google.ai.client.generativeai.type.HarmCategory;
|
import com.google.ai.client.generativeai.type.HarmCategory;
|
||||||
import com.google.ai.client.generativeai.type.SafetySetting;
|
import com.google.ai.client.generativeai.type.SafetySetting;
|
||||||
|
import com.google.ai.client.generativeai.type.BlockThreshold;
|
||||||
// Imports do Guava para processamento assíncrono
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
// Imports standard de Java
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
@@ -27,7 +20,7 @@ public class Gemini {
|
|||||||
private final GenerativeModelFutures modelo;
|
private final GenerativeModelFutures modelo;
|
||||||
|
|
||||||
public Gemini() {
|
public Gemini() {
|
||||||
// 1. Configurar Segurança
|
// 1. Configurar Segurança (Padrão para evitar bloqueio de termos médicos)
|
||||||
List<SafetySetting> safetySettings = Arrays.asList(
|
List<SafetySetting> safetySettings = Arrays.asList(
|
||||||
new SafetySetting(HarmCategory.HARASSMENT, BlockThreshold.NONE),
|
new SafetySetting(HarmCategory.HARASSMENT, BlockThreshold.NONE),
|
||||||
new SafetySetting(HarmCategory.HATE_SPEECH, BlockThreshold.NONE),
|
new SafetySetting(HarmCategory.HATE_SPEECH, BlockThreshold.NONE),
|
||||||
@@ -35,16 +28,11 @@ public class Gemini {
|
|||||||
new SafetySetting(HarmCategory.DANGEROUS_CONTENT, BlockThreshold.NONE)
|
new SafetySetting(HarmCategory.DANGEROUS_CONTENT, BlockThreshold.NONE)
|
||||||
);
|
);
|
||||||
|
|
||||||
// 2. Configuração de Geração
|
// 2. Modelo (Simplificado ao máximo para garantir compilação)
|
||||||
GenerationConfig config = new GenerationConfig.Builder()
|
|
||||||
.setTemperature(0.7f)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// 3. Inicialização do Modelo (Gemini 1.5 Flash)
|
|
||||||
GenerativeModel generativeModel = new GenerativeModel(
|
GenerativeModel generativeModel = new GenerativeModel(
|
||||||
"gemini-1.5-flash",
|
"gemini-1.5-flash",
|
||||||
"AIzaSyBmLgn-SHaTDvAeDWsw2iTZRR9gahhOu7k",
|
"AIzaSyBmLgn-SHaTDvAeDWsw2iTZRR9gahhOu7k",
|
||||||
config,
|
null, // Usamos o GenerationConfig padrão para evitar erro de setTemperature
|
||||||
safetySettings
|
safetySettings
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -70,7 +58,7 @@ public class Gemini {
|
|||||||
if (resultado != null && resultado.getText() != null) {
|
if (resultado != null && resultado.getText() != null) {
|
||||||
callback.onSuccess(resultado.getText());
|
callback.onSuccess(resultado.getText());
|
||||||
} else {
|
} else {
|
||||||
callback.onError(new Exception("IA não devolveu texto."));
|
callback.onError(new Exception("Resposta vazia da IA"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class MedicationViewModel extends AndroidViewModel {
|
|||||||
if (value != null) {
|
if (value != null) {
|
||||||
for (QueryDocumentSnapshot doc : value) {
|
for (QueryDocumentSnapshot doc : value) {
|
||||||
Medication med = doc.toObject(Medication.class);
|
Medication med = doc.toObject(Medication.class);
|
||||||
med.id = doc.getId(); // Ensure ID is set
|
med.setId(doc.getId()); // Ensure ID is set
|
||||||
meds.add(med);
|
meds.add(med);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,25 +92,25 @@ public class MedicationViewModel extends AndroidViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update(Medication medication) {
|
public void update(Medication medication) {
|
||||||
if (auth.getCurrentUser() == null || medication.id == null)
|
if (auth.getCurrentUser() == null || medication.getId() == null)
|
||||||
return;
|
return;
|
||||||
String userId = auth.getCurrentUser().getUid();
|
String userId = auth.getCurrentUser().getUid();
|
||||||
|
|
||||||
medication.userId = userId;
|
medication.userId = userId;
|
||||||
|
|
||||||
db.collection("medicamentos")
|
db.collection("medicamentos")
|
||||||
.document(medication.id)
|
.document(medication.getId())
|
||||||
.set(medication)
|
.set(medication)
|
||||||
.addOnSuccessListener(aVoid -> Log.d("MedicationViewModel", "Medication updated"))
|
.addOnSuccessListener(aVoid -> Log.d("MedicationViewModel", "Medication updated"))
|
||||||
.addOnFailureListener(e -> Log.w("MedicationViewModel", "Error updating medication", e));
|
.addOnFailureListener(e -> Log.w("MedicationViewModel", "Error updating medication", e));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(Medication medication) {
|
public void delete(Medication medication) {
|
||||||
if (auth.getCurrentUser() == null || medication.id == null)
|
if (auth.getCurrentUser() == null || medication.getId() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
db.collection("medicamentos")
|
db.collection("medicamentos")
|
||||||
.document(medication.id)
|
.document(medication.getId())
|
||||||
.delete()
|
.delete()
|
||||||
.addOnSuccessListener(aVoid -> Log.d("MedicationViewModel", "Medication deleted"))
|
.addOnSuccessListener(aVoid -> Log.d("MedicationViewModel", "Medication deleted"))
|
||||||
.addOnFailureListener(e -> Log.w("MedicationViewModel", "Error deleting medication", e));
|
.addOnFailureListener(e -> Log.w("MedicationViewModel", "Error deleting medication", e));
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user