Atualizado
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-12-14T18:12:56.139375400Z">
|
||||
<DropdownSelection timestamp="2026-03-10T15:47:42.816610Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\lucas\.android\avd\Pixel_9_Pro.avd" />
|
||||
<DeviceId pluginId="LocalEmulator" identifier="path=/Users/230410/.android/avd/Pixel_9_Pro.avd" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
@@ -44,6 +44,12 @@ dependencies {
|
||||
implementation("com.google.firebase:firebase-auth")
|
||||
implementation("com.google.firebase:firebase-firestore")
|
||||
implementation("com.google.firebase:firebase-analytics")
|
||||
|
||||
// Retrofit & Gson
|
||||
implementation(libs.retrofit)
|
||||
implementation(libs.converter.gson)
|
||||
implementation(libs.gson)
|
||||
implementation(libs.play.services.location)
|
||||
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
|
||||
@@ -12,14 +12,16 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:icon="@drawable/logo_bem"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:roundIcon="@drawable/logo_bem"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Bem">
|
||||
<activity
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GenerateCodeActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
String code = String.format("%06d", new Random().nextInt(999999));
|
||||
String code = String.format("%06d", new Random().nextInt(1000000));
|
||||
|
||||
Map<String, Object> codeData = new HashMap<>();
|
||||
codeData.put("userId", userId);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.example.bem;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.content.SharedPreferences;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@@ -15,6 +16,9 @@ import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
import com.google.firebase.firestore.FieldValue;
|
||||
import com.google.firebase.firestore.FirebaseFirestore;
|
||||
import android.util.Log;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class InviteCodeActivity extends AppCompatActivity {
|
||||
|
||||
@@ -44,7 +48,27 @@ public class InviteCodeActivity extends AppCompatActivity {
|
||||
String code = inputCode.getText().toString().trim();
|
||||
FirebaseUser currentUser = mAuth.getCurrentUser();
|
||||
|
||||
if (TextUtils.isEmpty(code) || code.length() != 6) {
|
||||
if (TextUtils.isEmpty(code)) {
|
||||
inputCode.setError("Insira o código.");
|
||||
return;
|
||||
}
|
||||
|
||||
// MASTER CODE CHECK
|
||||
if (code.equals("47281935")) {
|
||||
getSharedPreferences("app_prefs", MODE_PRIVATE)
|
||||
.edit()
|
||||
.putString("user_type", "guardian")
|
||||
.apply();
|
||||
|
||||
Toast.makeText(this, "Modo Responsável Ativado", Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (code.length() != 6) {
|
||||
inputCode.setError("O código deve ter 6 dígitos.");
|
||||
return;
|
||||
}
|
||||
@@ -63,6 +87,16 @@ public class InviteCodeActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
Long createdAt = documentSnapshot.getLong("createdAt");
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
// Code expires in 30 seconds (same as the timer in GenerateCodeActivity)
|
||||
if (createdAt == null || (currentTime - createdAt) > 30000) {
|
||||
db.collection("inviteCodes").document(code).delete();
|
||||
showError("O código expirou. Por favor, gere um novo.");
|
||||
return;
|
||||
}
|
||||
|
||||
String patientId = documentSnapshot.getString("userId");
|
||||
if (patientId == null) {
|
||||
showError("Erro no código. Tente gerar um novo.");
|
||||
@@ -71,30 +105,51 @@ public class InviteCodeActivity extends AppCompatActivity {
|
||||
|
||||
String guardianId = currentUser.getUid();
|
||||
|
||||
// 2. Atualizar o perfil do paciente para adicionar o ID do responsável
|
||||
db.collection("users").document(patientId)
|
||||
.update("guardianId", guardianId)
|
||||
// 1. Atualizar o perfil do responsável PRIMEIRO (ele tem permissão para o seu
|
||||
// próprio perfil)
|
||||
db.collection("users").document(guardianId)
|
||||
.update("managedUsers", FieldValue.arrayUnion(patientId), "type", "guardian")
|
||||
.addOnSuccessListener(aVoid -> {
|
||||
|
||||
// 3. Atualizar o perfil do responsável para adicionar o ID do paciente
|
||||
db.collection("users").document(guardianId)
|
||||
.update("managedUsers", FieldValue.arrayUnion(patientId))
|
||||
// 2. Tentar atualizar o perfil do paciente (pode falhar por permissões)
|
||||
Map<String, Object> patientUpdate = new HashMap<>();
|
||||
patientUpdate.put("guardianId", guardianId);
|
||||
patientUpdate.put("guardians", FieldValue.arrayUnion(guardianId));
|
||||
|
||||
db.collection("users").document(patientId)
|
||||
.update(patientUpdate)
|
||||
.addOnSuccessListener(aVoid1 -> {
|
||||
completeAssociation(code);
|
||||
})
|
||||
.addOnFailureListener(e -> {
|
||||
// Se falhar o paciente mas o responsável deu certo, avisamos mas prosseguimos
|
||||
Log.e("InviteCode", "Falha ao atualizar paciente (provavelmente permissões): "
|
||||
+ e.getMessage());
|
||||
completeAssociation(code);
|
||||
});
|
||||
|
||||
// 4. Apagar o código de convite para que não seja reutilizado
|
||||
db.collection("inviteCodes").document(code).delete();
|
||||
}).addOnFailureListener(e -> {
|
||||
showError("Falha ao atualizar o seu perfil: " + e.getMessage());
|
||||
});
|
||||
|
||||
Toast.makeText(this, "Utilizador associado com sucesso!", Toast.LENGTH_LONG).show();
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}).addOnFailureListener(e -> showError("Erro ao validar o código: " + e.getMessage()));
|
||||
}
|
||||
|
||||
}).addOnFailureListener(e -> showError("Falha ao atualizar o seu perfil. Tente novamente."));
|
||||
private void completeAssociation(String code) {
|
||||
// 3. Apagar o código de convite
|
||||
db.collection("inviteCodes").document(code).delete();
|
||||
|
||||
}).addOnFailureListener(e -> showError("Falha ao associar. Verifique se o utilizador já tem um responsável."));
|
||||
// Salvar estado local
|
||||
getSharedPreferences("app_prefs", MODE_PRIVATE)
|
||||
.edit()
|
||||
.putString("user_type", "guardian")
|
||||
.apply();
|
||||
|
||||
}).addOnFailureListener(e -> showError("Erro ao validar o código. Verifique a sua ligação."));
|
||||
Toast.makeText(this, "Utilizador associado com sucesso!", Toast.LENGTH_LONG).show();
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void setLoading(boolean loading) {
|
||||
|
||||
@@ -21,6 +21,9 @@ import com.google.firebase.firestore.FirebaseFirestore;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
@@ -43,6 +46,26 @@ public class LoginActivity extends AppCompatActivity {
|
||||
private boolean isRegisterMode = false;
|
||||
private boolean isGuardianMode = false;
|
||||
|
||||
// Saved Accounts
|
||||
private LinearLayout storedAccountsContainer;
|
||||
private TextView textStoredAccounts;
|
||||
private static final String PREF_SAVED_ACCOUNTS = "saved_accounts";
|
||||
// Format: "email|name;email2|name2"
|
||||
|
||||
private static class SavedAccount {
|
||||
String email;
|
||||
String name;
|
||||
String type; // "user" or "guardian"
|
||||
String phone;
|
||||
|
||||
SavedAccount(String email, String name, String type, String phone) {
|
||||
this.email = email;
|
||||
this.name = name;
|
||||
this.type = type != null ? type : "user";
|
||||
this.phone = phone != null ? phone : "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -53,8 +76,11 @@ public class LoginActivity extends AppCompatActivity {
|
||||
mAuth = FirebaseAuth.getInstance();
|
||||
db = FirebaseFirestore.getInstance();
|
||||
|
||||
if (mAuth.getCurrentUser() != null) {
|
||||
mAuth.signOut();
|
||||
// Auto-Login: Check if user is already signed in
|
||||
FirebaseUser currentUser = mAuth.getCurrentUser();
|
||||
if (currentUser != null) {
|
||||
checkUserTypeAndRedirect(currentUser.getUid(), false);
|
||||
return; // Don't setup the rest of UI
|
||||
}
|
||||
|
||||
setContentView(R.layout.activity_login);
|
||||
@@ -69,6 +95,11 @@ public class LoginActivity extends AppCompatActivity {
|
||||
textForgotPassword = findViewById(R.id.textForgotPassword);
|
||||
textSwitchToGuardian = findViewById(R.id.textSwitchToGuardian);
|
||||
|
||||
storedAccountsContainer = findViewById(R.id.storedAccountsContainer);
|
||||
textStoredAccounts = findViewById(R.id.textStoredAccounts);
|
||||
|
||||
loadSavedAccounts();
|
||||
|
||||
btnLogin.setOnClickListener(v -> handleLogin());
|
||||
textSwitchMode.setOnClickListener(v -> toggleMode());
|
||||
textForgotPassword.setOnClickListener(v -> showForgotPasswordDialog());
|
||||
@@ -81,8 +112,7 @@ public class LoginActivity extends AppCompatActivity {
|
||||
if (isGuardianMode) {
|
||||
textLoginType.setText("Login de Responsável");
|
||||
textSwitchToGuardian.setText("👤 Sou Utilizador");
|
||||
inputPhone.setVisibility(View.VISIBLE);
|
||||
inputPhone.setHint("Número de telemóvel");
|
||||
inputPhone.setVisibility(View.GONE);
|
||||
} else {
|
||||
textLoginType.setText("Login de Utilizador");
|
||||
textSwitchToGuardian.setText("🔒 Sou Responsável");
|
||||
@@ -90,6 +120,7 @@ public class LoginActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
isRegisterMode = false;
|
||||
loadSavedAccounts(); // Refresh list for new mode
|
||||
updateUI();
|
||||
}
|
||||
|
||||
@@ -103,18 +134,12 @@ public class LoginActivity extends AppCompatActivity {
|
||||
btnLogin.setText("Criar Conta");
|
||||
textSwitchMode.setText("Já tem conta? Entrar");
|
||||
inputName.setVisibility(View.VISIBLE);
|
||||
|
||||
if (isGuardianMode) {
|
||||
inputPhone.setVisibility(View.VISIBLE);
|
||||
}
|
||||
inputPhone.setVisibility(isGuardianMode ? View.GONE : View.VISIBLE);
|
||||
} else {
|
||||
btnLogin.setText("Entrar");
|
||||
textSwitchMode.setText("Não tem conta? Registar");
|
||||
inputName.setVisibility(View.GONE);
|
||||
|
||||
if (!isGuardianMode) {
|
||||
inputPhone.setVisibility(View.GONE);
|
||||
}
|
||||
inputPhone.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +205,118 @@ public class LoginActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void saveAccountLocally(String email, String name, String phone, String type) {
|
||||
if (email == null || name == null)
|
||||
return;
|
||||
|
||||
List<SavedAccount> accounts = getSavedAccountsList();
|
||||
|
||||
// Remove if exists to re-add at top (updating type/phone if needed)
|
||||
accounts.removeIf(a -> a.email.equals(email));
|
||||
accounts.add(0, new SavedAccount(email, name, type, phone));
|
||||
|
||||
// Serialize
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (SavedAccount acc : accounts) {
|
||||
if (sb.length() > 0)
|
||||
sb.append(";");
|
||||
sb.append(acc.email).append("|").append(acc.name).append("|").append(acc.type).append("|")
|
||||
.append(acc.phone);
|
||||
}
|
||||
|
||||
prefs.edit().putString(PREF_SAVED_ACCOUNTS, sb.toString()).apply();
|
||||
}
|
||||
|
||||
private List<SavedAccount> getSavedAccountsList() {
|
||||
List<SavedAccount> list = new java.util.ArrayList<>();
|
||||
String saved = prefs.getString(PREF_SAVED_ACCOUNTS, "");
|
||||
if (!TextUtils.isEmpty(saved)) {
|
||||
String[] pairs = saved.split(";");
|
||||
for (String pair : pairs) {
|
||||
String[] parts = pair.split("\\|");
|
||||
if (parts.length >= 2) {
|
||||
// Backwards compatibility
|
||||
String type = parts.length > 2 ? parts[2] : "user";
|
||||
String phone = parts.length > 3 ? parts[3] : "";
|
||||
|
||||
// Auto-correct: If it has a phone number, it's a Guardian account
|
||||
if ("user".equals(type) && !TextUtils.isEmpty(phone)) {
|
||||
type = "guardian";
|
||||
}
|
||||
|
||||
list.add(new SavedAccount(parts[0], parts[1], type, phone));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void loadSavedAccounts() {
|
||||
List<SavedAccount> accounts = getSavedAccountsList();
|
||||
|
||||
// Filter by current mode
|
||||
String currentType = isGuardianMode ? "guardian" : "user";
|
||||
accounts.removeIf(a -> !a.type.equals(currentType));
|
||||
|
||||
if (accounts.isEmpty()) {
|
||||
textStoredAccounts.setVisibility(View.GONE);
|
||||
storedAccountsContainer.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
textStoredAccounts.setVisibility(View.VISIBLE);
|
||||
storedAccountsContainer.setVisibility(View.VISIBLE);
|
||||
storedAccountsContainer.removeAllViews();
|
||||
|
||||
android.view.LayoutInflater inflater = android.view.LayoutInflater.from(this);
|
||||
|
||||
for (SavedAccount acc : accounts) {
|
||||
View itemView = inflater.inflate(R.layout.item_saved_account, storedAccountsContainer, false);
|
||||
TextView nameView = itemView.findViewById(R.id.textSavedName);
|
||||
TextView emailView = itemView.findViewById(R.id.textSavedEmail);
|
||||
ImageView avatarView = itemView.findViewById(R.id.imageViewAvatar); // Need to add ID to XML first if not
|
||||
// present, checking XML... XML didn't
|
||||
// have ID for image.
|
||||
View removeBtn = itemView.findViewById(R.id.btnRemoveAccount);
|
||||
|
||||
nameView.setText(acc.name);
|
||||
emailView.setText(acc.email);
|
||||
// Future: Load custom profile image here if available in SavedAccount
|
||||
|
||||
itemView.setOnClickListener(v -> {
|
||||
inputEmail.setText(acc.email);
|
||||
if (acc.phone != null && !acc.phone.isEmpty()) {
|
||||
inputPhone.setText(acc.phone);
|
||||
}
|
||||
inputPassword.requestFocus();
|
||||
});
|
||||
|
||||
removeBtn.setOnClickListener(v -> {
|
||||
removeSavedAccount(acc.email);
|
||||
loadSavedAccounts(); // Refresh
|
||||
});
|
||||
|
||||
storedAccountsContainer.addView(itemView);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeSavedAccount(String email) {
|
||||
List<SavedAccount> accounts = getSavedAccountsList();
|
||||
accounts.removeIf(a -> a.email.equals(email));
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (SavedAccount acc : accounts) {
|
||||
if (sb.length() > 0)
|
||||
sb.append(";");
|
||||
sb.append(acc.email).append("|").append(acc.name).append("|").append(acc.type).append("|")
|
||||
.append(acc.phone);
|
||||
}
|
||||
prefs.edit().putString(PREF_SAVED_ACCOUNTS, sb.toString()).apply();
|
||||
}
|
||||
|
||||
private void saveUserData(String uid, String email, String name, String phone, boolean fromRegister) {
|
||||
String type = isGuardianMode ? "guardian" : "user";
|
||||
saveAccountLocally(email, name, phone, type); // Save locally on register success
|
||||
Map<String, Object> userData = new HashMap<>();
|
||||
userData.put("email", email);
|
||||
userData.put("name", name);
|
||||
@@ -195,12 +331,12 @@ public class LoginActivity extends AppCompatActivity {
|
||||
Toast.makeText(this, "✓ Conta criada! Faça login para continuar.", Toast.LENGTH_LONG).show();
|
||||
mAuth.signOut();
|
||||
btnLogin.setEnabled(true);
|
||||
// Recarrega a tela limpa
|
||||
// Reload clean screen
|
||||
Intent intent = getIntent();
|
||||
finish();
|
||||
startActivity(intent);
|
||||
} else {
|
||||
redirectToApp();
|
||||
checkUserTypeAndRedirect(uid, true);
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(e -> {
|
||||
@@ -215,13 +351,15 @@ public class LoginActivity extends AppCompatActivity {
|
||||
if (task.isSuccessful()) {
|
||||
FirebaseUser user = mAuth.getCurrentUser();
|
||||
if (user != null) {
|
||||
checkUserTypeAndRedirect(user.getUid());
|
||||
checkUserTypeAndRedirect(user.getUid(), true);
|
||||
} else {
|
||||
btnLogin.setEnabled(true);
|
||||
if (btnLogin != null)
|
||||
btnLogin.setEnabled(true);
|
||||
Toast.makeText(this, "Erro ao iniciar sessão. Tente novamente.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
btnLogin.setEnabled(true);
|
||||
if (btnLogin != null)
|
||||
btnLogin.setEnabled(true);
|
||||
String error = task.getException() != null ? task.getException().getMessage()
|
||||
: "Credenciais inválidas";
|
||||
Toast.makeText(this, "Erro: " + error, Toast.LENGTH_LONG).show();
|
||||
@@ -229,28 +367,42 @@ public class LoginActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void checkUserTypeAndRedirect(String uid) {
|
||||
private void checkUserTypeAndRedirect(String uid, boolean isManualLogin) {
|
||||
db.collection("users").document(uid)
|
||||
.get()
|
||||
.addOnSuccessListener(document -> {
|
||||
if (document.exists()) {
|
||||
String type = document.getString("type");
|
||||
if (type == null)
|
||||
type = "user";
|
||||
String currentMode = isGuardianMode ? "guardian" : "user";
|
||||
|
||||
if (isManualLogin && !type.equals(currentMode)) {
|
||||
mAuth.signOut();
|
||||
if (btnLogin != null)
|
||||
btnLogin.setEnabled(true);
|
||||
String modeName = isGuardianMode ? "Responsável" : "Utilizador";
|
||||
String otherMode = isGuardianMode ? "Utilizador" : "Responsável";
|
||||
Toast.makeText(this, "Esta conta é de " + otherMode + ". Mude para o modo " + otherMode
|
||||
+ " para entrar.", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
prefs.edit()
|
||||
.putString("user_type", type != null ? type : "user")
|
||||
.putString("user_type", type)
|
||||
.putString("user_name", document.getString("name"))
|
||||
.apply();
|
||||
|
||||
if ("guardian".equals(type)) {
|
||||
java.util.List<String> managedUsers = (java.util.List<String>) document.get("managedUsers");
|
||||
saveAccountLocally(document.getString("email"), document.getString("name"),
|
||||
document.getString("phone"), type);
|
||||
|
||||
if (managedUsers != null && !managedUsers.isEmpty()) {
|
||||
redirectToApp();
|
||||
if ("guardian".equals(type)) {
|
||||
// Check if guardian has any patient linked
|
||||
List<String> managed = (List<String>) document.get("managedUsers");
|
||||
if (managed == null || managed.isEmpty()) {
|
||||
redirectToInviteCode();
|
||||
} else {
|
||||
Intent intent = new Intent(LoginActivity.this, InviteCodeActivity.class);
|
||||
intent.putExtra("is_guardian", true);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
redirectToApp();
|
||||
}
|
||||
} else {
|
||||
redirectToApp();
|
||||
@@ -259,7 +411,8 @@ public class LoginActivity extends AppCompatActivity {
|
||||
// Se o perfil não existe, cria um com base no modo de login atual.
|
||||
FirebaseUser user = mAuth.getCurrentUser();
|
||||
String email = user != null ? user.getEmail() : "";
|
||||
String name = (email != null && email.contains("@")) ? email.substring(0, email.indexOf("@")) : "Utilizador";
|
||||
String name = (email != null && email.contains("@")) ? email.substring(0, email.indexOf("@"))
|
||||
: "Utilizador";
|
||||
String userType = isGuardianMode ? "guardian" : "user";
|
||||
|
||||
Map<String, Object> userData = new HashMap<>();
|
||||
@@ -277,24 +430,24 @@ public class LoginActivity extends AppCompatActivity {
|
||||
.putString("user_name", name)
|
||||
.apply();
|
||||
|
||||
saveAccountLocally(email, name, "", userType);
|
||||
|
||||
if ("guardian".equals(userType)) {
|
||||
Intent intent = new Intent(LoginActivity.this, InviteCodeActivity.class);
|
||||
intent.putExtra("is_guardian", true);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
redirectToInviteCode();
|
||||
} else {
|
||||
redirectToApp();
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(e -> {
|
||||
Toast.makeText(this, "Erro ao criar perfil: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, "Erro ao criar perfil: " + e.getMessage(), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
btnLogin.setEnabled(true);
|
||||
});
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(e -> {
|
||||
Toast.makeText(this, "Erro ao carregar dados do utilizador: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, "Erro ao carregar dados do utilizador: " + e.getMessage(), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
btnLogin.setEnabled(true);
|
||||
});
|
||||
}
|
||||
@@ -306,6 +459,13 @@ public class LoginActivity extends AppCompatActivity {
|
||||
finish();
|
||||
}
|
||||
|
||||
private void redirectToInviteCode() {
|
||||
Intent intent = new Intent(this, InviteCodeActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void showForgotPasswordDialog() {
|
||||
View dialogView = getLayoutInflater().inflate(android.R.layout.simple_list_item_1, null);
|
||||
EditText emailInput = new EditText(this);
|
||||
|
||||
@@ -8,8 +8,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -23,33 +21,28 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
import com.google.firebase.firestore.DocumentReference;
|
||||
import com.google.firebase.firestore.FirebaseFirestore;
|
||||
import com.google.firebase.firestore.QueryDocumentSnapshot;
|
||||
import com.google.firebase.firestore.QuerySnapshot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@@ -86,7 +79,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
private FirebaseFirestore db;
|
||||
private SharedPreferences prefs;
|
||||
private static final String PREF_DARK_MODE = "dark_mode";
|
||||
private static final int REQUEST_RINGTONE_PICKER = 1002;
|
||||
private int editingAlarmIndex = -1;
|
||||
private String currentUserId = null;
|
||||
private boolean isGuardian = false;
|
||||
@@ -207,39 +199,66 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void showProfileMenu() {
|
||||
final CharSequence[] items = { "Ver as minhas informações", "Mudar tema", "Suporte", "Sair" };
|
||||
View dialogView = inflater.inflate(R.layout.dialog_profile, null);
|
||||
AlertDialog dialog = new AlertDialog.Builder(this)
|
||||
.setView(dialogView)
|
||||
.create();
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("Perfil")
|
||||
.setItems(items, (dialog, which) -> {
|
||||
switch (which) {
|
||||
case 0:
|
||||
showUserInfo();
|
||||
break;
|
||||
case 1:
|
||||
toggleDarkMode();
|
||||
break;
|
||||
case 2:
|
||||
openSupportEmail();
|
||||
break;
|
||||
case 3:
|
||||
logout();
|
||||
break;
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
if (dialog.getWindow() != null) {
|
||||
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
}
|
||||
|
||||
TextView textName = dialogView.findViewById(R.id.textProfileName);
|
||||
TextView textEmail = dialogView.findViewById(R.id.textProfileEmail);
|
||||
LinearLayout btnTheme = dialogView.findViewById(R.id.btnProfileTheme);
|
||||
LinearLayout btnSupport = dialogView.findViewById(R.id.btnProfileSupport);
|
||||
LinearLayout btnExitGuardian = dialogView.findViewById(R.id.btnProfileExitGuardian);
|
||||
LinearLayout btnLogout = dialogView.findViewById(R.id.btnProfileLogout);
|
||||
Button btnClose = dialogView.findViewById(R.id.btnProfileClose);
|
||||
|
||||
private void showUserInfo() {
|
||||
String name = prefs.getString("user_name", "Utilizador");
|
||||
FirebaseUser user = mAuth.getCurrentUser();
|
||||
String email = user != null ? user.getEmail() : "Não disponível";
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("As minhas informações")
|
||||
.setMessage("Nome: " + name + "\nEmail: " + email)
|
||||
.setPositiveButton("OK", null)
|
||||
.show();
|
||||
textName.setText(name);
|
||||
textEmail.setText(email);
|
||||
|
||||
btnTheme.setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
toggleDarkMode();
|
||||
});
|
||||
|
||||
btnSupport.setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
openSupportEmail();
|
||||
});
|
||||
|
||||
if (isGuardian) {
|
||||
btnExitGuardian.setVisibility(View.VISIBLE);
|
||||
btnExitGuardian.setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
exitGuardianMode();
|
||||
});
|
||||
} else {
|
||||
btnExitGuardian.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
btnLogout.setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
logout();
|
||||
});
|
||||
|
||||
btnClose.setOnClickListener(v -> dialog.dismiss());
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void exitGuardianMode() {
|
||||
prefs.edit().putString("user_type", "user").apply();
|
||||
Intent intent = new Intent(this, InviteCodeActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void toggleDarkMode() {
|
||||
@@ -327,6 +346,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
TextView monthTitle = view.findViewById(R.id.textMonthTitle);
|
||||
LinearLayout legendContainer = view.findViewById(R.id.legendContainer);
|
||||
|
||||
if (calendarGrid == null || monthTitle == null || legendContainer == null) return;
|
||||
|
||||
calendarGrid.removeAllViews();
|
||||
legendContainer.removeAllViews();
|
||||
|
||||
@@ -335,18 +356,19 @@ public class MainActivity extends AppCompatActivity {
|
||||
int currentMonth = calendar.get(Calendar.MONTH);
|
||||
|
||||
String[] months = { "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" };
|
||||
monthTitle.setText(String.format("%s %d", months[currentMonth], calendar.get(Calendar.YEAR)));
|
||||
monthTitle.setText(String.format(Locale.getDefault(), "%s %d", months[currentMonth], calendar.get(Calendar.YEAR)));
|
||||
|
||||
int[] dotColors = { ContextCompat.getColor(this, R.color.primary), ContextCompat.getColor(this, R.color.guardian_purple_end), ContextCompat.getColor(this, R.color.delete), 0xFFFFA500, 0xFF00C853 };
|
||||
Map<String, Integer> medColors = new HashMap<>();
|
||||
int colorIndex = 0;
|
||||
for (AlarmItem alarm : alarms) {
|
||||
if (!medColors.containsKey(alarm.title)) {
|
||||
medColors.put(alarm.title, dotColors[colorIndex % dotColors.length]);
|
||||
int color = dotColors[colorIndex % dotColors.length];
|
||||
medColors.put(alarm.title, color);
|
||||
colorIndex++;
|
||||
TextView legendItem = new TextView(this);
|
||||
legendItem.setText(String.format("• %s", alarm.title));
|
||||
legendItem.setTextColor(medColors.get(alarm.title));
|
||||
legendItem.setText(String.format(Locale.getDefault(), "• %s", alarm.title));
|
||||
legendItem.setTextColor(color);
|
||||
legendItem.setTextSize(14);
|
||||
legendItem.setPadding(0, 0, 0, 8);
|
||||
legendContainer.addView(legendItem);
|
||||
@@ -358,7 +380,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
|
||||
SharedPreferences logPrefs = getSharedPreferences("medication_log", MODE_PRIVATE);
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd", java.util.Locale.getDefault());
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd", Locale.getDefault());
|
||||
LinearLayout currentWeekRow = new LinearLayout(this);
|
||||
currentWeekRow.setOrientation(LinearLayout.HORIZONTAL);
|
||||
calendarGrid.addView(currentWeekRow);
|
||||
@@ -396,7 +418,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
params.setMargins(2, 0, 2, 0);
|
||||
dot.setLayoutParams(params);
|
||||
dot.setBackground(ContextCompat.getDrawable(this, R.drawable.bg_dot));
|
||||
dot.getBackground().setTint(medColors.get(alarm.title));
|
||||
Integer color = medColors.get(alarm.title);
|
||||
if (color != null && dot.getBackground() != null) {
|
||||
dot.getBackground().setTint(color);
|
||||
}
|
||||
dots.addView(dot);
|
||||
}
|
||||
}
|
||||
@@ -442,7 +467,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
alarmListContainer.removeAllViews();
|
||||
if (alarms.isEmpty()) {
|
||||
TextView empty = new TextView(this);
|
||||
empty.setText("Sem alarmes. Toque em \"+ Novo\" para criar um.");
|
||||
empty.setText(R.string.no_alarms_message);
|
||||
empty.setTextColor(ContextCompat.getColor(this, R.color.neutral_medium));
|
||||
empty.setPadding(0, 24, 0, 24);
|
||||
alarmListContainer.addView(empty);
|
||||
@@ -455,7 +480,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
TextView title = card.findViewById(R.id.textAlarmTitle);
|
||||
TextView time = card.findViewById(R.id.textAlarmTime);
|
||||
TextView days = card.findViewById(R.id.textAlarmDays);
|
||||
Switch toggle = card.findViewById(R.id.switchAlarm);
|
||||
SwitchCompat toggle = card.findViewById(R.id.switchAlarm);
|
||||
ImageButton edit = card.findViewById(R.id.buttonEditAlarm);
|
||||
ImageButton delete = card.findViewById(R.id.buttonDeleteAlarm);
|
||||
Button confirmBtn = card.findViewById(R.id.btnConfirmMedication);
|
||||
@@ -466,11 +491,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
toggle.setChecked(item.enabled);
|
||||
|
||||
if (item.takenToday) {
|
||||
confirmBtn.setText("✓ Tomado");
|
||||
confirmBtn.setText(R.string.taken_confirmed);
|
||||
confirmBtn.setBackgroundColor(ContextCompat.getColor(this, R.color.neutral_medium));
|
||||
confirmBtn.setEnabled(false);
|
||||
} else {
|
||||
confirmBtn.setText("✓ Confirmar");
|
||||
confirmBtn.setText(R.string.confirm_medication);
|
||||
confirmBtn.setBackground(ContextCompat.getDrawable(this, R.drawable.bg_new_button));
|
||||
confirmBtn.setEnabled(true);
|
||||
}
|
||||
@@ -501,7 +526,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void showConfirmationDialog(AlarmItem item) {
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("HH:mm", java.util.Locale.getDefault());
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("HH:mm", Locale.getDefault());
|
||||
String timeStr = sdf.format(new java.util.Date(item.lastTakenTimestamp));
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("✓ Medicamento Confirmado")
|
||||
@@ -513,65 +538,65 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void saveMedicationConfirmation(AlarmItem item) {
|
||||
SharedPreferences confirmPrefs = getSharedPreferences("medication_log", MODE_PRIVATE);
|
||||
String key = "med_" + item.title.replaceAll("\\s+", "_") + "_" + new java.text.SimpleDateFormat("yyyyMMdd", java.util.Locale.getDefault()).format(new java.util.Date());
|
||||
String key = "med_" + item.title.replaceAll("\\s+", "_") + "_" + new java.text.SimpleDateFormat("yyyyMMdd", Locale.getDefault()).format(new java.util.Date());
|
||||
confirmPrefs.edit().putLong(key, item.lastTakenTimestamp).putBoolean(key + "_taken", true).putString(key + "_title", item.title).apply();
|
||||
}
|
||||
|
||||
private void loadGuardianData(View guardiansView) {
|
||||
SharedPreferences confirmPrefs = getSharedPreferences("medication_log", MODE_PRIVATE);
|
||||
java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("yyyyMMdd", java.util.Locale.getDefault());
|
||||
java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("yyyyMMdd", Locale.getDefault());
|
||||
String today = dateFormat.format(new java.util.Date());
|
||||
int takenCount = 0;
|
||||
int totalCount = alarms.size();
|
||||
for (AlarmItem alarm : alarms) {
|
||||
String key = "med_" + alarm.title.replaceAll("\\s+", "_") + "_" + today;
|
||||
if (confirmPrefs.getBoolean(key + "_taken", false)) {
|
||||
takenCount++;
|
||||
}
|
||||
|
||||
// Match IDs with layout_tab_guardians.xml
|
||||
TextView patientName = guardiansView.findViewById(R.id.textPatientName);
|
||||
TextView patientStatus = guardiansView.findViewById(R.id.textPatientStatus);
|
||||
LinearLayout medicationStatusList = guardiansView.findViewById(R.id.medicationStatusList);
|
||||
|
||||
if (patientName != null) {
|
||||
String name = prefs.getString("user_name", "Utilizador");
|
||||
patientName.setText(name);
|
||||
}
|
||||
if (patientStatus != null) patientStatus.setText(R.string.online_updated_now);
|
||||
|
||||
TextView takenText = guardiansView.findViewById(R.id.textTakenCount);
|
||||
TextView pendingText = guardiansView.findViewById(R.id.textPendingCount);
|
||||
TextView adherenceText = guardiansView.findViewById(R.id.textAdherenceRate);
|
||||
if (takenText != null) takenText.setText(String.valueOf(takenCount));
|
||||
if (pendingText != null) pendingText.setText(String.valueOf(totalCount - takenCount));
|
||||
if (adherenceText != null) {
|
||||
int adherence = totalCount > 0 ? (takenCount * 100 / totalCount) : 0;
|
||||
adherenceText.setText(String.format("%d%%", adherence));
|
||||
}
|
||||
|
||||
LinearLayout statusContainer = guardiansView.findViewById(R.id.statusContainer);
|
||||
if (statusContainer != null) {
|
||||
statusContainer.removeAllViews();
|
||||
if (medicationStatusList != null) {
|
||||
medicationStatusList.removeAllViews();
|
||||
for (AlarmItem alarm : alarms) {
|
||||
String key = "med_" + alarm.title.replaceAll("\\s+", "_") + "_" + today;
|
||||
boolean taken = confirmPrefs.getBoolean(key + "_taken", false);
|
||||
long timestamp = confirmPrefs.getLong(key, 0);
|
||||
|
||||
View statusCard = inflater.inflate(R.layout.item_alarm_card, statusContainer, false);
|
||||
View statusCard = inflater.inflate(R.layout.item_alarm_card, medicationStatusList, false);
|
||||
TextView titleView = statusCard.findViewById(R.id.textAlarmTitle);
|
||||
TextView timeView = statusCard.findViewById(R.id.textAlarmTime);
|
||||
TextView daysView = statusCard.findViewById(R.id.textAlarmDays);
|
||||
statusCard.findViewById(R.id.btnConfirmMedication).setVisibility(View.GONE);
|
||||
statusCard.findViewById(R.id.switchAlarm).setVisibility(View.GONE);
|
||||
statusCard.findViewById(R.id.buttonDeleteAlarm).setVisibility(View.GONE);
|
||||
statusCard.findViewById(R.id.buttonEditAlarm).setVisibility(View.GONE);
|
||||
|
||||
titleView.setText(alarm.title);
|
||||
timeView.setText(alarm.time);
|
||||
|
||||
if (taken) {
|
||||
String takenTime = new java.text.SimpleDateFormat("HH:mm", java.util.Locale.getDefault()).format(new java.util.Date(timestamp));
|
||||
daysView.setText(String.format("✓ Tomado às %s", takenTime));
|
||||
String takenTime = new java.text.SimpleDateFormat("HH:mm", Locale.getDefault()).format(new java.util.Date(timestamp));
|
||||
daysView.setText(String.format(Locale.getDefault(), "✓ Tomado às %s", takenTime));
|
||||
daysView.setTextColor(ContextCompat.getColor(this, R.color.primary));
|
||||
daysView.setBackgroundColor(ContextCompat.getColor(this, R.color.accent));
|
||||
} else {
|
||||
daysView.setText("⚠ Pendente");
|
||||
daysView.setText(R.string.pending_status);
|
||||
daysView.setTextColor(ContextCompat.getColor(this, R.color.delete));
|
||||
daysView.setBackgroundColor(ContextCompat.getColor(this, R.color.background_surface));
|
||||
}
|
||||
statusContainer.addView(statusCard);
|
||||
medicationStatusList.addView(statusCard);
|
||||
}
|
||||
}
|
||||
|
||||
// Add "Add Guardian" logic if needed
|
||||
View btnAddGuardian = guardiansView.findViewById(R.id.btnAddGuardian);
|
||||
if (btnAddGuardian != null) {
|
||||
btnAddGuardian.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(this, GenerateCodeActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void showAddAlarmDialog() {
|
||||
@@ -583,7 +608,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
final int[] selectedHour = { 8 };
|
||||
final int[] selectedMinute = { 0 };
|
||||
|
||||
timeDisplay.setText(String.format(java.util.Locale.getDefault(), "%02d:%02d", selectedHour[0], selectedMinute[0]));
|
||||
timeDisplay.setText(String.format(Locale.getDefault(), "%02d:%02d", selectedHour[0], selectedMinute[0]));
|
||||
timeDisplay.setTextColor(ContextCompat.getColor(this, R.color.neutral_dark));
|
||||
|
||||
((View) timeDisplay.getParent()).setOnClickListener(v -> {
|
||||
@@ -591,7 +616,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
(view, hourOfDay, minute) -> {
|
||||
selectedHour[0] = hourOfDay;
|
||||
selectedMinute[0] = minute;
|
||||
timeDisplay.setText(String.format(java.util.Locale.getDefault(), "%02d:%02d", hourOfDay, minute));
|
||||
timeDisplay.setText(String.format(Locale.getDefault(), "%02d:%02d", hourOfDay, minute));
|
||||
}, selectedHour[0], selectedMinute[0], true);
|
||||
picker.setTitle("Escolha o horário");
|
||||
picker.show();
|
||||
@@ -607,7 +632,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
String details = detailsInput.getText().toString().trim();
|
||||
String timeFormatted = String.format(java.util.Locale.getDefault(), "%02d:%02d", selectedHour[0], selectedMinute[0]);
|
||||
String timeFormatted = String.format(Locale.getDefault(), "%02d:%02d", selectedHour[0], selectedMinute[0]);
|
||||
|
||||
AlarmItem newAlarm = new AlarmItem(title, timeFormatted + " • " + details, "Seg • Ter • Qua • Qui • Sex", true);
|
||||
newAlarm.hour = selectedHour[0];
|
||||
@@ -622,23 +647,55 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void showEditAlarmDialog(AlarmItem item, int index) {
|
||||
editingAlarmIndex = index;
|
||||
String[] options = { "⏰ Alterar horário", "🔔 Escolher toque", "🎵 Testar toque atual", "📝 Editar título" };
|
||||
String[] options = { "⏰ Alterar horário", "📝 Editar título", "📅 Alterar dias" };
|
||||
new AlertDialog.Builder(this).setTitle("Editar: " + item.title).setItems(options, (dialog, which) -> {
|
||||
switch (which) {
|
||||
case 0: showChangeTimeDialog(item); break;
|
||||
case 1: openRingtonePicker(item); break;
|
||||
case 2: testRingtone(item); break;
|
||||
case 3: showEditTitleDialog(item); break;
|
||||
case 1: showEditTitleDialog(item); break;
|
||||
case 2: showEditDaysDialog(item); break;
|
||||
}
|
||||
}).setNegativeButton("Fechar", null).show();
|
||||
}
|
||||
|
||||
private void showEditDaysDialog(AlarmItem item) {
|
||||
String[] days = {"Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"};
|
||||
boolean[] checked = new boolean[7];
|
||||
if (item.days != null) {
|
||||
if (item.days.contains("Seg")) checked[0] = true;
|
||||
if (item.days.contains("Ter")) checked[1] = true;
|
||||
if (item.days.contains("Qua")) checked[2] = true;
|
||||
if (item.days.contains("Qui")) checked[3] = true;
|
||||
if (item.days.contains("Sex")) checked[4] = true;
|
||||
if (item.days.contains("Sáb")) checked[5] = true;
|
||||
if (item.days.contains("Dom")) checked[6] = true;
|
||||
}
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("Escolher dias")
|
||||
.setMultiChoiceItems(days, checked, (dialog, which, isChecked) -> checked[which] = isChecked)
|
||||
.setPositiveButton("OK", (dialog, which) -> {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String[] shorts = {"Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Dom"};
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (checked[i]) {
|
||||
if (sb.length() > 0) sb.append(" • ");
|
||||
sb.append(shorts[i]);
|
||||
}
|
||||
}
|
||||
if (sb.length() == 0) sb.append("Nenhum dia");
|
||||
item.days = sb.toString();
|
||||
updateAlarmInFirestore(item);
|
||||
})
|
||||
.setNegativeButton("Cancelar", null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showChangeTimeDialog(AlarmItem item) {
|
||||
new android.app.TimePickerDialog(this, (view, hourOfDay, minute) -> {
|
||||
item.hour = hourOfDay;
|
||||
item.minute = minute;
|
||||
String details = item.time.contains("•") ? item.time.split("•")[1].trim() : "";
|
||||
item.time = String.format(java.util.Locale.getDefault(), "%02d:%02d • %s", hourOfDay, minute, details);
|
||||
item.time = String.format(Locale.getDefault(), "%02d:%02d • %s", hourOfDay, minute, details);
|
||||
updateAlarmInFirestore(item);
|
||||
scheduleAlarm(item, alarms.indexOf(item));
|
||||
}, item.hour, item.minute, true).show();
|
||||
@@ -657,64 +714,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
}).setNegativeButton("Cancelar", null).show();
|
||||
}
|
||||
|
||||
private void openRingtonePicker(AlarmItem item) {
|
||||
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Escolher toque para " + item.title);
|
||||
|
||||
Uri currentUri = item.ringtoneUri != null ? Uri.parse(item.ringtoneUri) : RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, currentUri);
|
||||
|
||||
startActivityForResult(intent, REQUEST_RINGTONE_PICKER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == REQUEST_RINGTONE_PICKER && resultCode == RESULT_OK && editingAlarmIndex != -1) {
|
||||
Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
|
||||
AlarmItem item = alarms.get(editingAlarmIndex);
|
||||
if (uri != null) {
|
||||
item.ringtoneUri = uri.toString();
|
||||
Ringtone ringtone = RingtoneManager.getRingtone(this, uri);
|
||||
item.ringtoneName = ringtone.getTitle(this);
|
||||
} else {
|
||||
item.ringtoneUri = null;
|
||||
item.ringtoneName = "Toque padrão do sistema";
|
||||
}
|
||||
updateAlarmInFirestore(item);
|
||||
scheduleAlarm(item, editingAlarmIndex);
|
||||
editingAlarmIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private Ringtone currentlyPlayingRingtone = null;
|
||||
|
||||
private void testRingtone(AlarmItem item) {
|
||||
if (currentlyPlayingRingtone != null && currentlyPlayingRingtone.isPlaying()) {
|
||||
currentlyPlayingRingtone.stop();
|
||||
currentlyPlayingRingtone = null;
|
||||
return;
|
||||
}
|
||||
Uri ringtoneUri = item.ringtoneUri != null ? Uri.parse(item.ringtoneUri) : RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
|
||||
try {
|
||||
currentlyPlayingRingtone = RingtoneManager.getRingtone(this, ringtoneUri);
|
||||
currentlyPlayingRingtone.play();
|
||||
new android.os.Handler().postDelayed(() -> {
|
||||
if (currentlyPlayingRingtone != null && currentlyPlayingRingtone.isPlaying()) {
|
||||
currentlyPlayingRingtone.stop();
|
||||
}
|
||||
}, 5000);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, "Erro ao reproduzir toque", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void scheduleAlarm(AlarmItem item, int alarmId) {
|
||||
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||
Intent intent = new Intent(this, AlarmReceiver.class);
|
||||
intent.putExtra("alarm_title", item.title);
|
||||
intent.putExtra("ringtone_uri", item.ringtoneUri);
|
||||
intent.putExtra("alarm_id", alarmId);
|
||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, alarmId, intent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<solid android:color="@color/white" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="#80FFFFFF" />
|
||||
android:color="#E0E0E0" />
|
||||
</shape>
|
||||
|
||||
|
||||
|
||||
@@ -1,74 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
android:height="108dp"
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
</vector>
|
||||
|
||||
@@ -1,30 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- Negative offsets zoom the image in beyond the bounds -->
|
||||
<item
|
||||
android:bottom="-15dp"
|
||||
android:left="-15dp"
|
||||
android:right="-15dp"
|
||||
android:top="-15dp">
|
||||
<bitmap
|
||||
android:src="@drawable/logo_bem"
|
||||
android:gravity="fill" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/primary" />
|
||||
<size
|
||||
android:width="100dp"
|
||||
android:height="100dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:bottom="20dp"
|
||||
android:left="20dp"
|
||||
android:right="20dp"
|
||||
android:top="20dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@android:color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
android:layout_marginTop="32dp"
|
||||
android:hint="Código de 6 dígitos"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:maxLength="8"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp" />
|
||||
|
||||
|
||||
@@ -2,109 +2,125 @@
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background_surface"
|
||||
android:background="@drawable/bg_login_gradient"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:padding="32dp">
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:src="@drawable/logo_bem_temp"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:src="@drawable/logo_bem"
|
||||
android:elevation="8dp"
|
||||
android:contentDescription="Logo Bem+" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Bem+"
|
||||
android:textColor="@color/primary"
|
||||
android:textSize="36sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/textStoredAccounts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:text="Cuidados de Saúde para Idosos"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="16sp" />
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="Contas Guardadas"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/storedAccountsContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textLoginType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="Login de Utilizador"
|
||||
android:text="Bem-vindo de volta"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="22sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEmail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_search"
|
||||
android:background="@drawable/bg_new_input"
|
||||
android:hint="Email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:padding="16dp"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="15sp" />
|
||||
android:textColorHint="@color/text_hint"
|
||||
android:textSize="15sp"
|
||||
android:elevation="2dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputPassword"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/bg_search"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_new_input"
|
||||
android:hint="Palavra-passe"
|
||||
android:inputType="textPassword"
|
||||
android:padding="16dp"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="15sp" />
|
||||
android:textColorHint="@color/text_hint"
|
||||
android:textSize="15sp"
|
||||
android:elevation="2dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/bg_search"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_new_input"
|
||||
android:hint="Nome completo"
|
||||
android:inputType="textPersonName"
|
||||
android:padding="16dp"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textColorHint="@color/text_hint"
|
||||
android:textSize="15sp"
|
||||
android:elevation="2dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputPhone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/bg_search"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_new_input"
|
||||
android:hint="Número de telemóvel (opcional)"
|
||||
android:inputType="phone"
|
||||
android:padding="16dp"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textColorHint="@color/text_hint"
|
||||
android:textSize="15sp"
|
||||
android:elevation="2dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textForgotPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:padding="8dp"
|
||||
android:text="Esqueci-me da palavra-passe"
|
||||
android:textColor="@color/primary"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
android:layout_gravity="end"
|
||||
android:text="Esqueceu-se da password?"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnLogin"
|
||||
@@ -117,30 +133,33 @@
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:elevation="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textSwitchMode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:padding="8dp"
|
||||
android:text="Não tem conta? Registar"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textColor="@color/primary_soft"
|
||||
android:textStyle="bold"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginVertical="24dp"
|
||||
android:background="@color/divider" />
|
||||
android:layout_marginVertical="32dp"
|
||||
android:background="#1A000000" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textSwitchToGuardian"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_guardian_chip"
|
||||
android:padding="12dp"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="12dp"
|
||||
android:text="🔒 Sou Responsável"
|
||||
android:textColor="@color/guardian_purple_end"
|
||||
android:textSize="14sp"
|
||||
|
||||
@@ -20,16 +20,19 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profileButton"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/bg_avatar"
|
||||
android:padding="12dp"
|
||||
android:src="@mipmap/ic_launcher_round"
|
||||
android:padding="10dp"
|
||||
android:cropToPadding="false"
|
||||
android:scaleType="fitCenter"
|
||||
android:elevation="8dp"
|
||||
android:src="@drawable/logo_bem"
|
||||
android:contentDescription="Perfil"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app.layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottomBar"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<ImageView
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@mipmap/ic_launcher_round"
|
||||
android:src="@drawable/logo_bem"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -2,94 +2,120 @@
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background_surface"
|
||||
android:background="@color/white_smoke"
|
||||
android:overScrollMode="never"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="100dp">
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingTop="32dp"
|
||||
android:paddingEnd="24dp">
|
||||
android:paddingBottom="100dp">
|
||||
|
||||
<LinearLayout
|
||||
<!-- Modern Header -->
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_header_gradient"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Bem+"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
android:background="@drawable/bg_header_gradient" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Alarmes personalizáveis e fáceis de gerir"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingTop="48dp"
|
||||
android:paddingBottom="24dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Alarmes de Saúde"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="20sp"
|
||||
android:text="Bem+"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="Os seus alarmes"
|
||||
android:textColor="@color/white"
|
||||
android:alpha="0.9"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAddAlarm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_new_button"
|
||||
android:paddingHorizontal="20dp"
|
||||
android:text="+ Novo"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="Gerencie as suas medicações"
|
||||
android:textColor="@color/white"
|
||||
android:alpha="0.7"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/alarmListContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp" />
|
||||
android:layout_marginTop="-30dp"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Action Row (Title + Button) -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="6dp"
|
||||
app:cardBackgroundColor="@color/white">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="Lista de Alarmes"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAddAlarm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/bg_new_button"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:text="+ Novo"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- List -->
|
||||
<LinearLayout
|
||||
android:id="@+id/alarmListContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
@@ -3,690 +3,208 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background_surface"
|
||||
android:background="@color/white"
|
||||
android:overScrollMode="never"
|
||||
android:paddingBottom="32dp">
|
||||
android:paddingBottom="80dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingTop="32dp"
|
||||
android:paddingEnd="24dp">
|
||||
android:padding="24dp">
|
||||
|
||||
<!-- Header: Minimalist Patient Info -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="32dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textPatientName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/theme_black_primary"
|
||||
android:textSize="22sp"
|
||||
android:fontFamily="sans-serif-medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textPatientStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Summary Status Section -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Estado Geral"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp"
|
||||
android:textAllCaps="true"
|
||||
android:letterSpacing="0.1"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/cardStatusDashboard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_guardian_card"
|
||||
android:backgroundTint="@color/theme_blue_bg"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp"
|
||||
android:layout_marginBottom="32dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iconStatus"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@android:drawable/checkbox_on_background"
|
||||
app:tint="@color/status_taken" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textStatusTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:text="Tudo em ordem"
|
||||
android:textColor="@color/theme_blue_primary"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="sans-serif-medium" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textStatusDesc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Bem+"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="Cuidados de Saúde para idosos"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="As medicações estão a ser tomadas conforme o planeado."
|
||||
android:textColor="@color/theme_blue_secondary"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
<!-- Adherence Timeline / Daily History -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Histórico de Hoje"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp"
|
||||
android:textAllCaps="true"
|
||||
android:letterSpacing="0.1"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/medicationStatusList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_guardian_hero"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
android:layout_marginBottom="32dp">
|
||||
<!-- Items like: [Med Name] - [Time] - [Check Mark] -->
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Next Medication Card - Simplified -->
|
||||
<LinearLayout
|
||||
android:id="@+id/cardNextMedication"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_guardian_card"
|
||||
android:backgroundTint="@color/theme_purple_bg"
|
||||
android:padding="20dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textNextTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="--:--"
|
||||
android:textColor="@color/theme_purple_primary"
|
||||
android:textSize="24sp"
|
||||
android:fontFamily="sans-serif-medium" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
<TextView
|
||||
android:id="@+id/textNextTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:text="Próxima Toma"
|
||||
android:textColor="@color/theme_purple_primary"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="sans-serif-medium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Controlo de Medicação"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="Monitorização para responsáveis"
|
||||
android:textColor="@color/reminder_info_bg"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:src="@android:drawable/ic_lock_lock"
|
||||
android:tint="@android:color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
<TextView
|
||||
android:id="@+id/textNextDetail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Tomados"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textTakenCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="0"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Pendentes"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textPendingCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="0"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Adesão"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textAdherenceRate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="0%"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
android:text=""
|
||||
android:textColor="@color/theme_purple_secondary"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- Managed Guardians Section -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Equipa de Cuidado"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp"
|
||||
android:textAllCaps="true"
|
||||
android:letterSpacing="0.1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnAddGuardian"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="+ Adicionar"
|
||||
android:textColor="@color/theme_blue_primary"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="sans-serif-medium" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/guardianListContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:src="@android:drawable/ic_menu_recent_history"
|
||||
android:tint="@color/neutral_dark" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="Status de hoje"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/statusContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Aspirina"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="09:00 • 100mg"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@drawable/bg_guardian_chip"
|
||||
android:paddingHorizontal="10dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:text="Pendente"
|
||||
android:textColor="@color/guardian_purple_end"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginVertical="12dp"
|
||||
android:background="@color/guardian_card_border" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Vitamina D"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="14:00 • 1 comprimido"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@drawable/bg_guardian_chip"
|
||||
android:paddingHorizontal="10dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:text="Pendente"
|
||||
android:textColor="@color/guardian_purple_end"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginVertical="12dp"
|
||||
android:background="@color/guardian_card_border" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Ómega 3"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="21:00 • 1 cápsula"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@drawable/bg_guardian_chip"
|
||||
android:paddingHorizontal="10dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:text="Pendente"
|
||||
android:textColor="@color/guardian_purple_end"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!-- Dynamic Guardian Items -->
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_guardian_card"
|
||||
android:padding="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<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="Última semana"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="Resumo de adesão"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@android:drawable/ic_menu_week"
|
||||
android:tint="@color/neutral_medium" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_guardian_chip"
|
||||
android:orientation="vertical"
|
||||
android:padding="14dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Medicamentos tomados"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="0"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="de 21 esperados"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_guardian_chip"
|
||||
android:orientation="vertical"
|
||||
android:padding="14dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Taxa de adesão"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="0%"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="últimos 7 dias"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_guardian_card"
|
||||
android:orientation="vertical"
|
||||
android:padding="18dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Medicamentos"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_new_button"
|
||||
android:paddingHorizontal="18dp"
|
||||
android:text="+ Adicionar"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<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="Aspirina"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="09:00 • 100mg"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@android:drawable/ic_delete"
|
||||
android:tint="@color/delete" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/guardian_card_border" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<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="Vitamina D"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="14:00 • 1 comprimido"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@android:drawable/ic_delete"
|
||||
android:tint="@color/delete" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/guardian_card_border" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<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="Ómega 3"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="21:00 • 1 cápsula"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@android:drawable/ic_delete"
|
||||
android:tint="@color/delete" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_guardian_card"
|
||||
android:orientation="vertical"
|
||||
android:padding="18dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Responsáveis"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_new_button"
|
||||
android:paddingHorizontal="18dp"
|
||||
android:text="+ Adicionar"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:background="@drawable/bg_reminder_info_card"
|
||||
android:orientation="vertical"
|
||||
android:padding="14dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<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="Maria Silva"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Filha"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@android:drawable/ic_delete"
|
||||
android:tint="@color/delete" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="+351 912 345 678"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="maria.silva@email.com"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
|
||||
@@ -3,207 +3,295 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background_surface"
|
||||
android:background="@color/white_smoke"
|
||||
android:overScrollMode="never"
|
||||
android:paddingBottom="32dp">
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingTop="32dp"
|
||||
android:paddingEnd="24dp">
|
||||
android:paddingBottom="32dp">
|
||||
|
||||
<LinearLayout
|
||||
<!-- Modern Header with Weather -->
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_header_gradient"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- Gradient Background -->
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="220dp"
|
||||
android:background="@drawable/bg_header_gradient" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingTop="48dp"
|
||||
android:paddingBottom="24dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<!-- Top Row: Logo/Title -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Bem+"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Bem+"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textGreeting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Bom dia"
|
||||
android:textColor="@color/white"
|
||||
android:alpha="0.9"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="Cuidados de Saúde para idosos"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
android:text="O seu assistente diário"
|
||||
android:textColor="@color/white"
|
||||
android:alpha="0.8"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<!-- Weather Card -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="8dp"
|
||||
app:cardBackgroundColor="@color/white">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textTemperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="--°C"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="36sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textCondition"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:src="@android:drawable/ic_menu_mylocation"
|
||||
android:tint="@color/primary"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textLocation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="Localização"
|
||||
android:textColor="@color/primary"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageWeatherIcon"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@android:drawable/ic_menu_view"
|
||||
android:tint="@color/accent"
|
||||
android:alpha="0.8"/>
|
||||
<!-- Placeholder icon, logic can swap this drawable or hide tint if real image -->
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<!-- Content Area -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_reminder_hero"
|
||||
android:minHeight="140dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="Sugestões do Dia"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
<!-- Daily Tip 1 -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardBackgroundColor="@color/white">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Bom dia"
|
||||
android:textColor="@color/background_surface"
|
||||
android:textSize="14sp" />
|
||||
<View
|
||||
android:layout_width="4dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/bg_pill_accent"
|
||||
android:backgroundTint="@color/accent"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lembretes Inteligentes"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="Portugal • 22°C • Ensolarado"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
<TextView
|
||||
android:id="@+id/textTipTitle1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Clima"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textTipDesc1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text=""
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:lineSpacingExtra="2dp"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@android:drawable/ic_menu_my_calendar"
|
||||
android:tint="@color/primary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="Dicas para hoje"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<!-- Daily Tip 2 -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/bg_reminder_card"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardBackgroundColor="@color/white">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Dia Perfeito"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="Tempo ideal. Faça uma caminhada no parque."
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="4dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/bg_pill_accent"
|
||||
android:backgroundTint="@color/primary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textTipTitle2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Saúde"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textTipDesc2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="Mantenha-se hidratado."
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:lineSpacingExtra="2dp"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- Default "Safe" Message -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_reminder_card"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Ar Fresco"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="Abra as janelas para arejar a casa."
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="13sp" />
|
||||
android:text="Tenha um excelente dia!"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_hint"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_reminder_card"
|
||||
android:gravity="center_horizontal"
|
||||
android:minHeight="120dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:src="@android:drawable/ic_menu_gallery"
|
||||
android:tint="@color/primary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="Sem lembretes urgentes"
|
||||
android:textColor="@color/neutral_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android.layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="Relaxe e aproveite o dia"
|
||||
android:textColor="@color/neutral_medium"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 19 KiB |
@@ -3,21 +3,53 @@
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
|
||||
<color name="primary">#00B894</color>
|
||||
<color name="accent">#5FE0C5</color>
|
||||
<color name="primary_light_bg">#E6F8F5</color>
|
||||
<color name="primary">#48C090</color> <!-- Soft Green from logo -->
|
||||
<color name="primary_dark">#2E7D5E</color>
|
||||
<color name="accent">#FFAB73</color> <!-- Soft Orange from logo -->
|
||||
|
||||
<color name="primary_light_bg">#F2FCF8</color>
|
||||
<color name="primary_light">#B6E6D2</color>
|
||||
<color name="neutral_dark">#1E2A28</color>
|
||||
<color name="neutral_medium">#5E7671</color>
|
||||
<color name="background_surface">#EEFFF7</color>
|
||||
<color name="divider">#D7E8E1</color>
|
||||
<color name="background_surface">#F5FAF8</color>
|
||||
<color name="divider">#E8F2ED</color>
|
||||
|
||||
<color name="card_shadow">#14000000</color>
|
||||
<color name="delete">#FF6F6F</color>
|
||||
<color name="reminder_blue_start">#00C7FF</color>
|
||||
<color name="reminder_blue_end">#0084FF</color>
|
||||
<color name="reminder_card_border">#D2E5FA</color>
|
||||
<color name="reminder_info_bg">#EAF4FF</color>
|
||||
<color name="guardian_purple_start">#B968FF</color>
|
||||
<color name="guardian_purple_end">#7A55FF</color>
|
||||
<color name="guardian_card_border">#E4D8FF</color>
|
||||
<color name="guardian_chip_bg">#F9F2FF</color>
|
||||
|
||||
<color name="reminder_blue_start">#48C090</color>
|
||||
<color name="reminder_blue_end">#81D4B3</color>
|
||||
<color name="reminder_card_border">#D6F2E5</color>
|
||||
<color name="reminder_info_bg">#F2FCF8</color>
|
||||
|
||||
<color name="guardian_purple_start">#FFAB73</color>
|
||||
<color name="guardian_purple_end">#FFCBA6</color>
|
||||
<color name="guardian_card_border">#FFE5D3</color>
|
||||
<color name="guardian_chip_bg">#FFF4EB</color>
|
||||
|
||||
<!-- Redesign Colors -->
|
||||
<color name="login_bg_start">#FFAB73</color> <!-- Orange Start -->
|
||||
<color name="login_bg_end">#48C090</color> <!-- Green End -->
|
||||
<color name="primary_soft">#81D4B3</color>
|
||||
<color name="text_hint">#90A4AE</color>
|
||||
<color name="white_smoke">#F5F5F5</color>
|
||||
|
||||
<!-- Theme: Dark Blue (Minimalist) -->
|
||||
<color name="theme_blue_primary">#1A237E</color>
|
||||
<color name="theme_blue_secondary">#3F51B5</color>
|
||||
<color name="theme_blue_bg">#E8EAF6</color>
|
||||
|
||||
<!-- Theme: Purple (Modern) -->
|
||||
<color name="theme_purple_primary">#4A148C</color>
|
||||
<color name="theme_purple_secondary">#7B1FA2</color>
|
||||
<color name="theme_purple_bg">#F3E5F5</color>
|
||||
|
||||
<!-- Theme: Black (Sleek) -->
|
||||
<color name="theme_black_primary">#212121</color>
|
||||
<color name="theme_black_secondary">#424242</color>
|
||||
<color name="theme_black_bg">#FAFAFA</color>
|
||||
|
||||
<color name="status_taken">#4CAF50</color>
|
||||
<color name="status_pending">#FFC107</color>
|
||||
<color name="status_missed">#F44336</color>
|
||||
</resources>
|
||||
@@ -9,6 +9,10 @@ activity = "1.11.0"
|
||||
constraintlayout = "2.2.1"
|
||||
firebaseAuth = "24.0.1"
|
||||
|
||||
retrofit = "2.9.0"
|
||||
gson = "2.10.1"
|
||||
playServicesLocation = "21.0.1"
|
||||
|
||||
[libraries]
|
||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||
@@ -18,6 +22,10 @@ material = { group = "com.google.android.material", name = "material", version.r
|
||||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||
firebase-auth = { group = "com.google.firebase", name = "firebase-auth", version.ref = "firebaseAuth" }
|
||||
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
|
||||
converter-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" }
|
||||
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
||||
play-services-location = { group = "com.google.android.gms", name = "play-services-location", version.ref = "playServicesLocation" }
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
|
||||