corrige o erro da camera e da ia não funcionar e mudar o layout futuramente
This commit is contained in:
8
.idea/deploymentTargetSelector.xml
generated
8
.idea/deploymentTargetSelector.xml
generated
@@ -4,6 +4,14 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2026-05-08T08:25:33.040648Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="LocalEmulator" identifier="path=/Users/230412/.android/avd/Medium_Phone.avd" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
|
||||
@@ -1,168 +1,87 @@
|
||||
package com.example.pap;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import java.util.Collections;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class ChatActivity extends AppCompatActivity {
|
||||
|
||||
private TextView tvChatLog;
|
||||
private EditText etMensagem;
|
||||
private ImageButton btnEnviar;
|
||||
private LinearLayout chatLayout;
|
||||
private ScrollView chatScrollView;
|
||||
private Button btnEnviar;
|
||||
private TextView btnVoltarChat;
|
||||
|
||||
// A TUA CHAVE DA GOOGLE VEM PARA AQUI!
|
||||
private static final String GEMINI_API_KEY = "AQ.Ab8RN6IfhsFBO3UOpK3vYd7BrR2nfFb-mVE--nvqRnR46hB36A";
|
||||
|
||||
// O motor do Gemini 1.5 Flash
|
||||
private static final String GEMINI_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=" + GEMINI_API_KEY;
|
||||
|
||||
private OkHttpClient client;
|
||||
// NÃO TE ESQUEÇAS DE COLAR A TUA CHAVE AQUI!
|
||||
private final String MINHA_API_KEY = "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";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chat);
|
||||
|
||||
tvChatLog = findViewById(R.id.tvChatLog);
|
||||
etMensagem = findViewById(R.id.etMensagem);
|
||||
btnEnviar = findViewById(R.id.btnEnviar);
|
||||
chatLayout = findViewById(R.id.chatLayout);
|
||||
chatScrollView = findViewById(R.id.chatScrollView);
|
||||
btnEnviar = findViewById(R.id.btnEnviarChat);
|
||||
btnVoltarChat = findViewById(R.id.btnVoltarChat);
|
||||
|
||||
client = new OkHttpClient();
|
||||
// --- LÓGICA DO BOTÃO VOLTAR PARA O HOME ---
|
||||
btnVoltarChat.setOnClickListener(v -> {
|
||||
// Cria a intenção de ir para a MainActivity (Home)
|
||||
Intent intent = new Intent(ChatActivity.this, HomeActivity.class);
|
||||
// Esta linha garante que não ficas com mil ecrãs abertos uns por cima dos outros
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
finish(); // Fecha o Chat
|
||||
});
|
||||
|
||||
// Dá as boas vindas
|
||||
adicionarBalaoNoEcra("Olá! Sou o NutriChat AI 🤖. O que comeste hoje ou que dúvidas tens sobre a tua dieta?", false);
|
||||
// Receber a análise da foto se existir
|
||||
String analiseComida = getIntent().getStringExtra("analise_comida");
|
||||
if (analiseComida != null && !analiseComida.isEmpty()) {
|
||||
tvChatLog.setText("IA: Analisei o teu prato.\n" + analiseComida + "\n\nO que queres saber mais?");
|
||||
}
|
||||
|
||||
btnEnviar.setOnClickListener(v -> {
|
||||
String pergunta = etMensagem.getText().toString().trim();
|
||||
if (pergunta.isEmpty()) {
|
||||
Toast.makeText(this, "Escreve alguma merda primeiro!", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
String pergunta = etMensagem.getText().toString();
|
||||
if (!pergunta.isEmpty()) {
|
||||
tvChatLog.append("\n\nTu: " + pergunta);
|
||||
etMensagem.setText("");
|
||||
perguntarIA(pergunta);
|
||||
}
|
||||
|
||||
// 1. Mostrar a mensagem do utilizador no ecrã
|
||||
adicionarBalaoNoEcra(pergunta, true);
|
||||
etMensagem.setText(""); // Limpa a caixa de texto
|
||||
|
||||
// 2. Chamar a Inteligência Artificial
|
||||
chamarGemini(pergunta);
|
||||
});
|
||||
}
|
||||
|
||||
// Função que desenha os balões de conversa no ecrã
|
||||
private void adicionarBalaoNoEcra(String texto, boolean isUser) {
|
||||
runOnUiThread(() -> {
|
||||
TextView tv = new TextView(this);
|
||||
tv.setText(texto);
|
||||
tv.setTextSize(16f);
|
||||
tv.setPadding(30, 20, 30, 20);
|
||||
tv.setTextColor(isUser ? Color.WHITE : Color.parseColor("#1E293B"));
|
||||
private void perguntarIA(String texto) {
|
||||
tvChatLog.append("\n\nIA: A pensar... ⏳");
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
params.setMargins(0, 10, 0, 10);
|
||||
AiRequest request = new AiRequest(java.util.Arrays.asList(
|
||||
new Message("system", Collections.singletonList(new ContentPart("text", "És um nutricionista de Portugal. Responde SEMPRE de forma muito curta (máximo 2 frases). Nunca uses asteriscos."))),
|
||||
new Message("user", Collections.singletonList(new ContentPart("text", texto)))
|
||||
));
|
||||
|
||||
// Se for o utilizador, o balão vai para a direita e fica azul
|
||||
if (isUser) {
|
||||
params.gravity = Gravity.END;
|
||||
tv.setBackgroundResource(R.drawable.balao_user); // Já vamos criar isto!
|
||||
} else {
|
||||
// Se for a IA, o balão vai para a esquerda e fica branco/cinza
|
||||
params.gravity = Gravity.START;
|
||||
tv.setBackgroundResource(R.drawable.balao_ai); // Já vamos criar isto!
|
||||
}
|
||||
|
||||
tv.setLayoutParams(params);
|
||||
chatLayout.addView(tv);
|
||||
|
||||
// Faz scroll automático para o fundo para ver a mensagem nova
|
||||
chatScrollView.post(() -> chatScrollView.fullScroll(ScrollView.FOCUS_DOWN));
|
||||
});
|
||||
}
|
||||
|
||||
// Função que vai à internet falar com o cérebro da Google
|
||||
private void chamarGemini(String pergunta) {
|
||||
try {
|
||||
// Instrução secreta para ele agir como Nutricionista
|
||||
String promptCompleto = "Aja como um nutricionista simpático e profissional. Responda de forma curta e direta à seguinte mensagem do utilizador: " + pergunta;
|
||||
|
||||
// Construir o JSON que o Gemini exige
|
||||
JSONObject part = new JSONObject();
|
||||
part.put("text", promptCompleto);
|
||||
JSONArray parts = new JSONArray();
|
||||
parts.put(part);
|
||||
JSONObject content = new JSONObject();
|
||||
content.put("parts", parts);
|
||||
JSONArray contents = new JSONArray();
|
||||
contents.put(content);
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
jsonBody.put("contents", contents);
|
||||
|
||||
RequestBody body = RequestBody.create(jsonBody.toString(), MediaType.get("application/json; charset=utf-8"));
|
||||
Request request = new Request.Builder()
|
||||
.url(GEMINI_URL)
|
||||
.post(body)
|
||||
.build();
|
||||
|
||||
// Fazer a chamada fora da Thread principal para a app não encravar
|
||||
client.newCall(request).enqueue(new Callback() {
|
||||
AiConfig.getRetrofit().create(AiApi.class)
|
||||
.analisarImagem("Bearer " + MINHA_API_KEY, request)
|
||||
.enqueue(new Callback<AiResponse>() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
adicionarBalaoNoEcra("Oops! Fiquei sem internet ou deu merda na ligação. 🔌", false);
|
||||
public void onResponse(Call<AiResponse> call, Response<AiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
String resposta = response.body().choices.get(0).message.content;
|
||||
String limpa = resposta.replace("**", "").replace("*", "");
|
||||
String atual = tvChatLog.getText().toString();
|
||||
tvChatLog.setText(atual.replace("IA: A pensar... ⏳", "IA: " + limpa));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
if (response.isSuccessful()) {
|
||||
try {
|
||||
String respostaJSON = response.body().string();
|
||||
JSONObject jsonObject = new JSONObject(respostaJSON);
|
||||
// Escarafunchar o JSON para tirar só o texto da resposta
|
||||
String respostaIA = jsonObject.getJSONArray("candidates")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("content")
|
||||
.getJSONArray("parts")
|
||||
.getJSONObject(0)
|
||||
.getString("text");
|
||||
|
||||
// Mostrar a resposta no ecrã
|
||||
adicionarBalaoNoEcra(respostaIA, false);
|
||||
|
||||
} catch (Exception e) {
|
||||
adicionarBalaoNoEcra("Deu um nó no meu cérebro ao ler os dados. 🤯", false);
|
||||
}
|
||||
} else {
|
||||
adicionarBalaoNoEcra("Erro da Google: " + response.code(), false);
|
||||
}
|
||||
public void onFailure(Call<AiResponse> call, Throwable t) {
|
||||
String atual = tvChatLog.getText().toString();
|
||||
tvChatLog.setText(atual.replace("IA: A pensar... ⏳", "IA: Erro de rede."));
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,147 +1,81 @@
|
||||
package com.example.pap;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.provider.MediaStore;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class DesafiosActivity extends AppCompatActivity {
|
||||
|
||||
private TextView tvPontos, tvStatusDesafio1, tvStatusDesafio2;
|
||||
private Button btnVideoDesafio1, btnVideoDesafio2, btnVoltarDesafios;
|
||||
|
||||
private int pontosAtuais = 0;
|
||||
private SharedPreferences sharedPreferences;
|
||||
|
||||
// Variável para saber qual desafio está a ser gravado no momento
|
||||
private int desafioAtualEmGravacao = -1;
|
||||
|
||||
// Ferramenta para abrir a câmara de vídeo e receber o resultado
|
||||
private final ActivityResultLauncher<Intent> videoLauncher = registerForActivityResult(
|
||||
new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
if (result.getResultCode() == RESULT_OK) {
|
||||
// O utilizador gravou o vídeo com sucesso!
|
||||
Toast.makeText(this, "Vídeo capturado! A enviar para a IA...", Toast.LENGTH_SHORT).show();
|
||||
simularAnaliseDaIA(desafioAtualEmGravacao);
|
||||
} else {
|
||||
Toast.makeText(this, "Gravação cancelada.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
);
|
||||
private ProgressBar progressAgua;
|
||||
private TextView tvStatusAgua;
|
||||
private int coposBebidos = 3; // Simulação de progresso atual
|
||||
private final int META_COPOS = 8;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_desafios);
|
||||
|
||||
// 1. Inicializar os componentes
|
||||
tvPontos = findViewById(R.id.tvPontos);
|
||||
tvStatusDesafio1 = findViewById(R.id.tvStatusDesafio1);
|
||||
tvStatusDesafio2 = findViewById(R.id.tvStatusDesafio2);
|
||||
btnVideoDesafio1 = findViewById(R.id.btnVideoDesafio1);
|
||||
btnVideoDesafio2 = findViewById(R.id.btnVideoDesafio2);
|
||||
btnVoltarDesafios = findViewById(R.id.btnVoltarDesafios);
|
||||
progressAgua = findViewById(R.id.progressAgua);
|
||||
tvStatusAgua = findViewById(R.id.tvStatusAgua);
|
||||
Button btnGravarAgua = findViewById(R.id.btnGravarAgua);
|
||||
Button btnEx1 = findViewById(R.id.btnGravarEx1);
|
||||
Button btnEx2 = findViewById(R.id.btnGravarEx2);
|
||||
|
||||
// 2. Carregar os dados guardados no telemóvel
|
||||
sharedPreferences = getSharedPreferences("AppEmagrecimento", MODE_PRIVATE);
|
||||
carregarDadosGuardados();
|
||||
|
||||
// 3. Configurar os cliques para gravar vídeo
|
||||
btnVideoDesafio1.setOnClickListener(v -> abrirCameraVideo(1));
|
||||
btnVideoDesafio2.setOnClickListener(v -> abrirCameraVideo(2));
|
||||
|
||||
// 4. Botão de voltar
|
||||
btnVoltarDesafios.setOnClickListener(v -> finish());
|
||||
// Launcher para capturar VÍDEO
|
||||
ActivityResultLauncher<Intent> videoLauncher = registerForActivityResult(
|
||||
new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
if (result.getResultCode() == RESULT_OK) {
|
||||
// AQUI É ONDE A IA ENTRARIA PARA ANALISAR O VÍDEO
|
||||
validarDesafioIA();
|
||||
}
|
||||
});
|
||||
|
||||
// Função para abrir a câmara do telemóvel em modo VÍDEO
|
||||
private void abrirCameraVideo(int numeroDoDesafio) {
|
||||
desafioAtualEmGravacao = numeroDoDesafio;
|
||||
// Configurar botões para abrir a câmara em modo VÍDEO
|
||||
btnGravarAgua.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
|
||||
|
||||
try {
|
||||
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10); // Limita a 10 segundos para ser rápido
|
||||
videoLauncher.launch(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
// Caso o emulador não tenha uma câmara configurada, abre a galeria para selecionar um vídeo
|
||||
Toast.makeText(this, "Câmara não encontrada. Selecione um vídeo da galeria.", Toast.LENGTH_LONG).show();
|
||||
Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
galleryIntent.setType("video/*");
|
||||
videoLauncher.launch(galleryIntent);
|
||||
}
|
||||
});
|
||||
|
||||
btnEx1.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
|
||||
videoLauncher.launch(intent);
|
||||
});
|
||||
|
||||
btnEx2.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
|
||||
videoLauncher.launch(intent);
|
||||
});
|
||||
|
||||
findViewById(R.id.btnVoltarDesafios).setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
// Função que simula o tempo de pensamento da Inteligência Artificial
|
||||
private void simularAnaliseDaIA(int numeroDoDesafio) {
|
||||
TextView tvStatusAtual = (numeroDoDesafio == 1) ? tvStatusDesafio1 : tvStatusDesafio2;
|
||||
Button btnAtual = (numeroDoDesafio == 1) ? btnVideoDesafio1 : btnVideoDesafio2;
|
||||
private void validarDesafioIA() {
|
||||
// Simulação: A IA demora 2 segundos a processar e diz que está OK
|
||||
Toast.makeText(this, "IA a analisar movimento...", Toast.LENGTH_SHORT).show();
|
||||
|
||||
// Muda a interface para mostrar que a IA está a trabalhar
|
||||
tvStatusAtual.setText("A IA está a analisar os teus movimentos...");
|
||||
tvStatusAtual.setTextColor(Color.parseColor("#2196F3")); // Azul
|
||||
btnAtual.setEnabled(false);
|
||||
btnAtual.setText("A processar...");
|
||||
progressAgua.postDelayed(() -> {
|
||||
coposBebidos++;
|
||||
if (coposBebidos > META_COPOS) coposBebidos = META_COPOS;
|
||||
|
||||
// Simula uma espera de 3.5 segundos (tempo que a IA demoraria a analisar o vídeo)
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
atualizarProgressoAgua();
|
||||
Toast.makeText(this, "Desafio Validado! +10 pontos", Toast.LENGTH_LONG).show();
|
||||
|
||||
// Depois de 3.5 segundos, a IA aprova o desafio!
|
||||
int pontosGanhos = (numeroDoDesafio == 1) ? 20 : 30;
|
||||
|
||||
// Atualizar UI
|
||||
tvStatusAtual.setText("Aprovado pela IA! +" + pontosGanhos + " pts");
|
||||
tvStatusAtual.setTextColor(Color.parseColor("#4CAF50")); // Verde
|
||||
btnAtual.setText("Desafio Concluído");
|
||||
btnAtual.setBackgroundTintList(android.content.res.ColorStateList.valueOf(Color.parseColor("#81C784")));
|
||||
|
||||
// Adicionar pontos e guardar
|
||||
adicionarPontosEGuardar(numeroDoDesafio, pontosGanhos);
|
||||
|
||||
}, 3500); // 3500 milissegundos = 3.5 segundos
|
||||
// Aqui depois vamos enviar os pontos para o Perfil
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
private void adicionarPontosEGuardar(int numeroDoDesafio, int pontos) {
|
||||
pontosAtuais += pontos;
|
||||
tvPontos.setText(String.valueOf(pontosAtuais));
|
||||
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putInt("pontosTotais", pontosAtuais);
|
||||
editor.putBoolean("desafio_" + numeroDoDesafio + "_concluido", true);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private void carregarDadosGuardados() {
|
||||
pontosAtuais = sharedPreferences.getInt("pontosTotais", 0);
|
||||
tvPontos.setText(String.valueOf(pontosAtuais));
|
||||
|
||||
// Verificar se o Desafio 1 já foi feito anteriormente
|
||||
if (sharedPreferences.getBoolean("desafio_1_concluido", false)) {
|
||||
tvStatusDesafio1.setText("Aprovado pela IA!");
|
||||
tvStatusDesafio1.setTextColor(Color.parseColor("#4CAF50"));
|
||||
btnVideoDesafio1.setEnabled(false);
|
||||
btnVideoDesafio1.setText("Desafio Concluído");
|
||||
btnVideoDesafio1.setBackgroundTintList(android.content.res.ColorStateList.valueOf(Color.parseColor("#81C784")));
|
||||
}
|
||||
|
||||
// Verificar se o Desafio 2 já foi feito anteriormente
|
||||
if (sharedPreferences.getBoolean("desafio_2_concluido", false)) {
|
||||
tvStatusDesafio2.setText("Aprovado pela IA!");
|
||||
tvStatusDesafio2.setTextColor(Color.parseColor("#4CAF50"));
|
||||
btnVideoDesafio2.setEnabled(false);
|
||||
btnVideoDesafio2.setText("Desafio Concluído");
|
||||
btnVideoDesafio2.setBackgroundTintList(android.content.res.ColorStateList.valueOf(Color.parseColor("#81C784")));
|
||||
}
|
||||
private void atualizarProgressoAgua() {
|
||||
progressAgua.setProgress(coposBebidos);
|
||||
tvStatusAgua.setText(coposBebidos + " de " + META_COPOS + " copos (" + (coposBebidos * 250) + "ml / 2L)");
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.example.pap;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class EstatisticasActivity extends AppCompatActivity {
|
||||
@@ -12,15 +11,8 @@ public class EstatisticasActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_estatisticas);
|
||||
|
||||
Button btnVoltarHome = findViewById(R.id.btnVoltarHome);
|
||||
|
||||
// Ao clicar no botão voltar, a janela de estatísticas fecha
|
||||
// e o utilizador regressa naturalmente à HomeActivity que estava por baixo
|
||||
btnVoltarHome.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
// Funcionalidade do botão de voltar
|
||||
TextView btnVoltarStats = findViewById(R.id.btnVoltarStats);
|
||||
btnVoltarStats.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package com.example.pap;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.ImageDecoder;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Base64;
|
||||
@@ -14,6 +17,7 @@ import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import retrofit2.Call;
|
||||
@@ -23,11 +27,12 @@ import retrofit2.Response;
|
||||
public class FotoActivity extends AppCompatActivity {
|
||||
|
||||
private ImageView ivFotoComida;
|
||||
private Button btnTirarFoto, btnAnalisarIA, btnVoltarFoto;
|
||||
private Button btnTirarFoto, btnGaleria, btnAnalisarIA, btnIrParaChat;
|
||||
private TextView tvResultadoIA;
|
||||
private Bitmap imagemCapturada;
|
||||
private String textoAnalise = "";
|
||||
|
||||
// COLA A TUA CHAVE DO OPENROUTER AQUI (Aquela que tiraste sem telemóvel e sem VPN)
|
||||
// COLA A TUA CHAVE AQUI
|
||||
private final String MINHA_API_KEY = "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";
|
||||
|
||||
@Override
|
||||
@@ -37,71 +42,113 @@ public class FotoActivity extends AppCompatActivity {
|
||||
|
||||
ivFotoComida = findViewById(R.id.ivFotoComida);
|
||||
btnTirarFoto = findViewById(R.id.btnTirarFoto);
|
||||
btnGaleria = findViewById(R.id.btnGaleria);
|
||||
btnAnalisarIA = findViewById(R.id.btnAnalisarIA);
|
||||
btnIrParaChat = findViewById(R.id.btnIrParaChat);
|
||||
tvResultadoIA = findViewById(R.id.tvResultadoIA);
|
||||
btnVoltarFoto = findViewById(R.id.btnVoltarFoto);
|
||||
|
||||
ActivityResultLauncher<Intent> cameraLauncher = registerForActivityResult(
|
||||
ActivityResultLauncher<Intent> camLauncher = registerForActivityResult(
|
||||
new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
if (result.getResultCode() == RESULT_OK && result.getData() != null) {
|
||||
Bundle extras = result.getData().getExtras();
|
||||
if (extras != null && extras.containsKey("data")) {
|
||||
imagemCapturada = (Bitmap) extras.get("data");
|
||||
mostrarImagemPreparada();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ActivityResultLauncher<Intent> galLauncher = registerForActivityResult(
|
||||
new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
if (result.getResultCode() == RESULT_OK && result.getData() != null) {
|
||||
Uri uri = result.getData().getData();
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
ImageDecoder.Source source = ImageDecoder.createSource(this.getContentResolver(), uri);
|
||||
imagemCapturada = ImageDecoder.decodeBitmap(source);
|
||||
} else {
|
||||
imagemCapturada = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
|
||||
}
|
||||
mostrarImagemPreparada();
|
||||
} catch (IOException e) {
|
||||
tvResultadoIA.setText("Erro ao processar imagem.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
btnTirarFoto.setOnClickListener(v -> camLauncher.launch(new Intent(MediaStore.ACTION_IMAGE_CAPTURE)));
|
||||
btnGaleria.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
galLauncher.launch(intent);
|
||||
});
|
||||
|
||||
btnAnalisarIA.setOnClickListener(v -> enviarParaIA());
|
||||
|
||||
btnIrParaChat.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(FotoActivity.this, ChatActivity.class);
|
||||
intent.putExtra("analise_comida", textoAnalise);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
findViewById(R.id.btnVoltarFoto).setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
private void mostrarImagemPreparada() {
|
||||
if (imagemCapturada != null) {
|
||||
ivFotoComida.setVisibility(View.VISIBLE);
|
||||
ivFotoComida.setPadding(0, 0, 0, 0);
|
||||
ivFotoComida.setImageBitmap(imagemCapturada);
|
||||
|
||||
btnTirarFoto.setVisibility(View.GONE);
|
||||
btnAnalisarIA.setVisibility(View.VISIBLE);
|
||||
tvResultadoIA.setText("Prato detetado! Clica em Analisar.");
|
||||
btnIrParaChat.setVisibility(View.GONE);
|
||||
tvResultadoIA.setText("Pronto para analisar.");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
btnTirarFoto.setOnClickListener(v -> cameraLauncher.launch(new Intent(MediaStore.ACTION_IMAGE_CAPTURE)));
|
||||
|
||||
btnAnalisarIA.setOnClickListener(v -> { if (imagemCapturada != null) enviarParaIA(); });
|
||||
btnVoltarFoto.setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
private void enviarParaIA() {
|
||||
tvResultadoIA.setText("A procurar servidor livre e a analisar... ⏳");
|
||||
tvResultadoIA.setText("A processar... ⏳");
|
||||
btnAnalisarIA.setEnabled(false);
|
||||
btnIrParaChat.setVisibility(View.GONE);
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
imagemCapturada.compress(Bitmap.CompressFormat.JPEG, 60, outputStream);
|
||||
String base64Image = Base64.encodeToString(outputStream.toByteArray(), Base64.NO_WRAP);
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
imagemCapturada.compress(Bitmap.CompressFormat.JPEG, 50, os);
|
||||
String base64 = Base64.encodeToString(os.toByteArray(), Base64.NO_WRAP);
|
||||
|
||||
String dataUrl = "data:image/jpeg;base64," + base64Image;
|
||||
String prompt = "Identifica a comida nesta imagem e diz-me as calorias e macronutrientes num pequeno parágrafo.";
|
||||
String ordemParaIA = "És um nutricionista prático. Identifica a comida e dá os valores de forma SUPER RESUMIDA. " +
|
||||
"REGRAS: 1. Português de Portugal. 2. SEM asteriscos. 3. Máximo 4 linhas. " +
|
||||
"Formato exato: \n" +
|
||||
"Prato: [Nome]\n" +
|
||||
"Calorias: [Valor] kcal\n" +
|
||||
"Macros: [X]g Proteína, [X]g Hidratos, [X]g Gordura\n" +
|
||||
"Dica: [Uma frase curta].";
|
||||
|
||||
ContentPart textPart = new ContentPart("text", prompt);
|
||||
ContentPart imagePart = new ContentPart("image_url", new ImageUrl(dataUrl));
|
||||
Message message = new Message("user", java.util.Arrays.asList(textPart, imagePart));
|
||||
AiRequest request = new AiRequest(Collections.singletonList(message));
|
||||
AiRequest request = new AiRequest(Collections.singletonList(
|
||||
new Message("user", java.util.Arrays.asList(
|
||||
new ContentPart("text", ordemParaIA),
|
||||
new ContentPart("image_url", new ImageUrl("data:image/jpeg;base64," + base64))
|
||||
))
|
||||
));
|
||||
|
||||
AiApi api = AiConfig.getRetrofit().create(AiApi.class);
|
||||
api.analisarImagem("Bearer " + MINHA_API_KEY, request).enqueue(new Callback<AiResponse>() {
|
||||
AiConfig.getRetrofit().create(AiApi.class)
|
||||
.analisarImagem("Bearer " + MINHA_API_KEY, request)
|
||||
.enqueue(new Callback<AiResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<AiResponse> call, Response<AiResponse> response) {
|
||||
btnAnalisarIA.setEnabled(true);
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
try {
|
||||
String resultado = response.body().choices.get(0).message.content;
|
||||
tvResultadoIA.setText(resultado);
|
||||
} catch (Exception e) { tvResultadoIA.setText("Erro ao ler texto da IA."); }
|
||||
} else {
|
||||
try {
|
||||
String erroReal = response.errorBody() != null ? response.errorBody().string() : "Vazio";
|
||||
tvResultadoIA.setText("ERRO: " + response.code() + "\n" + erroReal);
|
||||
} catch (Exception e) { tvResultadoIA.setText("Erro desconhecido."); }
|
||||
String resposta = response.body().choices.get(0).message.content;
|
||||
textoAnalise = resposta.replace("**", "").replace("*", "");
|
||||
tvResultadoIA.setText(textoAnalise);
|
||||
btnIrParaChat.setVisibility(View.VISIBLE);
|
||||
} catch (Exception e) { tvResultadoIA.setText("Erro na resposta."); }
|
||||
} else { tvResultadoIA.setText("Erro: " + response.code()); }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<AiResponse> call, Throwable t) {
|
||||
btnAnalisarIA.setEnabled(true);
|
||||
tvResultadoIA.setText("Falha na ligação à Internet.");
|
||||
tvResultadoIA.setText("Sem internet.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class HomeActivity extends AppCompatActivity {
|
||||
|
||||
cardPerfil.setOnClickListener(v -> startActivity(new Intent(HomeActivity.this, PerfilActivity.class)));
|
||||
|
||||
|
||||
// 5. Verifica se já passou o tempo para pedir o novo peso
|
||||
verificarAtualizacaoSemanal();
|
||||
}
|
||||
|
||||
7
app/src/main/res/drawable/aero_glass_panel.xml
Normal file
7
app/src/main/res/drawable/aero_glass_panel.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="#CCFFFFFF" /> <stroke
|
||||
android:width="1.5dp"
|
||||
android:color="#80FFFFFF" /> </shape>
|
||||
4
app/src/main/res/drawable/bg_cyber_button.xml
Normal file
4
app/src/main/res/drawable/bg_cyber_button.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="8dp" />
|
||||
<solid android:color="#00E5FF" /> </shape>
|
||||
6
app/src/main/res/drawable/bg_cyber_panel.xml
Normal file
6
app/src/main/res/drawable/bg_cyber_panel.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="12dp" />
|
||||
<solid android:color="#18181B" /> <stroke
|
||||
android:width="1dp"
|
||||
android:color="#4D00E5FF" /> </shape>
|
||||
10
app/src/main/res/drawable/bg_frutiger.xml
Normal file
10
app/src/main/res/drawable/bg_frutiger.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="#80D0C7"
|
||||
android:centerColor="#A4E5E0"
|
||||
android:endColor="#E2F6FA"
|
||||
android:angle="135"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
10
app/src/main/res/drawable/bg_frutiger_aero.xml
Normal file
10
app/src/main/res/drawable/bg_frutiger_aero.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="#B2F7EF"
|
||||
android:centerColor="#76EAD7"
|
||||
android:endColor="#3F72AF"
|
||||
android:angle="135"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
27
app/src/main/res/drawable/jelly_button_blue.xml
Normal file
27
app/src/main/res/drawable/jelly_button_blue.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<solid android:color="#007791" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:bottom="2dp" android:left="1dp" android:right="1dp" android:top="1dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#00B4D8"
|
||||
android:startColor="#90E0EF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:bottom="30dp" android:left="10dp" android:right="10dp" android:top="3dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#00FFFFFF"
|
||||
android:startColor="#CCFFFFFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
27
app/src/main/res/drawable/jelly_button_green.xml
Normal file
27
app/src/main/res/drawable/jelly_button_green.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<solid android:color="#1A531A" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:bottom="2dp" android:left="1dp" android:right="1dp" android:top="1dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#2DCC70"
|
||||
android:startColor="#A0ECC0" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:bottom="30dp" android:left="10dp" android:right="10dp" android:top="3dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#00FFFFFF"
|
||||
android:startColor="#CCFFFFFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
27
app/src/main/res/drawable/jelly_button_grey.xml
Normal file
27
app/src/main/res/drawable/jelly_button_grey.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<solid android:color="#A0A0A0" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:bottom="2dp" android:left="1dp" android:right="1dp" android:top="1dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#E0E0E0"
|
||||
android:startColor="#FFFFFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:bottom="25dp" android:left="10dp" android:right="10dp" android:top="3dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#00FFFFFF"
|
||||
android:startColor="#B3FFFFFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,148 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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="match_parent"
|
||||
android:background="#F8FAFC"> <androidx.cardview.widget.CardView
|
||||
android:background="#FFFFFF">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/headerChat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardElevation="8dp"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardBackgroundColor="#FFFFFF">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="16dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
app:cardCornerRadius="22.5dp"
|
||||
app:cardBackgroundColor="#E0F2FE"
|
||||
app:cardElevation="0dp"
|
||||
android:layout_marginEnd="12dp">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="🤖"
|
||||
android:textSize="26sp"
|
||||
android:gravity="center"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#FFFFFF"
|
||||
android:paddingVertical="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnVoltarChat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NutriChat AI"
|
||||
android:text="Voltar"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#8E8E93"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingHorizontal="20dp"
|
||||
android:paddingVertical="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTituloChat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NutriChat IA"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#0F172A"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="2dp">
|
||||
|
||||
<View
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="8dp"
|
||||
android:background="@drawable/ic_online_dot"
|
||||
android:layout_marginEnd="6dp"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Sempre online"
|
||||
android:textSize="13sp"
|
||||
android:textColor="#64748B"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
android:textColor="#1C1C1E"
|
||||
android:layout_centerInParent="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/chatScrollView"
|
||||
android:id="@+id/scrollChat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/inputArea"
|
||||
android:layout_above="@+id/caixaInput"
|
||||
android:layout_below="@id/headerChat"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:clipToPadding="false">
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/chatLayout"
|
||||
<TextView
|
||||
android:id="@+id/tvChatLog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
android:textSize="16sp"
|
||||
android:textColor="#3A3A3C"
|
||||
android:lineSpacingExtra="8dp"
|
||||
android:text="Olá! Como posso ajudar?"/>
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/inputArea"
|
||||
android:id="@+id/caixaInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:paddingVertical="12dp"
|
||||
android:background="#00000000"
|
||||
android:padding="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardBackgroundColor="#FFFFFF"
|
||||
android:layout_marginEnd="8dp">
|
||||
android:background="#F2F2F7">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etMensagem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:maxLines="4"
|
||||
android:inputType="textMultiLine"
|
||||
android:layout_weight="1"
|
||||
android:hint="Escreve aqui..."
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="Escreve a tua mensagem..."
|
||||
android:textColorHint="#94A3B8"
|
||||
android:textColor="#1E293B"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:textSize="16sp" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="4dp"
|
||||
app:cardBackgroundColor="#0284C7">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btnEnviar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@android:drawable/ic_menu_send"
|
||||
android:paddingStart="4dp"
|
||||
app:tint="#FFFFFF" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
android:padding="12dp"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnEnviarChat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Enviar"
|
||||
android:backgroundTint="#1C1C1E"
|
||||
android:textColor="#FFFFFF"/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -4,153 +4,184 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#F1F5F9">
|
||||
android:background="#FFFFFF"
|
||||
android:padding="24dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardElevation="4dp"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardBackgroundColor="#03A9F4">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginBottom="32dp">
|
||||
<TextView
|
||||
android:id="@+id/btnVoltarDesafios"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp"
|
||||
android:gravity="center">
|
||||
|
||||
android:text="Voltar"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#8E8E93"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:padding="8dp" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Os Teus Pontos"
|
||||
android:textColor="#E0F2FE"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPontos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="48sp"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
android:text="Missões Diárias"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#1C1C1E"
|
||||
android:layout_centerInParent="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="16dp">
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F0F9FF"> <LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Desafios Diários"
|
||||
android:textSize="20sp"
|
||||
android:text="💧 Hidratação"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#1E293B"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
android:textColor="#0284C7"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="+10 pts / copo"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#0284C7"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Beber 250ml de água"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#0369A1"
|
||||
android:layout_marginTop="4dp"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressAgua"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:progress="3"
|
||||
android:max="8"
|
||||
android:progressTint="#0EA5E9"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatusAgua"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3 de 8 copos (750ml / 2L)"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#0369A1"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="8dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGravarAgua"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:text="Gravar Golo"
|
||||
android:backgroundTint="#0284C7"
|
||||
android:textColor="#FFFFFF"
|
||||
app:cornerRadius="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:elevation="0dp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Outros Desafios"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#8E8E93"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginStart="4dp"/>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardElevation="2dp">
|
||||
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Desafio: 20 Flexões"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#0F172A"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatusDesafio1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Pendente"
|
||||
android:textColor="#64748B"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginTop="4dp"/>
|
||||
|
||||
android:padding="20dp">
|
||||
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="🦵 Agachamentos (15x)" android:textSize="16sp" android:textStyle="bold" android:textColor="#1C1C1E"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+50 pts" android:textSize="12sp" android:textColor="#8E8E93" android:layout_alignParentEnd="true"/>
|
||||
</RelativeLayout>
|
||||
<Button
|
||||
android:id="@+id/btnVideoDesafio1"
|
||||
android:id="@+id/btnGravarEx1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Gravar Vídeo Prova"
|
||||
android:layout_marginTop="12dp"
|
||||
android:backgroundTint="#03A9F4"
|
||||
app:cornerRadius="8dp"/>
|
||||
android:layout_height="54dp"
|
||||
android:text="Gravar Exercício"
|
||||
android:backgroundTint="#1C1C1E"
|
||||
android:textColor="#FFFFFF"
|
||||
app:cornerRadius="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:elevation="0dp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardElevation="2dp">
|
||||
|
||||
android:layout_marginBottom="32dp"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Desafio: 30 Agachamentos"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#0F172A"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatusDesafio2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Pendente"
|
||||
android:textColor="#64748B"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginTop="4dp"/>
|
||||
|
||||
android:padding="20dp">
|
||||
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="💪 Flexões (10x)" android:textSize="16sp" android:textStyle="bold" android:textColor="#1C1C1E"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+60 pts" android:textSize="12sp" android:textColor="#8E8E93" android:layout_alignParentEnd="true"/>
|
||||
</RelativeLayout>
|
||||
<Button
|
||||
android:id="@+id/btnVideoDesafio2"
|
||||
android:id="@+id/btnGravarEx2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Gravar Vídeo Prova"
|
||||
android:layout_marginTop="12dp"
|
||||
android:backgroundTint="#03A9F4"
|
||||
app:cornerRadius="8dp"/>
|
||||
android:layout_height="54dp"
|
||||
android:text="Gravar Exercício"
|
||||
android:backgroundTint="#1C1C1E"
|
||||
android:textColor="#FFFFFF"
|
||||
app:cornerRadius="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:elevation="0dp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltarDesafios"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:layout_margin="16dp"
|
||||
android:text="Voltar ao Início"
|
||||
android:backgroundTint="#94A3B8"
|
||||
app:cornerRadius="12dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -4,74 +4,87 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#F8FAFC">
|
||||
android:background="#FFFFFF"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<TextView
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Avaliação Física"
|
||||
android:textSize="24sp"
|
||||
android:layout_marginBottom="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnVoltarStats"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Voltar"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#8E8E93"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingEnd="16dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Visão Geral"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#1E293B"
|
||||
android:padding="20dp"
|
||||
android:background="#FFFFFF"
|
||||
android:elevation="4dp"/>
|
||||
android:textColor="#1C1C1E"
|
||||
android:layout_centerInParent="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="40dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F8FAFC">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="16dp" android:gravity="center_vertical">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="✨" android:textSize="24sp" android:layout_marginEnd="12dp"/>
|
||||
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Insight da IA" android:textSize="12sp" android:textStyle="bold" android:textColor="#0284C7"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Estás com um défice de fibras hoje. Tenta adicionar uma maçã ao lanche!" android:textSize="14sp" android:textColor="#334155" android:layout_marginTop="2dp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#1C1C1E">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="24dp"
|
||||
android:background="#E0F2FE">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="O Teu IMC"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#0284C7"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvImcEst"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="00.0"
|
||||
android:textSize="48sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#0369A1"
|
||||
android:layout_marginVertical="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvImcStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="A calcular..."
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#FFFFFF"
|
||||
android:background="#0284C7"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="6dp"/>
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Índice Nutri AI" android:textSize="14sp" android:textColor="#A1A1AA"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Excelente" android:textSize="22sp" android:textStyle="bold" android:textColor="#10B981" android:layout_marginTop="2dp"/> </LinearLayout>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="85" android:textSize="48sp" android:textStyle="bold" android:textColor="#FFFFFF"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="/100" android:textSize="16sp" android:textColor="#A1A1AA" android:layout_marginStart="4dp" android:layout_marginBottom="8dp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@@ -79,21 +92,21 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp">
|
||||
android:layout_marginBottom="16dp"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:cardCornerRadius="12dp"
|
||||
android:layout_marginEnd="8dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:gravity="center">
|
||||
<TextView android:id="@+id/tvPesoEst" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-- kg" android:textSize="22sp" android:textStyle="bold" android:textColor="#0F172A"/>
|
||||
android:layout_marginEnd="8dp"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp" android:gravity="center">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="⏱️" android:textSize="20sp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="14h 20m" android:textSize="18sp" android:textStyle="bold" android:textColor="#1C1C1E" android:layout_marginTop="4dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Em Jejum" android:textSize="12sp" android:textColor="#8E8E93"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@@ -101,15 +114,14 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:cardCornerRadius="12dp"
|
||||
android:layout_marginStart="8dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:gravity="center">
|
||||
<TextView android:id="@+id/tvAlturaEst" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-- m" android:textSize="22sp" android:textStyle="bold" android:textColor="#0F172A"/>
|
||||
android:layout_marginStart="8dp"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp" android:gravity="center">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="👟" android:textSize="20sp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="6,432" android:textSize="18sp" android:textStyle="bold" android:textColor="#1C1C1E" android:layout_marginTop="4dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Passos" android:textSize="12sp" android:textColor="#8E8E93"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
@@ -117,29 +129,112 @@
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="16dp"
|
||||
android:layout_marginBottom="24dp">
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
android:padding="20dp">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Calorias esta Semana" android:textSize="16sp" android:textStyle="bold" android:textColor="#1C1C1E" android:layout_marginBottom="24dp"/>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="120dp" android:orientation="horizontal" android:weightSum="7" android:baselineAligned="false">
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" android:gravity="bottom|center_horizontal"><androidx.cardview.widget.CardView android:layout_width="16dp" android:layout_height="100dp" app:cardBackgroundColor="#D1D1D6" app:cardCornerRadius="8dp" android:layout_marginBottom="8dp"/><TextView android:text="S" android:textSize="12sp" android:textStyle="bold" android:textColor="#8E8E93"/></LinearLayout>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" android:gravity="bottom|center_horizontal"><androidx.cardview.widget.CardView android:layout_width="16dp" android:layout_height="70dp" app:cardBackgroundColor="#D1D1D6" app:cardCornerRadius="8dp" android:layout_marginBottom="8dp"/><TextView android:text="T" android:textSize="12sp" android:textStyle="bold" android:textColor="#8E8E93"/></LinearLayout>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" android:gravity="bottom|center_horizontal"><androidx.cardview.widget.CardView android:layout_width="16dp" android:layout_height="85dp" app:cardBackgroundColor="#1C1C1E" app:cardCornerRadius="8dp" android:layout_marginBottom="8dp"/><TextView android:text="Q" android:textSize="12sp" android:textStyle="bold" android:textColor="#1C1C1E"/></LinearLayout>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" android:gravity="bottom|center_horizontal"><androidx.cardview.widget.CardView android:layout_width="16dp" android:layout_height="50dp" app:cardBackgroundColor="#D1D1D6" app:cardCornerRadius="8dp" android:layout_marginBottom="8dp"/><TextView android:text="Q" android:textSize="12sp" android:textStyle="bold" android:textColor="#8E8E93"/></LinearLayout>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" android:gravity="bottom|center_horizontal"><androidx.cardview.widget.CardView android:layout_width="16dp" android:layout_height="90dp" app:cardBackgroundColor="#D1D1D6" app:cardCornerRadius="8dp" android:layout_marginBottom="8dp"/><TextView android:text="S" android:textSize="12sp" android:textStyle="bold" android:textColor="#8E8E93"/></LinearLayout>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" android:gravity="bottom|center_horizontal"><androidx.cardview.widget.CardView android:layout_width="16dp" android:layout_height="110dp" app:cardBackgroundColor="#D1D1D6" app:cardCornerRadius="8dp" android:layout_marginBottom="8dp"/><TextView android:text="S" android:textSize="12sp" android:textStyle="bold" android:textColor="#8E8E93"/></LinearLayout>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" android:gravity="bottom|center_horizontal"><androidx.cardview.widget.CardView android:layout_width="16dp" android:layout_height="0dp" app:cardBackgroundColor="#D1D1D6" app:cardCornerRadius="8dp" android:layout_marginBottom="8dp"/><TextView android:text="D" android:textSize="12sp" android:textStyle="bold" android:textColor="#8E8E93"/></LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#E0F2FE">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp" android:gravity="center">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="💧 1.5 L" android:textSize="18sp" android:textStyle="bold" android:textColor="#0284C7"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hidratação" android:textSize="12sp" android:textColor="#38BDF8"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="8dp"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#FEF2F2"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp" android:gravity="center">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="📉 -1.2 Kg" android:textSize="18sp" android:textStyle="bold" android:textColor="#EF4444"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Este mês" android:textSize="12sp" android:textColor="#F87171"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="20dp">
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Macronutrientes" android:textStyle="bold" android:textColor="#1C1C1E" android:textSize="16sp" android:layout_marginBottom="12dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Proteína: 60g" android:textSize="13sp" android:textColor="#3A3A3C"/>
|
||||
<ProgressBar style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="6dp" android:progress="50" android:progressTint="#1C1C1E" android:layout_marginBottom="12dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hidratos: 110g" android:textSize="13sp" android:textColor="#3A3A3C"/>
|
||||
<ProgressBar style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="6dp" android:progress="70" android:progressTint="#1C1C1E" android:layout_marginBottom="12dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Gordura: 35g" android:textSize="13sp" android:textColor="#3A3A3C"/>
|
||||
<ProgressBar style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="6dp" android:progress="40" android:progressTint="#1C1C1E" android:layout_marginBottom="24dp"/>
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Alertas de Micronutrientes" android:textStyle="bold" android:textColor="#1C1C1E" android:textSize="16sp" android:layout_marginBottom="12dp"/>
|
||||
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightSum="3">
|
||||
<LinearLayout android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:orientation="vertical">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Açúcar" android:textSize="12sp" android:textColor="#8E8E93"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Alto ⚠️" android:textSize="14sp" android:textStyle="bold" android:textColor="#F59E0B"/> </LinearLayout>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:orientation="vertical">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Fibras" android:textSize="12sp" android:textColor="#8E8E93"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Baixo 📉" android:textSize="14sp" android:textStyle="bold" android:textColor="#EF4444"/> </LinearLayout>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:orientation="vertical">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sódio" android:textSize="12sp" android:textColor="#8E8E93"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Normal ✅" android:textSize="14sp" android:textStyle="bold" android:textColor="#10B981"/> </LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="20dp">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Top Refeições Scaneadas" android:textSize="16sp" android:textStyle="bold" android:textColor="#1C1C1E" android:layout_marginBottom="16dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1. Bife de Frango (5x)" android:textColor="#3A3A3C" android:textSize="15sp" android:layout_marginBottom="12dp"/>
|
||||
<View android:layout_width="match_parent" android:layout_height="1dp" android:background="#E5E5EA" android:layout_marginBottom="12dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2. Arroz de Pato (3x)" android:textColor="#3A3A3C" android:textSize="15sp" android:layout_marginBottom="12dp"/>
|
||||
<View android:layout_width="match_parent" android:layout_height="1dp" android:background="#E5E5EA" android:layout_marginBottom="12dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="3. Francesinha (1x)" android:textColor="#3A3A3C" android:textSize="15sp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltarHome"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_margin="16dp"
|
||||
android:text="Voltar ao Início"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:backgroundTint="#94A3B8"
|
||||
android:textColor="#FFFFFF"
|
||||
app:cornerRadius="12dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -4,44 +4,50 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#F8FAFC">
|
||||
android:background="#FFFFFF"
|
||||
android:padding="24dp">
|
||||
|
||||
<!-- Cabeçalho -->
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp"
|
||||
android:background="#FFFFFF"
|
||||
android:elevation="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
android:layout_marginBottom="24dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/btnVoltarFoto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Escanear Comida 📸"
|
||||
android:textSize="22sp"
|
||||
android:text="Voltar"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#8E8E93"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:padding="8dp" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Scanner IA"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#0F172A"/>
|
||||
</LinearLayout>
|
||||
android:textColor="#1C1C1E"
|
||||
android:layout_centerInParent="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="24dp">
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Caixa onde vai aparecer a foto -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
android:layout_height="320dp"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7"
|
||||
android:layout_marginBottom="24dp">
|
||||
|
||||
<ImageView
|
||||
@@ -49,58 +55,66 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@android:drawable/ic_menu_camera"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="#E2E8F0"
|
||||
android:padding="60dp" />
|
||||
android:scaleType="centerCrop" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- Botão para abrir a câmara do telemóvel -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp">
|
||||
<Button
|
||||
android:id="@+id/btnTirarFoto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="60dp"
|
||||
android:text="Abrir Câmara"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:backgroundTint="#0284C7"
|
||||
app:cornerRadius="15dp"
|
||||
android:layout_marginBottom="12dp"/>
|
||||
android:text="Câmara"
|
||||
android:backgroundTint="#1C1C1E"
|
||||
android:textColor="#FFFFFF"
|
||||
app:cornerRadius="16dp"
|
||||
android:layout_marginEnd="8dp"/>
|
||||
<Button
|
||||
android:id="@+id/btnGaleria"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="60dp"
|
||||
android:text="Galeria"
|
||||
android:backgroundTint="#F2F2F7"
|
||||
android:textColor="#1C1C1E"
|
||||
app:cornerRadius="16dp"
|
||||
android:layout_marginStart="8dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Botão para analisar (só aparece depois de tirar a foto) -->
|
||||
<Button
|
||||
android:id="@+id/btnAnalisarIA"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:text="Analisar com IA ✨"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:backgroundTint="#10B981"
|
||||
app:cornerRadius="15dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:visibility="gone"/>
|
||||
android:text="Analisar"
|
||||
android:backgroundTint="#1C1C1E"
|
||||
android:textColor="#FFFFFF"
|
||||
app:cornerRadius="16dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<!-- Caixa onde vai aparecer o resultado da IA -->
|
||||
<TextView
|
||||
android:id="@+id/tvResultadoIA"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Tira uma foto ao teu prato para a Inteligência Artificial calcular as calorias e os macronutrientes!"
|
||||
android:text="Escolhe uma foto para analisar."
|
||||
android:textSize="16sp"
|
||||
android:textColor="#64748B"
|
||||
android:textColor="#3A3A3C"
|
||||
android:textAlignment="center"
|
||||
android:background="@android:color/transparent"
|
||||
android:padding="16dp"/>
|
||||
android:layout_marginBottom="24dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltarFoto"
|
||||
android:id="@+id/btnIrParaChat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:text="Voltar"
|
||||
android:textColor="#0F172A"
|
||||
android:backgroundTint="#E2E8F0"
|
||||
app:cornerRadius="12dp"
|
||||
android:layout_marginTop="24dp"/>
|
||||
|
||||
android:layout_height="60dp"
|
||||
android:text="Dúvidas no Chat →"
|
||||
android:backgroundTint="#F2F2F7"
|
||||
android:textColor="#1C1C1E"
|
||||
app:cornerRadius="16dp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
@@ -3,95 +3,85 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F8FAFC"
|
||||
android:fillViewport="true">
|
||||
android:background="#FFFFFF"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingTop="40dp"
|
||||
android:paddingBottom="40dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="A tua jornada começa aqui,"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#64748B"
|
||||
android:layout_marginTop="8dp"/>
|
||||
android:textSize="16sp"
|
||||
android:textColor="#8E8E93"
|
||||
android:layout_marginBottom="4dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSaudacaoHome"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Carregando..."
|
||||
android:textSize="28sp"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#0F172A"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
android:textColor="#1C1C1E"
|
||||
android:layout_marginBottom="40dp"/>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardTirarFoto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="6dp"
|
||||
app:cardBackgroundColor="#0F172A"
|
||||
app:contentPadding="20dp">
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#1C1C1E">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="24dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardBackgroundColor="#38BDF8"
|
||||
app:cardElevation="0dp">
|
||||
<ImageView
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:src="@android:drawable/ic_menu_camera"
|
||||
app:tint="#FFFFFF"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="16dp">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Escanear Comida"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#FFFFFF"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="A IA analisa a tua refeição"
|
||||
android:textSize="13sp"
|
||||
android:textColor="#94A3B8"
|
||||
android:layout_marginTop="2dp"/>
|
||||
</LinearLayout>
|
||||
android:layout_marginStart="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="›"
|
||||
android:textSize="32sp"
|
||||
android:textColor="#38BDF8"
|
||||
android:layout_marginStart="8dp"/>
|
||||
android:text="Escanear Comida"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#FFFFFF"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="A IA analisa a tua refeição"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#A1A1AA"
|
||||
android:layout_marginTop="4dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@@ -103,41 +93,35 @@
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
app:contentPadding="16dp">
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardBackgroundColor="#10B981"
|
||||
app:cardElevation="0dp">
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@android:drawable/stat_notify_chat"
|
||||
app:tint="#FFFFFF"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
app:tint="#1C1C1E"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="16dp">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="NutriChat AI" android:textSize="16sp" android:textStyle="bold" android:textColor="#0F172A"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Fala com o teu assistente" android:textSize="12sp" android:textColor="#64748B" android:layout_marginTop="2dp"/>
|
||||
android:layout_marginStart="20dp">
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="NutriChat AI" android:textSize="17sp" android:textStyle="bold" android:textColor="#1C1C1E"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Fala com o teu assistente" android:textSize="13sp" android:textColor="#8E8E93" android:layout_marginTop="2dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="›" android:textSize="28sp" android:textColor="#CBD5E1" android:layout_marginStart="8dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="›" android:textSize="28sp" android:textColor="#C7C7CC" android:layout_marginStart="8dp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@@ -149,41 +133,35 @@
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
app:contentPadding="16dp">
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardBackgroundColor="#0284C7"
|
||||
app:cardElevation="0dp">
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@android:drawable/ic_menu_sort_by_size"
|
||||
app:tint="#FFFFFF"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
app:tint="#1C1C1E"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="16dp">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Estatísticas" android:textSize="16sp" android:textStyle="bold" android:textColor="#0F172A"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Vê os teus números e progresso" android:textSize="12sp" android:textColor="#64748B" android:layout_marginTop="2dp"/>
|
||||
android:layout_marginStart="20dp">
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Estatísticas" android:textSize="17sp" android:textStyle="bold" android:textColor="#1C1C1E"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Vê os teus números e progresso" android:textSize="13sp" android:textColor="#8E8E93" android:layout_marginTop="2dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="›" android:textSize="28sp" android:textColor="#CBD5E1" android:layout_marginStart="8dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="›" android:textSize="28sp" android:textColor="#C7C7CC" android:layout_marginStart="8dp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@@ -195,41 +173,35 @@
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
app:contentPadding="16dp">
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardBackgroundColor="#F59E0B"
|
||||
app:cardElevation="0dp">
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@android:drawable/star_on"
|
||||
app:tint="#FFFFFF"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
app:tint="#1C1C1E"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="16dp">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Desafios Diários" android:textSize="16sp" android:textStyle="bold" android:textColor="#0F172A"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Ganha pontos de recompensa" android:textSize="12sp" android:textColor="#64748B" android:layout_marginTop="2dp"/>
|
||||
android:layout_marginStart="20dp">
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Desafios Diários" android:textSize="17sp" android:textStyle="bold" android:textColor="#1C1C1E"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Ganha pontos de recompensa" android:textSize="13sp" android:textColor="#8E8E93" android:layout_marginTop="2dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="›" android:textSize="28sp" android:textColor="#CBD5E1" android:layout_marginStart="8dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="›" android:textSize="28sp" android:textColor="#C7C7CC" android:layout_marginStart="8dp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@@ -241,41 +213,35 @@
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
app:contentPadding="16dp">
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardBackgroundColor="#8B5CF6"
|
||||
app:cardElevation="0dp">
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@android:drawable/ic_menu_myplaces"
|
||||
app:tint="#FFFFFF"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
app:tint="#1C1C1E"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="16dp">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="O Meu Perfil" android:textSize="16sp" android:textStyle="bold" android:textColor="#0F172A"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Dados, pontuação e definições" android:textSize="12sp" android:textColor="#64748B" android:layout_marginTop="2dp"/>
|
||||
android:layout_marginStart="20dp">
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="O Meu Perfil" android:textSize="17sp" android:textStyle="bold" android:textColor="#1C1C1E"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Dados, pontuação e definições" android:textSize="13sp" android:textColor="#8E8E93" android:layout_marginTop="2dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="›" android:textSize="28sp" android:textColor="#CBD5E1" android:layout_marginStart="8dp"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="›" android:textSize="28sp" android:textColor="#C7C7CC" android:layout_marginStart="8dp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?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="horizontal"
|
||||
android:padding="12dp"
|
||||
android:background="#FFFFFF"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:elevation="2dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvNomeIngrediente"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Peito de Frango"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#2E3D32"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCaloriasIngrediente"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="150 kcal"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#4CAF50"
|
||||
android:layout_marginEnd="16dp"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btnRemoverIngrediente"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@android:drawable/ic_menu_delete"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
app:tint="#F44336"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"/>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user