corrigir os novos erros amnhã e adicionar qual tipo de sexo a pessoa é no register
This commit is contained in:
@@ -14,42 +14,26 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.PAP">
|
||||
<activity
|
||||
android:name=".EditarPerfilActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".DefinicoesActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".PerfilActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".DesafiosActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".FotoActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".EstatisticasActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ChatActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".HomeActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".RegisterActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<activity android:name=".EditarPerfilActivity" android:exported="false" />
|
||||
<activity android:name=".DefinicoesActivity" android:exported="false" />
|
||||
<activity android:name=".PerfilActivity" android:exported="false" />
|
||||
<activity android:name=".DesafiosActivity" android:exported="false" />
|
||||
<activity android:name=".FotoActivity" android:exported="false" />
|
||||
<activity android:name=".EstatisticasActivity" android:exported="false" />
|
||||
<activity android:name=".ChatActivity" android:exported="false" />
|
||||
<activity android:name=".HomeActivity" android:exported="false" />
|
||||
<activity android:name=".RegisterActivity" android:exported="false" />
|
||||
<activity android:name=".MainActivity" android:exported="false" />
|
||||
|
||||
<!-- AQUI ESTÁ A ACTIVITY QUE FALTAVA! -->
|
||||
<activity android:name=".VerificacaoActivity" android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
@@ -1,23 +1,43 @@
|
||||
package com.example.pap;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Base64;
|
||||
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;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Collections;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class DesafiosActivity extends AppCompatActivity {
|
||||
|
||||
private ProgressBar progressAgua;
|
||||
private TextView tvStatusAgua;
|
||||
private int coposBebidos = 3; // Simulação de progresso atual
|
||||
private Button btnGravarAgua, btnGravarEx1, btnGravarEx2;
|
||||
private int coposBebidos = 0;
|
||||
private final int META_COPOS = 8;
|
||||
|
||||
// Variável para sabermos qual botão o utilizador clicou
|
||||
private String desafioAtual = "";
|
||||
|
||||
// COLA A TUA CHAVE AQUI
|
||||
private final String MINHA_API_KEY = "sk-or-v1-e65c704789ff164d6ed1be48881dcfa83d9e7f359650f16cf7680dd822e5592bA";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -25,57 +45,176 @@ public class DesafiosActivity extends AppCompatActivity {
|
||||
|
||||
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);
|
||||
btnGravarAgua = findViewById(R.id.btnGravarAgua);
|
||||
btnGravarEx1 = findViewById(R.id.btnGravarEx1);
|
||||
btnGravarEx2 = findViewById(R.id.btnGravarEx2);
|
||||
|
||||
// Launcher para capturar VÍDEO
|
||||
// Carregar a água que já bebeu hoje
|
||||
SharedPreferences prefs = getSharedPreferences("DadosGamificacao", MODE_PRIVATE);
|
||||
coposBebidos = prefs.getInt("agua_hoje", 0);
|
||||
atualizarProgressoAgua();
|
||||
|
||||
// Launcher que recebe o vídeo da câmara
|
||||
ActivityResultLauncher<Intent> videoLauncher = registerForActivityResult(
|
||||
new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
if (result.getResultCode() == RESULT_OK) {
|
||||
// AQUI É ONDE A IA ENTRARIA PARA ANALISAR O VÍDEO
|
||||
validarDesafioIA();
|
||||
if (result.getResultCode() == RESULT_OK && result.getData() != null) {
|
||||
Uri videoUri = result.getData().getData();
|
||||
extrairFrameEEnviarIA(videoUri);
|
||||
} else {
|
||||
Toast.makeText(this, "Vídeo cancelado.", Toast.LENGTH_SHORT).show();
|
||||
desbloquearBotoes();
|
||||
}
|
||||
});
|
||||
|
||||
// Configurar botões para abrir a câmara em modo VÍDEO
|
||||
// Configurar Botões (Avisamos qual é o desafio antes de abrir a câmara)
|
||||
btnGravarAgua.setOnClickListener(v -> {
|
||||
desafioAtual = "agua";
|
||||
bloquearBotoes();
|
||||
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10); // Limita a 10 segundos para ser rápido
|
||||
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 5); // 5 Segundos chega para beber água
|
||||
videoLauncher.launch(intent);
|
||||
});
|
||||
|
||||
btnEx1.setOnClickListener(v -> {
|
||||
btnGravarEx1.setOnClickListener(v -> {
|
||||
desafioAtual = "agachamento";
|
||||
bloquearBotoes();
|
||||
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10);
|
||||
videoLauncher.launch(intent);
|
||||
});
|
||||
|
||||
btnEx2.setOnClickListener(v -> {
|
||||
btnGravarEx2.setOnClickListener(v -> {
|
||||
desafioAtual = "flexoes";
|
||||
bloquearBotoes();
|
||||
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10);
|
||||
videoLauncher.launch(intent);
|
||||
});
|
||||
|
||||
findViewById(R.id.btnVoltarDesafios).setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
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();
|
||||
private void extrairFrameEEnviarIA(Uri videoUri) {
|
||||
Toast.makeText(this, "A extrair frame do vídeo...", Toast.LENGTH_SHORT).show();
|
||||
|
||||
progressAgua.postDelayed(() -> {
|
||||
try {
|
||||
// Isto vai ao vídeo e tira uma "foto" a meio do tempo
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
retriever.setDataSource(this, videoUri);
|
||||
|
||||
// Pega num frame do segundo 2 (2000000 microsegundos)
|
||||
Bitmap frame = retriever.getFrameAtTime(2000000, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
|
||||
|
||||
if (frame != null) {
|
||||
enviarParaIA(frame);
|
||||
} else {
|
||||
Toast.makeText(this, "Erro ao ler vídeo.", Toast.LENGTH_SHORT).show();
|
||||
desbloquearBotoes();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, "Erro técnico no vídeo.", Toast.LENGTH_SHORT).show();
|
||||
desbloquearBotoes();
|
||||
}
|
||||
}
|
||||
|
||||
private void enviarParaIA(Bitmap bitmap) {
|
||||
Toast.makeText(this, "IA a avaliar o teu desafio... ⏳", Toast.LENGTH_LONG).show();
|
||||
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, os);
|
||||
String base64 = Base64.encodeToString(os.toByteArray(), Base64.NO_WRAP);
|
||||
String dataUrl = "data:image/jpeg;base64," + base64;
|
||||
|
||||
// O SEGREDO ESTÁ AQUI: Perguntas diferentes para desafios diferentes
|
||||
String ordem = "";
|
||||
int pontosGanhos = 0;
|
||||
|
||||
if (desafioAtual.equals("agua")) {
|
||||
ordem = "Verifica se há uma pessoa a beber água ou com um copo/garrafa na mão. Responde APENAS 'SIM' se houver, ou 'NAO' se não houver. Não digas mais nada.";
|
||||
pontosGanhos = 10;
|
||||
} else if (desafioAtual.equals("agachamento")) {
|
||||
ordem = "Verifica se há uma pessoa a fazer desporto ou na posição de agachamento. Responde APENAS 'SIM' ou 'NAO'.";
|
||||
pontosGanhos = 50;
|
||||
} else if (desafioAtual.equals("flexoes")) {
|
||||
ordem = "Verifica se há uma pessoa no chão a fazer flexões ou desporto. Responde APENAS 'SIM' ou 'NAO'.";
|
||||
pontosGanhos = 60;
|
||||
}
|
||||
|
||||
AiRequest request = new AiRequest(Collections.singletonList(
|
||||
new Message("user", java.util.Arrays.asList(
|
||||
new ContentPart("text", ordem),
|
||||
new ContentPart("image_url", new ImageUrl(dataUrl))
|
||||
))
|
||||
));
|
||||
|
||||
// Guarda as variáveis para usar dentro da resposta
|
||||
final int pontosDar = pontosGanhos;
|
||||
|
||||
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) {
|
||||
desbloquearBotoes();
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
String respostaIA = response.body().choices.get(0).message.content.trim().toUpperCase();
|
||||
|
||||
if (respostaIA.contains("SIM")) {
|
||||
sucessoDesafio(pontosDar);
|
||||
} else {
|
||||
Toast.makeText(DesafiosActivity.this, "A IA diz que NÃO estás a fazer o desafio! ❌", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(DesafiosActivity.this, "Erro no servidor da IA.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<AiResponse> call, Throwable t) {
|
||||
desbloquearBotoes();
|
||||
Toast.makeText(DesafiosActivity.this, "Falha na Internet.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sucessoDesafio(int pontos) {
|
||||
Toast.makeText(this, "✅ IA Aprovou! Ganhaste " + pontos + " pontos!", Toast.LENGTH_LONG).show();
|
||||
|
||||
SharedPreferences prefs = getSharedPreferences("DadosGamificacao", MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
|
||||
// Dá os pontos e sobe o contador de desafios
|
||||
int pontosAtuais = prefs.getInt("pontos", 0);
|
||||
int desafiosAtuais = prefs.getInt("desafios", 0);
|
||||
editor.putInt("pontos", pontosAtuais + pontos);
|
||||
editor.putInt("desafios", desafiosAtuais + 1);
|
||||
|
||||
// Se foi o desafio da água, sobe a barra de progresso
|
||||
if (desafioAtual.equals("agua")) {
|
||||
coposBebidos++;
|
||||
if (coposBebidos > META_COPOS) coposBebidos = META_COPOS;
|
||||
|
||||
editor.putInt("agua_hoje", coposBebidos);
|
||||
atualizarProgressoAgua();
|
||||
Toast.makeText(this, "Desafio Validado! +10 pontos", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
// Aqui depois vamos enviar os pontos para o Perfil
|
||||
}, 2000);
|
||||
editor.apply(); // Guarda tudo!
|
||||
}
|
||||
|
||||
private void atualizarProgressoAgua() {
|
||||
progressAgua.setProgress(coposBebidos);
|
||||
tvStatusAgua.setText(coposBebidos + " de " + META_COPOS + " copos (" + (coposBebidos * 250) + "ml / 2L)");
|
||||
}
|
||||
|
||||
private void bloquearBotoes() {
|
||||
btnGravarAgua.setEnabled(false);
|
||||
btnGravarEx1.setEnabled(false);
|
||||
btnGravarEx2.setEnabled(false);
|
||||
}
|
||||
|
||||
private void desbloquearBotoes() {
|
||||
btnGravarAgua.setEnabled(true);
|
||||
btnGravarEx1.setEnabled(true);
|
||||
btnGravarEx2.setEnabled(true);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,94 @@
|
||||
package com.example.pap;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class EstatisticasActivity extends AppCompatActivity {
|
||||
|
||||
private TextView tvValorIMC, tvStatusIMC;
|
||||
private TextView tvProtGramas, tvHidrGramas, tvGordGramas, tvComida1;
|
||||
private ProgressBar progressProt, progressHidr, progressGord;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_estatisticas);
|
||||
|
||||
// Funcionalidade do botão de voltar
|
||||
TextView btnVoltarStats = findViewById(R.id.btnVoltarStats);
|
||||
btnVoltarStats.setOnClickListener(v -> finish());
|
||||
// Ligar o layout (XML) às variáveis do Java
|
||||
tvValorIMC = findViewById(R.id.tvValorIMC);
|
||||
tvStatusIMC = findViewById(R.id.tvStatusIMC);
|
||||
|
||||
tvProtGramas = findViewById(R.id.tvProtGramas);
|
||||
tvHidrGramas = findViewById(R.id.tvHidrGramas);
|
||||
tvGordGramas = findViewById(R.id.tvGordGramas);
|
||||
tvComida1 = findViewById(R.id.tvComida1);
|
||||
|
||||
progressProt = findViewById(R.id.progressProt);
|
||||
progressHidr = findViewById(R.id.progressHidr);
|
||||
progressGord = findViewById(R.id.progressGord);
|
||||
|
||||
// Botão voltar
|
||||
findViewById(R.id.btnVoltarStats).setOnClickListener(v -> finish());
|
||||
|
||||
// Chamar as duas funções que preenchem os dados
|
||||
calcularIMC();
|
||||
carregarMacrosDaIA();
|
||||
}
|
||||
|
||||
private void calcularIMC() {
|
||||
SharedPreferences prefs = getSharedPreferences("MeusDadosApp", MODE_PRIVATE);
|
||||
float peso = prefs.getFloat("peso", 0);
|
||||
float altura = prefs.getFloat("altura", 0);
|
||||
|
||||
if (peso > 0 && altura > 0) {
|
||||
float imc = peso / (altura * altura);
|
||||
tvValorIMC.setText(String.format(Locale.getDefault(), "%.1f", imc));
|
||||
|
||||
if (imc < 18.5) {
|
||||
tvStatusIMC.setText("Abaixo do Peso");
|
||||
tvStatusIMC.setTextColor(Color.parseColor("#3B82F6"));
|
||||
} else if (imc < 25) {
|
||||
tvStatusIMC.setText("Peso Normal");
|
||||
tvStatusIMC.setTextColor(Color.parseColor("#10B981"));
|
||||
} else if (imc < 30) {
|
||||
tvStatusIMC.setText("Sobrepeso");
|
||||
tvStatusIMC.setTextColor(Color.parseColor("#F59E0B"));
|
||||
} else {
|
||||
tvStatusIMC.setText("Obesidade");
|
||||
tvStatusIMC.setTextColor(Color.parseColor("#EF4444"));
|
||||
}
|
||||
} else {
|
||||
tvValorIMC.setText("--");
|
||||
tvStatusIMC.setText("Faltam Dados");
|
||||
}
|
||||
}
|
||||
|
||||
private void carregarMacrosDaIA() {
|
||||
// Abre a memória onde a FotoActivity guardou os dados
|
||||
SharedPreferences prefs = getSharedPreferences("DadosSaude", MODE_PRIVATE);
|
||||
|
||||
int prot = prefs.getInt("prot_hoje", 0);
|
||||
int hidr = prefs.getInt("hidr_hoje", 0);
|
||||
int gord = prefs.getInt("gord_hoje", 0);
|
||||
String ultimaComida = prefs.getString("ultimo_prato", "Ainda não leste nada hoje.");
|
||||
|
||||
// Atualizar os Textos (ex: "Proteína: 25g")
|
||||
tvProtGramas.setText("Proteína: " + prot + "g");
|
||||
tvHidrGramas.setText("Hidratos: " + hidr + "g");
|
||||
tvGordGramas.setText("Gordura: " + gord + "g");
|
||||
|
||||
// Atualizar as Barras (Vai enchendo de 0 até ao limite máximo que definiste no XML)
|
||||
progressProt.setProgress(prot);
|
||||
progressHidr.setProgress(hidr);
|
||||
progressGord.setProgress(gord);
|
||||
|
||||
// Atualiza a Última Comida
|
||||
tvComida1.setText("1. " + ultimaComida);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.example.pap;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.ImageDecoder;
|
||||
import android.net.Uri;
|
||||
@@ -32,7 +33,7 @@ public class FotoActivity extends AppCompatActivity {
|
||||
private Bitmap imagemCapturada;
|
||||
private String textoAnalise = "";
|
||||
|
||||
// COLA A TUA CHAVE AQUI
|
||||
// MANTÉM A TUA CHAVE (cuidado para não partilhar no futuro)
|
||||
private final String MINHA_API_KEY = "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";
|
||||
|
||||
@Override
|
||||
@@ -142,6 +143,10 @@ public class FotoActivity extends AppCompatActivity {
|
||||
textoAnalise = resposta.replace("**", "").replace("*", "");
|
||||
tvResultadoIA.setText(textoAnalise);
|
||||
btnIrParaChat.setVisibility(View.VISIBLE);
|
||||
|
||||
// A MAGIA ACONTECE AQUI!
|
||||
extrairEGuardarDados(textoAnalise);
|
||||
|
||||
} catch (Exception e) { tvResultadoIA.setText("Erro na resposta."); }
|
||||
} else { tvResultadoIA.setText("Erro: " + response.code()); }
|
||||
}
|
||||
@@ -152,4 +157,51 @@ public class FotoActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Função que "lê" a resposta da IA e guarda os números
|
||||
private void extrairEGuardarDados(String texto) {
|
||||
try {
|
||||
// Apanhar o Nome do prato (tudo o que está a seguir a "Prato: " até à próxima linha)
|
||||
int indexNomeStart = texto.indexOf("Prato: ") + 7;
|
||||
int indexNomeEnd = texto.indexOf("\n", indexNomeStart);
|
||||
String nomePrato = texto.substring(indexNomeStart, indexNomeEnd).trim();
|
||||
|
||||
// Apanhar os números
|
||||
int calorias = extrairNumero(texto, "Calorias: ", " kcal");
|
||||
int proteina = extrairNumero(texto, "Macros: ", "g Proteína");
|
||||
int hidratos = extrairNumero(texto, "Proteína, ", "g Hidratos");
|
||||
int gordura = extrairNumero(texto, "Hidratos, ", "g Gordura");
|
||||
|
||||
// Abrir a memória
|
||||
SharedPreferences prefs = getSharedPreferences("DadosSaude", MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
|
||||
// Guardar nome do último prato
|
||||
editor.putString("ultimo_prato", nomePrato);
|
||||
|
||||
// Somar aos valores do dia
|
||||
editor.putInt("cal_hoje", prefs.getInt("cal_hoje", 0) + calorias);
|
||||
editor.putInt("prot_hoje", prefs.getInt("prot_hoje", 0) + proteina);
|
||||
editor.putInt("hidr_hoje", prefs.getInt("hidr_hoje", 0) + hidratos);
|
||||
editor.putInt("gord_hoje", prefs.getInt("gord_hoje", 0) + gordura);
|
||||
|
||||
editor.apply();
|
||||
} catch (Exception e) {
|
||||
// Ignora se a IA responder noutro formato para não crashar
|
||||
}
|
||||
}
|
||||
|
||||
// Ferramenta que corta a fatia certa de texto para tirar os números
|
||||
private int extrairNumero(String texto, String inicio, String fim) {
|
||||
try {
|
||||
int start = texto.indexOf(inicio) + inicio.length();
|
||||
int end = texto.indexOf(fim, start);
|
||||
String valorString = texto.substring(start, end).trim();
|
||||
// Limpa tudo o que não for número (caso a IA escreva mal)
|
||||
valorString = valorString.replaceAll("[^0-9]", "");
|
||||
return Integer.parseInt(valorString);
|
||||
} catch (Exception e) {
|
||||
return 0; // Se não encontrar, assume 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,6 @@ 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();
|
||||
}
|
||||
@@ -62,11 +61,12 @@ public class HomeActivity extends AppCompatActivity {
|
||||
long dataAtual = System.currentTimeMillis();
|
||||
|
||||
if (dataUltimaAtualizacao == 0) {
|
||||
// Se for a primeira vez que entra, guarda a data de hoje
|
||||
sharedPreferences.edit().putLong("data_ultima_atualizacao", dataAtual).apply();
|
||||
} else {
|
||||
// TEMPO CONFIGURADO PARA TESTES: 10 segundos!
|
||||
// Quando fores apresentar a PAP, podes mudar isto para 1 semana.
|
||||
long tempoNecessario = 10 * 1000;
|
||||
// TEMPO CONFIGURADO PARA 30 DIAS!
|
||||
// 30 dias * 24 horas * 60 minutos * 60 segundos * 1000 milissegundos
|
||||
long tempoNecessario = 30L * 24 * 60 * 60 * 1000;
|
||||
|
||||
if (dataAtual - dataUltimaAtualizacao >= tempoNecessario) {
|
||||
mostrarPopupAtualizacao();
|
||||
@@ -109,7 +109,7 @@ public class HomeActivity extends AppCompatActivity {
|
||||
float novoPeso = Float.parseFloat(pesoStr);
|
||||
float novaAltura = Float.parseFloat(alturaStr);
|
||||
|
||||
// Grava os novos dados com as chaves corretas no bloco de notas
|
||||
// Grava os novos dados na memória
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putFloat("peso", novoPeso);
|
||||
editor.putFloat("altura", novaAltura);
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.example.pap;
|
||||
|
||||
// Esta classe é um modelo simples para guardar os dados de um ingrediente
|
||||
public class Ingrediente {
|
||||
private String nome;
|
||||
private int calorias;
|
||||
|
||||
public Ingrediente(String nome, int calorias) {
|
||||
this.nome = nome;
|
||||
this.calorias = calorias;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return nome;
|
||||
}
|
||||
|
||||
public int getCalorias() {
|
||||
return calorias;
|
||||
}
|
||||
|
||||
// Vamos precisar disto para alterar a quantidade se quisermos no futuro
|
||||
public void setCalorias(int calorias) {
|
||||
this.calorias = calorias;
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.example.pap;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.ArrayList;
|
||||
|
||||
// O Adapter é o motor que liga os dados à lista visual
|
||||
public class IngredientesAdapter extends RecyclerView.Adapter<IngredientesAdapter.ViewHolder> {
|
||||
|
||||
private ArrayList<Ingrediente> listaIngredientes;
|
||||
private OnItemClickListener listener;
|
||||
|
||||
// Interface para avisar a Activity que um item foi apagado
|
||||
public interface OnItemClickListener {
|
||||
void onDeleteClick(int position);
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
// Construtor
|
||||
public IngredientesAdapter(ArrayList<Ingrediente> listaIngredientes) {
|
||||
this.listaIngredientes = listaIngredientes;
|
||||
}
|
||||
|
||||
// Cria a "caixinha" visual para cada linha
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_ingrediente, parent, false);
|
||||
return new ViewHolder(view, listener);
|
||||
}
|
||||
|
||||
// Preenche a "caixinha" com os dados do ingrediente atual
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
Ingrediente ingredienteAtual = listaIngredientes.get(position);
|
||||
holder.tvNome.setText(ingredienteAtual.getNome());
|
||||
holder.tvCalorias.setText(ingredienteAtual.getCalorias() + " kcal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return listaIngredientes.size();
|
||||
}
|
||||
|
||||
// Classe interna que guarda as referências aos elementos do layout de cada linha
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
public TextView tvNome;
|
||||
public TextView tvCalorias;
|
||||
public ImageButton btnDelete;
|
||||
|
||||
public ViewHolder(@NonNull View itemView, final OnItemClickListener listener) {
|
||||
super(itemView);
|
||||
tvNome = itemView.findViewById(R.id.tvNomeIngrediente);
|
||||
tvCalorias = itemView.findViewById(R.id.tvCaloriasIngrediente);
|
||||
btnDelete = itemView.findViewById(R.id.btnRemoverIngrediente);
|
||||
|
||||
// Configura o clique no botão de lixo
|
||||
btnDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener != null) {
|
||||
int position = getAdapterPosition();
|
||||
if (position != RecyclerView.NO_POSITION) {
|
||||
listener.onDeleteClick(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,47 +5,49 @@ import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class PerfilActivity extends AppCompatActivity {
|
||||
|
||||
private TextView tvPerfilNome, tvPerfilPontos, tvPerfilDesafios, tvPerfilSequencia;
|
||||
private Button btnDefinicoes, btnVoltarPerfil;
|
||||
private TextView tvPerfilPontos, tvPerfilDesafios, tvPerfilSequencia;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_perfil);
|
||||
|
||||
tvPerfilNome = findViewById(R.id.tvPerfilNome);
|
||||
tvPerfilPontos = findViewById(R.id.tvPerfilPontos);
|
||||
tvPerfilDesafios = findViewById(R.id.tvPerfilDesafios);
|
||||
tvPerfilSequencia = findViewById(R.id.tvPerfilSequencia);
|
||||
btnDefinicoes = findViewById(R.id.btnDefinicoes);
|
||||
btnVoltarPerfil = findViewById(R.id.btnVoltarPerfil);
|
||||
|
||||
Button btnDefinicoes = findViewById(R.id.btnDefinicoes);
|
||||
TextView btnVoltar = findViewById(R.id.btnVoltarPerfil);
|
||||
|
||||
// Ler a pontuação guardada (vamos ligar isto mais à frente)
|
||||
carregarProgresso();
|
||||
|
||||
// Botão Definições
|
||||
btnDefinicoes.setOnClickListener(v -> {
|
||||
startActivity(new Intent(PerfilActivity.this, DefinicoesActivity.class));
|
||||
// Quando tiveres o ecrã de definições criado, trocas o Toast por isto:
|
||||
// Intent intent = new Intent(PerfilActivity.this, DefinicoesActivity.class);
|
||||
// startActivity(intent);
|
||||
Toast.makeText(this, "A abrir Definições...", Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
|
||||
btnVoltarPerfil.setOnClickListener(v -> finish());
|
||||
// Botão Voltar (manda-te de volta para o Home/Menu)
|
||||
btnVoltar.setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
// A MAGIA ACONTECE AQUI: Atualiza os dados sempre que o ecrã aparece!
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
private void carregarProgresso() {
|
||||
SharedPreferences prefs = getSharedPreferences("DadosGamificacao", MODE_PRIVATE);
|
||||
|
||||
SharedPreferences prefs = getSharedPreferences("MeusDadosApp", MODE_PRIVATE);
|
||||
|
||||
String nome = prefs.getString("nome", "Utilizador");
|
||||
int pontos = prefs.getInt("pontos", 0);
|
||||
int desafios = prefs.getInt("desafios_concluidos", 0);
|
||||
int streak = prefs.getInt("sequencia_diaria", 1);
|
||||
int desafios = prefs.getInt("desafios", 0);
|
||||
int sequencia = prefs.getInt("sequencia", 1);
|
||||
|
||||
tvPerfilNome.setText(nome);
|
||||
tvPerfilPontos.setText(String.valueOf(pontos));
|
||||
tvPerfilDesafios.setText(String.valueOf(desafios));
|
||||
tvPerfilSequencia.setText(String.valueOf(streak));
|
||||
tvPerfilSequencia.setText(String.valueOf(sequencia));
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnVoltarStats"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -24,7 +23,6 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingEnd="16dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -47,6 +45,7 @@
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="40dp">
|
||||
|
||||
<!-- Insight da IA -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -58,11 +57,12 @@
|
||||
<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"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Estás a ir muito bem nas tuas refeições de hoje!" android:textSize="14sp" android:textColor="#334155" android:layout_marginTop="2dp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- Health Score -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -82,19 +82,53 @@
|
||||
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="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>
|
||||
|
||||
<!-- IMC Adicionado -->
|
||||
<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="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center_vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="O teu IMC" android:textSize="14sp" android:textColor="#8E8E93" android:textStyle="bold"/>
|
||||
<TextView android:id="@+id/tvValorIMC" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="--" android:textSize="32sp" android:textStyle="bold" android:textColor="#1C1C1E" android:layout_marginTop="4dp"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="end">
|
||||
<TextView android:id="@+id/tvStatusIMC" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="A calcular..." android:textSize="16sp" android:textStyle="bold" android:textColor="#10B981"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Ideal: 18.5 - 24.9" android:textSize="12sp" android:textColor="#8E8E93" android:layout_marginTop="2dp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- Jejum e Passos -->
|
||||
<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"
|
||||
@@ -126,31 +160,7 @@
|
||||
</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="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>
|
||||
|
||||
<!-- Água e Peso -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -179,13 +189,15 @@
|
||||
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">
|
||||
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>
|
||||
|
||||
<!-- Macros e Micronutrientes (COM IDs AGORA!) -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -195,30 +207,37 @@
|
||||
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="Macronutrientes Hoje" android:textStyle="bold" android:textColor="#1C1C1E" android:textSize="16sp" android:layout_marginBottom="12dp"/>
|
||||
|
||||
<TextView android:id="@+id/tvProtGramas" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Proteína: 0g" android:textSize="13sp" android:textColor="#3A3A3C"/>
|
||||
<ProgressBar android:id="@+id/progressProt" style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="6dp" android:max="150" android:progress="0" android:progressTint="#1C1C1E" android:layout_marginBottom="12dp"/>
|
||||
|
||||
<TextView android:id="@+id/tvHidrGramas" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hidratos: 0g" android:textSize="13sp" android:textColor="#3A3A3C"/>
|
||||
<ProgressBar android:id="@+id/progressHidr" style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="6dp" android:max="250" android:progress="0" android:progressTint="#1C1C1E" android:layout_marginBottom="12dp"/>
|
||||
|
||||
<TextView android:id="@+id/tvGordGramas" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Gordura: 0g" android:textSize="13sp" android:textColor="#3A3A3C"/>
|
||||
<ProgressBar android:id="@+id/progressGord" style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="6dp" android:max="80" android:progress="0" 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>
|
||||
<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 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>
|
||||
<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 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>
|
||||
<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>
|
||||
|
||||
<!-- Top Comidas -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -226,12 +245,8 @@
|
||||
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"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Últimas Refeições" android:textSize="16sp" android:textStyle="bold" android:textColor="#1C1C1E" android:layout_marginBottom="16dp"/>
|
||||
<TextView android:id="@+id/tvComida1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Nenhuma refeição lida hoje." android:textColor="#3A3A3C" android:textSize="15sp" android:layout_marginBottom="12dp"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
@@ -4,29 +4,42 @@
|
||||
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">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:background="#FFFFFF"
|
||||
android:elevation="4dp">
|
||||
android:layout_marginBottom="32dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnVoltarPerfil"
|
||||
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="O Meu Perfil"
|
||||
android:textSize="22sp"
|
||||
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"
|
||||
@@ -38,7 +51,8 @@
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
app:cardCornerRadius="60dp"
|
||||
app:cardElevation="6dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7"
|
||||
android:layout_marginTop="10dp">
|
||||
<ImageView
|
||||
android:id="@+id/ivFotoPerfil"
|
||||
@@ -46,7 +60,8 @@
|
||||
android:layout_height="match_parent"
|
||||
android:src="@android:drawable/ic_menu_gallery"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="#E2E8F0"/>
|
||||
android:padding="30dp"
|
||||
app:tint="#C7C7CC"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
@@ -54,17 +69,18 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Nome do Utilizador"
|
||||
android:textSize="24sp"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#0F172A"
|
||||
android:textColor="#1C1C1E"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="#F2F2F7"
|
||||
android:layout_marginBottom="32dp">
|
||||
|
||||
<LinearLayout
|
||||
@@ -80,28 +96,12 @@
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="⭐"
|
||||
android:textSize="24sp"/>
|
||||
<TextView
|
||||
android:id="@+id/tvPerfilPontos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#F59E0B"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Pontos"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#64748B"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="⭐" android:textSize="24sp" android:layout_marginBottom="4dp"/>
|
||||
<TextView android:id="@+id/tvPerfilPontos" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1450" android:textSize="20sp" android:textStyle="bold" android:textColor="#1C1C1E"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Pontos" android:textSize="12sp" android:textColor="#8E8E93"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View android:layout_width="1dp" android:layout_height="match_parent" android:background="#E2E8F0"/>
|
||||
<View android:layout_width="1dp" android:layout_height="match_parent" android:background="#E5E5EA" android:layout_marginVertical="8dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
@@ -109,28 +109,12 @@
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="🏆"
|
||||
android:textSize="24sp"/>
|
||||
<TextView
|
||||
android:id="@+id/tvPerfilDesafios"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#10B981"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Desafios"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#64748B"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="🏆" android:textSize="24sp" android:layout_marginBottom="4dp"/>
|
||||
<TextView android:id="@+id/tvPerfilDesafios" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="28" android:textSize="20sp" android:textStyle="bold" android:textColor="#1C1C1E"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Desafios" android:textSize="12sp" android:textColor="#8E8E93"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View android:layout_width="1dp" android:layout_height="match_parent" android:background="#E2E8F0"/>
|
||||
<View android:layout_width="1dp" android:layout_height="match_parent" android:background="#E5E5EA" android:layout_marginVertical="8dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
@@ -138,25 +122,9 @@
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="🔥"
|
||||
android:textSize="24sp"/>
|
||||
<TextView
|
||||
android:id="@+id/tvPerfilSequencia"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#EF4444"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Sequência"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#64748B"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="🔥" android:textSize="24sp" android:layout_marginBottom="4dp"/>
|
||||
<TextView android:id="@+id/tvPerfilSequencia" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="5" android:textSize="20sp" android:textStyle="bold" android:textColor="#1C1C1E"/>
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sequência" android:textSize="12sp" android:textColor="#8E8E93"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -166,23 +134,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:text="Definições da Conta"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:backgroundTint="#0F172A"
|
||||
app:cornerRadius="15dp"
|
||||
android:layout_marginBottom="12dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltarPerfil"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#0F172A"
|
||||
android:backgroundTint="#E2E8F0"
|
||||
app:cornerRadius="15dp"/>
|
||||
android:textColor="#FFFFFF"
|
||||
android:backgroundTint="#1C1C1E"
|
||||
app:cornerRadius="16dp"
|
||||
android:elevation="0dp"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
Reference in New Issue
Block a user