refactor: Update settings UI to use color resources and refine MaterialCardView styling.
This commit is contained in:
@@ -55,17 +55,17 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
private Button btnLogout;
|
private Button btnLogout;
|
||||||
private View btnChangePhoto;
|
private View btnChangePhoto;
|
||||||
private View cardImageContainer;
|
private View cardImageContainer;
|
||||||
|
|
||||||
private FirebaseAuth mAuth;
|
private FirebaseAuth mAuth;
|
||||||
private FirebaseStorage mStorage;
|
private FirebaseStorage mStorage;
|
||||||
private StorageReference storageRef;
|
private StorageReference storageRef;
|
||||||
private ProgressDialog progressDialog;
|
private ProgressDialog progressDialog;
|
||||||
|
|
||||||
private ActivityResultLauncher<Intent> imagePickerLauncher;
|
private ActivityResultLauncher<Intent> imagePickerLauncher;
|
||||||
private ActivityResultLauncher<String> permissionLauncher;
|
private ActivityResultLauncher<String> permissionLauncher;
|
||||||
private Uri selectedImageUri;
|
private Uri selectedImageUri;
|
||||||
private String imageUrlFromGoogle;
|
private String imageUrlFromGoogle;
|
||||||
|
|
||||||
private static final String PREFS_NAME = "LoginPrefs";
|
private static final String PREFS_NAME = "LoginPrefs";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,7 +73,7 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
EdgeToEdge.enable(this);
|
EdgeToEdge.enable(this);
|
||||||
setContentView(R.layout.activity_conta);
|
setContentView(R.layout.activity_conta);
|
||||||
|
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
@@ -99,18 +99,31 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
imageProfile = findViewById(R.id.imageProfile);
|
imageProfile = findViewById(R.id.imageProfile);
|
||||||
editName = findViewById(R.id.editName);
|
editName = findViewById(R.id.editName);
|
||||||
editImageUrl = findViewById(R.id.editImageUrl);
|
editImageUrl = findViewById(R.id.editImageUrl);
|
||||||
|
// textEmail removed from class fields if not used, or kept if used.
|
||||||
|
// In XML it is present as @+id/textEmail inside cardSecurity.
|
||||||
textEmail = findViewById(R.id.textEmail);
|
textEmail = findViewById(R.id.textEmail);
|
||||||
|
|
||||||
btnSaveAll = findViewById(R.id.btnSaveAll);
|
btnSaveAll = findViewById(R.id.btnSaveAll);
|
||||||
btnLoadImageUrl = findViewById(R.id.btnLoadImageUrl);
|
btnLoadImageUrl = findViewById(R.id.btnLoadImageUrl);
|
||||||
btnChangeEmail = findViewById(R.id.btnChangeEmail);
|
btnChangeEmail = findViewById(R.id.btnChangeEmail);
|
||||||
btnChangePassword = findViewById(R.id.btnChangePassword);
|
btnChangePassword = findViewById(R.id.btnChangePassword);
|
||||||
btnLogout = findViewById(R.id.btnLogout);
|
btnLogout = findViewById(R.id.btnLogout);
|
||||||
btnChangePhoto = findViewById(R.id.btnChangePhoto);
|
|
||||||
|
// New FAB for editing photo
|
||||||
|
btnChangePhoto = findViewById(R.id.fabEditPhoto);
|
||||||
|
// Also allow clicking the text
|
||||||
|
View btnChangePhotoText = findViewById(R.id.btnChangePhoto);
|
||||||
|
|
||||||
cardImageContainer = findViewById(R.id.cardImageContainer);
|
cardImageContainer = findViewById(R.id.cardImageContainer);
|
||||||
|
|
||||||
progressDialog = new ProgressDialog(this);
|
progressDialog = new ProgressDialog(this);
|
||||||
progressDialog.setMessage("A processar...");
|
progressDialog.setMessage("A processar...");
|
||||||
progressDialog.setCancelable(false);
|
progressDialog.setCancelable(false);
|
||||||
|
|
||||||
|
// Setup listeners here or in setupListeners()
|
||||||
|
if (btnChangePhotoText != null) {
|
||||||
|
btnChangePhotoText.setOnClickListener(v -> openImagePicker());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initFirebase() {
|
private void initFirebase() {
|
||||||
@@ -121,43 +134,42 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void setupImagePicker() {
|
private void setupImagePicker() {
|
||||||
imagePickerLauncher = registerForActivityResult(
|
imagePickerLauncher = registerForActivityResult(
|
||||||
new ActivityResultContracts.StartActivityForResult(),
|
new ActivityResultContracts.StartActivityForResult(),
|
||||||
result -> {
|
result -> {
|
||||||
if (result.getResultCode() == RESULT_OK && result.getData() != null) {
|
if (result.getResultCode() == RESULT_OK && result.getData() != null) {
|
||||||
selectedImageUri = result.getData().getData();
|
selectedImageUri = result.getData().getData();
|
||||||
if (selectedImageUri != null) {
|
if (selectedImageUri != null) {
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = getContentResolver().openInputStream(selectedImageUri);
|
InputStream inputStream = getContentResolver().openInputStream(selectedImageUri);
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
|
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
if (bitmap != null) {
|
if (bitmap != null) {
|
||||||
imageProfile.setImageBitmap(bitmap);
|
imageProfile.setImageBitmap(bitmap);
|
||||||
uploadProfileImage();
|
uploadProfileImage();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, "Erro ao carregar imagem", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Erro ao carregar imagem", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toast.makeText(this, "Erro ao carregar imagem: " + e.getMessage(), Toast.LENGTH_SHORT)
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
Toast.makeText(this, "Erro ao carregar imagem: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupPermissionLauncher() {
|
private void setupPermissionLauncher() {
|
||||||
permissionLauncher = registerForActivityResult(
|
permissionLauncher = registerForActivityResult(
|
||||||
new ActivityResultContracts.RequestPermission(),
|
new ActivityResultContracts.RequestPermission(),
|
||||||
isGranted -> {
|
isGranted -> {
|
||||||
if (isGranted) {
|
if (isGranted) {
|
||||||
openImagePicker();
|
openImagePicker();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, "Permissão necessária para selecionar imagem", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Permissão necessária para selecionar imagem", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadUserData() {
|
private void loadUserData() {
|
||||||
@@ -167,12 +179,12 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
if (textEmail != null) {
|
if (textEmail != null) {
|
||||||
textEmail.setText(user.getEmail() != null ? user.getEmail() : "");
|
textEmail.setText(user.getEmail() != null ? user.getEmail() : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carregar nome
|
// Carregar nome
|
||||||
if (editName != null && user.getDisplayName() != null && !user.getDisplayName().isEmpty()) {
|
if (editName != null && user.getDisplayName() != null && !user.getDisplayName().isEmpty()) {
|
||||||
editName.setText(user.getDisplayName());
|
editName.setText(user.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carregar foto de perfil
|
// Carregar foto de perfil
|
||||||
if (user.getPhotoUrl() != null) {
|
if (user.getPhotoUrl() != null) {
|
||||||
loadProfileImage(user.getPhotoUrl().toString());
|
loadProfileImage(user.getPhotoUrl().toString());
|
||||||
@@ -217,8 +229,9 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void loadProfileImageFromStorage() {
|
private void loadProfileImageFromStorage() {
|
||||||
FirebaseUser user = mAuth.getCurrentUser();
|
FirebaseUser user = mAuth.getCurrentUser();
|
||||||
if (user == null) return;
|
if (user == null)
|
||||||
|
return;
|
||||||
|
|
||||||
StorageReference profileImageRef = storageRef.child("profile_images/" + user.getUid() + ".jpg");
|
StorageReference profileImageRef = storageRef.child("profile_images/" + user.getUid() + ".jpg");
|
||||||
profileImageRef.getDownloadUrl().addOnSuccessListener(uri -> {
|
profileImageRef.getDownloadUrl().addOnSuccessListener(uri -> {
|
||||||
loadProfileImage(uri.toString());
|
loadProfileImage(uri.toString());
|
||||||
@@ -267,22 +280,23 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadImageFromUrl() {
|
private void loadImageFromUrl() {
|
||||||
if (editImageUrl == null) return;
|
if (editImageUrl == null)
|
||||||
|
return;
|
||||||
|
|
||||||
String imageUrl = editImageUrl.getText().toString().trim();
|
String imageUrl = editImageUrl.getText().toString().trim();
|
||||||
|
|
||||||
if (imageUrl.isEmpty()) {
|
if (imageUrl.isEmpty()) {
|
||||||
Toast.makeText(this, "Por favor, insira uma URL válida", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Por favor, insira uma URL válida", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!imageUrl.startsWith("http://") && !imageUrl.startsWith("https://")) {
|
if (!imageUrl.startsWith("http://") && !imageUrl.startsWith("https://")) {
|
||||||
Toast.makeText(this, "URL inválida. Deve começar com http:// ou https://", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "URL inválida. Deve começar com http:// ou https://", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
|
|
||||||
// Carregar imagem da URL
|
// Carregar imagem da URL
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
@@ -292,7 +306,7 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
connection.connect();
|
connection.connect();
|
||||||
InputStream input = connection.getInputStream();
|
InputStream input = connection.getInputStream();
|
||||||
Bitmap bitmap = BitmapFactory.decodeStream(input);
|
Bitmap bitmap = BitmapFactory.decodeStream(input);
|
||||||
|
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
if (bitmap != null && imageProfile != null) {
|
if (bitmap != null && imageProfile != null) {
|
||||||
@@ -305,7 +319,7 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
Toast.makeText(this, "Erro ao carregar imagem da URL", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Erro ao carregar imagem da URL", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
@@ -317,19 +331,20 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProfileWithImageUrl(String imageUrl) {
|
private void updateProfileWithImageUrl(String imageUrl) {
|
||||||
FirebaseUser user = mAuth.getCurrentUser();
|
FirebaseUser user = mAuth.getCurrentUser();
|
||||||
if (user == null) return;
|
if (user == null)
|
||||||
|
return;
|
||||||
|
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Uri imageUri = Uri.parse(imageUrl);
|
Uri imageUri = Uri.parse(imageUrl);
|
||||||
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
|
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
|
||||||
.setPhotoUri(imageUri)
|
.setPhotoUri(imageUri)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
user.updateProfile(profileUpdates).addOnCompleteListener(task -> {
|
user.updateProfile(profileUpdates).addOnCompleteListener(task -> {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
if (task.isSuccessful()) {
|
if (task.isSuccessful()) {
|
||||||
@@ -337,8 +352,8 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
editImageUrl.setText("");
|
editImageUrl.setText("");
|
||||||
loadProfileImage(imageUrl);
|
loadProfileImage(imageUrl);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, "Erro ao atualizar foto: " +
|
Toast.makeText(this, "Erro ao atualizar foto: " +
|
||||||
(task.getException() != null ? task.getException().getMessage() : "Erro desconhecido"),
|
(task.getException() != null ? task.getException().getMessage() : "Erro desconhecido"),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -349,13 +364,15 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void uploadProfileImage() {
|
private void uploadProfileImage() {
|
||||||
if (selectedImageUri == null) return;
|
if (selectedImageUri == null)
|
||||||
|
return;
|
||||||
|
|
||||||
FirebaseUser user = mAuth.getCurrentUser();
|
FirebaseUser user = mAuth.getCurrentUser();
|
||||||
if (user == null) return;
|
if (user == null)
|
||||||
|
return;
|
||||||
|
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
|
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
try {
|
try {
|
||||||
inputStream = getContentResolver().openInputStream(selectedImageUri);
|
inputStream = getContentResolver().openInputStream(selectedImageUri);
|
||||||
@@ -364,14 +381,14 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
Toast.makeText(this, "Erro ao abrir imagem", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Erro ao abrir imagem", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
|
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
Toast.makeText(this, "Erro ao processar imagem", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Erro ao processar imagem", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redimensionar se muito grande
|
// Redimensionar se muito grande
|
||||||
int maxSize = 1024;
|
int maxSize = 1024;
|
||||||
if (bitmap.getWidth() > maxSize || bitmap.getHeight() > maxSize) {
|
if (bitmap.getWidth() > maxSize || bitmap.getHeight() > maxSize) {
|
||||||
@@ -380,29 +397,30 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
int newHeight = Math.round(bitmap.getHeight() * scale);
|
int newHeight = Math.round(bitmap.getHeight() * scale);
|
||||||
bitmap = Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, true);
|
bitmap = Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, baos);
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, baos);
|
||||||
byte[] imageData = baos.toByteArray();
|
byte[] imageData = baos.toByteArray();
|
||||||
|
|
||||||
// Upload para Firebase Storage
|
// Upload para Firebase Storage
|
||||||
StorageReference profileImageRef = storageRef.child("profile_images/" + user.getUid() + ".jpg");
|
StorageReference profileImageRef = storageRef.child("profile_images/" + user.getUid() + ".jpg");
|
||||||
UploadTask uploadTask = profileImageRef.putBytes(imageData);
|
UploadTask uploadTask = profileImageRef.putBytes(imageData);
|
||||||
|
|
||||||
uploadTask.addOnSuccessListener(taskSnapshot -> {
|
uploadTask.addOnSuccessListener(taskSnapshot -> {
|
||||||
profileImageRef.getDownloadUrl().addOnSuccessListener(uri -> {
|
profileImageRef.getDownloadUrl().addOnSuccessListener(uri -> {
|
||||||
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
|
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
|
||||||
.setPhotoUri(uri)
|
.setPhotoUri(uri)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
user.updateProfile(profileUpdates).addOnCompleteListener(task -> {
|
user.updateProfile(profileUpdates).addOnCompleteListener(task -> {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
if (task.isSuccessful()) {
|
if (task.isSuccessful()) {
|
||||||
Toast.makeText(this, "Foto de perfil atualizada com sucesso!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Foto de perfil atualizada com sucesso!", Toast.LENGTH_SHORT).show();
|
||||||
loadProfileImage(uri.toString());
|
loadProfileImage(uri.toString());
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, "Erro ao atualizar foto: " +
|
Toast.makeText(this, "Erro ao atualizar foto: " +
|
||||||
(task.getException() != null ? task.getException().getMessage() : "Erro desconhecido"),
|
(task.getException() != null ? task.getException().getMessage()
|
||||||
|
: "Erro desconhecido"),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -414,7 +432,7 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
Toast.makeText(this, "Erro ao fazer upload: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Erro ao fazer upload: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
Toast.makeText(this, "Erro ao processar imagem: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Erro ao processar imagem: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
@@ -430,53 +448,54 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveAllChanges() {
|
private void saveAllChanges() {
|
||||||
if (editName == null) return;
|
if (editName == null)
|
||||||
|
return;
|
||||||
|
|
||||||
String newName = editName.getText().toString().trim();
|
String newName = editName.getText().toString().trim();
|
||||||
|
|
||||||
if (newName.isEmpty()) {
|
if (newName.isEmpty()) {
|
||||||
Toast.makeText(this, "Por favor, insira um nome", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Por favor, insira um nome", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FirebaseUser user = mAuth.getCurrentUser();
|
FirebaseUser user = mAuth.getCurrentUser();
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
Toast.makeText(this, "Utilizador não autenticado", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Utilizador não autenticado", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
|
|
||||||
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
|
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
|
||||||
.setDisplayName(newName)
|
.setDisplayName(newName)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
user.updateProfile(profileUpdates).addOnCompleteListener(task -> {
|
user.updateProfile(profileUpdates).addOnCompleteListener(task -> {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
if (task.isSuccessful()) {
|
if (task.isSuccessful()) {
|
||||||
Toast.makeText(this, "Alterações guardadas com sucesso!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Alterações guardadas com sucesso!", Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, "Erro ao guardar alterações: " +
|
Toast.makeText(this, "Erro ao guardar alterações: " +
|
||||||
(task.getException() != null ? task.getException().getMessage() : "Erro desconhecido"),
|
(task.getException() != null ? task.getException().getMessage() : "Erro desconhecido"),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendPasswordResetEmail() {
|
private void sendPasswordResetEmail() {
|
||||||
FirebaseUser user = mAuth.getCurrentUser();
|
FirebaseUser user = mAuth.getCurrentUser();
|
||||||
if (user == null || user.getEmail() == null) {
|
if (user == null || user.getEmail() == null) {
|
||||||
Toast.makeText(this, "Utilizador não autenticado", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Utilizador não autenticado", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
|
|
||||||
mAuth.sendPasswordResetEmail(user.getEmail())
|
mAuth.sendPasswordResetEmail(user.getEmail())
|
||||||
.addOnCompleteListener(task -> {
|
.addOnCompleteListener(task -> {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
if (task.isSuccessful()) {
|
if (task.isSuccessful()) {
|
||||||
Toast.makeText(this,
|
Toast.makeText(this,
|
||||||
"Email de alteração de password enviado! Verifique a sua caixa de entrada.",
|
"Email de alteração de password enviado! Verifique a sua caixa de entrada.",
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
@@ -488,36 +507,38 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendEmailVerificationForEmailChange() {
|
private void sendEmailVerificationForEmailChange() {
|
||||||
FirebaseUser user = mAuth.getCurrentUser();
|
FirebaseUser user = mAuth.getCurrentUser();
|
||||||
if (user == null || user.getEmail() == null) {
|
if (user == null || user.getEmail() == null) {
|
||||||
Toast.makeText(this, "Utilizador não autenticado", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Utilizador não autenticado", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
|
|
||||||
// Enviar email de verificação para alterar email
|
// Enviar email de verificação para alterar email
|
||||||
user.sendEmailVerification()
|
user.sendEmailVerification()
|
||||||
.addOnCompleteListener(task -> {
|
.addOnCompleteListener(task -> {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
if (task.isSuccessful()) {
|
if (task.isSuccessful()) {
|
||||||
Toast.makeText(this,
|
Toast.makeText(this,
|
||||||
"Email de verificação enviado! Verifique a sua caixa de entrada para alterar o email.",
|
"Email de verificação enviado! Verifique a sua caixa de entrada para alterar o email.",
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
// Se não conseguir enviar email de verificação, enviar email de reset de password
|
// Se não conseguir enviar email de verificação, enviar email de reset de
|
||||||
|
// password
|
||||||
// que pode ser usado para alterar o email através do Firebase Console
|
// que pode ser usado para alterar o email através do Firebase Console
|
||||||
mAuth.sendPasswordResetEmail(user.getEmail())
|
mAuth.sendPasswordResetEmail(user.getEmail())
|
||||||
.addOnCompleteListener(resetTask -> {
|
.addOnCompleteListener(resetTask -> {
|
||||||
if (resetTask.isSuccessful()) {
|
if (resetTask.isSuccessful()) {
|
||||||
Toast.makeText(this,
|
Toast.makeText(this,
|
||||||
"Email enviado! Verifique a sua caixa de entrada para instruções de alteração.",
|
"Email enviado! Verifique a sua caixa de entrada para instruções de alteração.",
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
String errorMessage = "Erro ao enviar email!";
|
String errorMessage = "Erro ao enviar email!";
|
||||||
if (resetTask.getException() != null && resetTask.getException().getMessage() != null) {
|
if (resetTask.getException() != null
|
||||||
|
&& resetTask.getException().getMessage() != null) {
|
||||||
errorMessage = "Erro: " + resetTask.getException().getMessage();
|
errorMessage = "Erro: " + resetTask.getException().getMessage();
|
||||||
}
|
}
|
||||||
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
|
||||||
@@ -526,7 +547,7 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showLogoutConfirmation() {
|
private void showLogoutConfirmation() {
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
.setTitle("Terminar Sessão")
|
.setTitle("Terminar Sessão")
|
||||||
@@ -535,19 +556,19 @@ public class ContaActivity extends AppCompatActivity {
|
|||||||
.setNegativeButton("Cancelar", null)
|
.setNegativeButton("Cancelar", null)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logoutUser() {
|
private void logoutUser() {
|
||||||
// Limpar credenciais guardadas
|
// Limpar credenciais guardadas
|
||||||
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
editor.clear();
|
editor.clear();
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
|
||||||
// Fazer logout do Firebase
|
// Fazer logout do Firebase
|
||||||
mAuth.signOut();
|
mAuth.signOut();
|
||||||
|
|
||||||
Toast.makeText(this, "Sessão terminada", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Sessão terminada", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
// Voltar para o login
|
// Voltar para o login
|
||||||
Intent intent = new Intent(ContaActivity.this, LoginActivity.class);
|
Intent intent = new Intent(ContaActivity.this, LoginActivity.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
android:id="@+id/main"
|
android:id="@+id/main"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#F5F5F5"
|
android:background="@color/background_light"
|
||||||
tools:context=".ui.definicoes.ContaActivity">
|
tools:context=".ui.definicoes.ContaActivity">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
@@ -20,11 +20,11 @@
|
|||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="#FFFFFF"
|
android:background="@color/primary_color"
|
||||||
app:title="Definições de Conta"
|
app:title="Definições de Conta"
|
||||||
app:titleTextColor="#212121"
|
app:titleTextColor="@color/white"
|
||||||
app:navigationIcon="@drawable/ic_arrow_back"
|
app:navigationIcon="@drawable/ic_arrow_back"
|
||||||
app:navigationIconTint="#212121" />
|
app:navigationIconTint="@color/white" />
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
@@ -45,10 +45,10 @@
|
|||||||
android:id="@+id/cardProfilePhoto"
|
android:id="@+id/cardProfilePhoto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="20dp"
|
||||||
app:cardCornerRadius="20dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="4dp"
|
app:cardElevation="2dp"
|
||||||
app:cardBackgroundColor="#FFFFFF"
|
app:cardBackgroundColor="@color/surface_card"
|
||||||
app:strokeWidth="0dp">
|
app:strokeWidth="0dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -64,56 +64,61 @@
|
|||||||
android:text="Foto de Perfil"
|
android:text="Foto de Perfil"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="#1A1A1A"
|
android:textColor="@color/primary_color"
|
||||||
android:layout_marginBottom="20dp" />
|
android:layout_marginBottom="24dp" />
|
||||||
|
|
||||||
<!-- Profile Image -->
|
<!-- Profile Image -->
|
||||||
<com.google.android.material.card.MaterialCardView
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/cardImageContainer"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="120dp"
|
android:layout_height="wrap_content">
|
||||||
android:layout_height="120dp"
|
|
||||||
app:cardCornerRadius="60dp"
|
<com.google.android.material.card.MaterialCardView
|
||||||
app:cardElevation="6dp"
|
android:id="@+id/cardImageContainer"
|
||||||
app:cardBackgroundColor="#FFFFFF"
|
android:layout_width="120dp"
|
||||||
android:clickable="true"
|
android:layout_height="120dp"
|
||||||
android:focusable="true"
|
app:cardCornerRadius="60dp"
|
||||||
android:foreground="?attr/selectableItemBackgroundBorderless">
|
app:cardElevation="6dp"
|
||||||
|
app:cardBackgroundColor="#FFFFFF"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:foreground="?attr/selectableItemBackgroundBorderless">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageProfile"
|
android:id="@+id/imageProfile"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:contentDescription="Foto de perfil"
|
android:contentDescription="Foto de perfil"
|
||||||
android:src="@android:drawable/ic_menu_camera"
|
android:src="@android:drawable/ic_menu_camera"
|
||||||
android:background="#E0E0E0" />
|
android:background="#E0E0E0" />
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<!-- Edit Icon Overlay -->
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
<ImageView
|
android:id="@+id/fabEditPhoto"
|
||||||
android:id="@+id/iconEditPhoto"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="36dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="36dp"
|
app:fabSize="mini"
|
||||||
android:layout_gravity="bottom|end"
|
app:backgroundTint="@color/secondary_color"
|
||||||
android:layout_margin="8dp"
|
app:tint="@color/white"
|
||||||
android:src="@android:drawable/ic_menu_edit"
|
android:src="@android:drawable/ic_menu_edit"
|
||||||
android:background="@drawable/circle_edit_background"
|
app:layout_constraintBottom_toBottomOf="@+id/cardImageContainer"
|
||||||
android:padding="8dp"
|
app:layout_constraintEnd_toEndOf="@+id/cardImageContainer"/>
|
||||||
android:contentDescription="Editar foto" />
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/btnChangePhoto"
|
android:id="@+id/btnChangePhoto"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="Alterar Foto (Galeria)"
|
android:text="Toque para alterar"
|
||||||
android:textColor="#616161"
|
android:textColor="@color/text_secondary"
|
||||||
android:textSize="15sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:padding="12dp"
|
android:padding="8dp"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||||
|
|
||||||
<!-- URL Input Section -->
|
<!-- URL Input Section -->
|
||||||
@@ -127,9 +132,9 @@
|
|||||||
app:boxCornerRadiusBottomStart="12dp"
|
app:boxCornerRadiusBottomStart="12dp"
|
||||||
app:boxCornerRadiusBottomEnd="12dp"
|
app:boxCornerRadiusBottomEnd="12dp"
|
||||||
app:boxStrokeWidth="1dp"
|
app:boxStrokeWidth="1dp"
|
||||||
app:boxStrokeColor="#BDBDBD"
|
app:boxStrokeColor="@color/divider"
|
||||||
app:startIconDrawable="@android:drawable/ic_menu_view"
|
app:startIconDrawable="@android:drawable/ic_menu_view"
|
||||||
app:startIconTint="#616161"
|
app:startIconTint="@color/text_secondary"
|
||||||
app:boxBackgroundMode="outline"
|
app:boxBackgroundMode="outline"
|
||||||
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
|
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
|
||||||
|
|
||||||
@@ -138,8 +143,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="textUri"
|
android:inputType="textUri"
|
||||||
android:textColor="#212121"
|
android:textColor="@color/text_primary"
|
||||||
android:textColorHint="#9E9E9E"
|
android:textColorHint="@color/text_secondary"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:padding="14dp"
|
android:padding="14dp"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
@@ -150,15 +155,13 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnLoadImageUrl"
|
android:id="@+id/btnLoadImageUrl"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:backgroundTint="#616161"
|
android:backgroundTint="@color/primary_light"
|
||||||
android:text="Carregar Imagem da URL"
|
android:text="Carregar Imagem da URL"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold" />
|
||||||
android:elevation="2dp"
|
|
||||||
android:stateListAnimator="@null" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -169,10 +172,10 @@
|
|||||||
android:id="@+id/cardName"
|
android:id="@+id/cardName"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="20dp"
|
||||||
app:cardCornerRadius="20dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="4dp"
|
app:cardElevation="2dp"
|
||||||
app:cardBackgroundColor="#FFFFFF"
|
app:cardBackgroundColor="@color/surface_card"
|
||||||
app:strokeWidth="0dp">
|
app:strokeWidth="0dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -187,7 +190,7 @@
|
|||||||
android:text="Nome de Utilizador"
|
android:text="Nome de Utilizador"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="#1A1A1A"
|
android:textColor="@color/primary_color"
|
||||||
android:layout_marginBottom="16dp" />
|
android:layout_marginBottom="16dp" />
|
||||||
|
|
||||||
<!-- Name Input -->
|
<!-- Name Input -->
|
||||||
@@ -195,14 +198,14 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="Nome completo"
|
android:hint="Nome completo"
|
||||||
app:boxCornerRadiusTopStart="16dp"
|
app:boxCornerRadiusTopStart="12dp"
|
||||||
app:boxCornerRadiusTopEnd="16dp"
|
app:boxCornerRadiusTopEnd="12dp"
|
||||||
app:boxCornerRadiusBottomStart="16dp"
|
app:boxCornerRadiusBottomStart="12dp"
|
||||||
app:boxCornerRadiusBottomEnd="16dp"
|
app:boxCornerRadiusBottomEnd="12dp"
|
||||||
app:boxStrokeWidth="2dp"
|
app:boxStrokeWidth="1dp"
|
||||||
app:boxStrokeColor="#BDBDBD"
|
app:boxStrokeColor="@color/divider"
|
||||||
app:startIconDrawable="@android:drawable/ic_menu_myplaces"
|
app:startIconDrawable="@android:drawable/ic_menu_myplaces"
|
||||||
app:startIconTint="#616161"
|
app:startIconTint="@color/text_secondary"
|
||||||
app:boxBackgroundMode="outline"
|
app:boxBackgroundMode="outline"
|
||||||
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
|
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
|
||||||
|
|
||||||
@@ -211,27 +214,38 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="textPersonName"
|
android:inputType="textPersonName"
|
||||||
android:textColor="#1A1A1A"
|
android:textColor="@color/text_primary"
|
||||||
android:textColorHint="#9E9E9E"
|
android:textColorHint="@color/text_secondary"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:padding="18dp"
|
android:padding="16dp"
|
||||||
android:background="@android:color/transparent" />
|
android:background="@android:color/transparent" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnSaveAll"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:backgroundTint="@color/primary_color"
|
||||||
|
android:text="Guardar Alterações"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<!-- Email Section -->
|
<!-- Security Section -->
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/cardEmail"
|
android:id="@+id/cardSecurity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="24dp"
|
||||||
app:cardCornerRadius="20dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="4dp"
|
app:cardElevation="2dp"
|
||||||
app:cardBackgroundColor="#FFFFFF"
|
app:cardBackgroundColor="@color/surface_card"
|
||||||
app:strokeWidth="0dp">
|
app:strokeWidth="0dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -239,113 +253,53 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="24dp">
|
android:padding="24dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Segurança"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/primary_color"
|
||||||
|
android:layout_marginBottom="16dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Email"
|
android:text="Email"
|
||||||
android:textSize="18sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="#1A1A1A"
|
android:textColor="@color/text_secondary"
|
||||||
android:layout_marginBottom="12dp" />
|
android:layout_marginBottom="8dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textEmail"
|
android:id="@+id/textEmail"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="email@exemplo.com"
|
android:text="email@exemplo.com"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textColor="#757575"
|
android:textColor="@color/text_primary"
|
||||||
android:padding="12dp"
|
android:padding="12dp"
|
||||||
android:background="#F5F5F5"
|
android:background="@drawable/shape_score_bg"
|
||||||
android:layout_marginBottom="16dp" />
|
android:backgroundTint="@color/background_light"
|
||||||
|
android:layout_marginBottom="12dp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnChangeEmail"
|
android:id="@+id/btnChangeEmail"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
|
||||||
android:backgroundTint="#616161"
|
|
||||||
android:text="Alterar Email"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:elevation="2dp"
|
|
||||||
android:stateListAnimator="@null" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
<!-- Password Section -->
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/cardPassword"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="24dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="4dp"
|
|
||||||
app:cardBackgroundColor="#FFFFFF"
|
|
||||||
app:strokeWidth="0dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="24dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Password"
|
android:backgroundTint="@color/text_secondary"
|
||||||
android:textSize="18sp"
|
android:text="Alterar Email"
|
||||||
android:textStyle="bold"
|
android:textColor="@color/white" />
|
||||||
android:textColor="#1A1A1A"
|
|
||||||
android:layout_marginBottom="16dp" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnChangePassword"
|
android:id="@+id/btnChangePassword"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
android:layout_height="wrap_content"
|
||||||
android:backgroundTint="#616161"
|
android:layout_marginTop="8dp"
|
||||||
|
android:backgroundTint="@color/text_secondary"
|
||||||
android:text="Alterar Password"
|
android:text="Alterar Password"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white" />
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:elevation="2dp"
|
|
||||||
android:stateListAnimator="@null" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
<!-- Save All Changes Button -->
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/cardSaveAll"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="24dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="4dp"
|
|
||||||
app:cardBackgroundColor="#FFFFFF"
|
|
||||||
app:strokeWidth="0dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="24dp">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnSaveAll"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:backgroundTint="#424242"
|
|
||||||
android:text="Guardar Alterações"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:elevation="2dp"
|
|
||||||
android:stateListAnimator="@null" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -356,10 +310,10 @@
|
|||||||
android:id="@+id/cardLogout"
|
android:id="@+id/cardLogout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="8dp"
|
||||||
app:cardCornerRadius="20dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="4dp"
|
app:cardElevation="2dp"
|
||||||
app:cardBackgroundColor="#FFFFFF"
|
app:cardBackgroundColor="@color/surface_card"
|
||||||
app:strokeWidth="0dp">
|
app:strokeWidth="0dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -371,14 +325,12 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnLogout"
|
android:id="@+id/btnLogout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="56dp"
|
android:layout_height="wrap_content"
|
||||||
android:backgroundTint="#D32F2F"
|
android:backgroundTint="@color/live_time"
|
||||||
android:text="Terminar Sessão"
|
android:text="Terminar Sessão"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold" />
|
||||||
android:elevation="2dp"
|
|
||||||
android:stateListAnimator="@null" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#ECEFF1">
|
android:background="@color/background_light">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Definições"
|
android:text="Definições"
|
||||||
android:textColor="#263238"
|
android:textColor="@color/primary_color"
|
||||||
android:textSize="28sp"
|
android:textSize="28sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:text="Personaliza a aplicação de acordo com o teu gosto."
|
android:text="Personaliza a aplicação de acordo com o teu gosto."
|
||||||
android:textColor="#546E7A"
|
android:textColor="@color/text_secondary"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
@@ -33,30 +33,32 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
android:foreground="?attr/selectableItemBackground"
|
android:foreground="?attr/selectableItemBackground"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardUseCompatPadding="true"
|
app:cardElevation="2dp"
|
||||||
app:strokeColor="#CFD8DC"
|
app:cardBackgroundColor="@color/surface_card">
|
||||||
app:strokeWidth="1dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="18dp">
|
android:padding="20dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:contentDescription="@string/menu_definicoes"
|
android:contentDescription="@string/menu_definicoes"
|
||||||
android:padding="4dp"
|
android:padding="4dp"
|
||||||
android:src="@android:drawable/ic_menu_manage" />
|
android:src="@android:drawable/ic_menu_manage"
|
||||||
|
app:tint="@color/primary_color"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
@@ -64,7 +66,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Conta"
|
android:text="Conta"
|
||||||
android:textColor="#263238"
|
android:textColor="@color/text_primary"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@@ -72,7 +74,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Atualiza os teus dados pessoais"
|
android:text="Atualiza os teus dados pessoais"
|
||||||
android:textColor="#607D8B"
|
android:textColor="@color/text_secondary"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -80,7 +82,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:contentDescription="@string/menu_definicoes"
|
android:contentDescription="@string/menu_definicoes"
|
||||||
android:src="@android:drawable/ic_media_next" />
|
android:src="@android:drawable/ic_media_next"
|
||||||
|
app:tint="@color/text_secondary"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
@@ -89,13 +92,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardElevation="2dp"
|
||||||
|
app:cardBackgroundColor="@color/surface_card">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="18dp">
|
android:padding="20dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -113,7 +117,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Notificações"
|
android:text="Notificações"
|
||||||
android:textColor="#263238"
|
android:textColor="@color/text_primary"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@@ -122,7 +126,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Ativadas"
|
android:text="Ativadas"
|
||||||
android:textColor="#607D8B"
|
android:textColor="@color/secondary_color"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -136,8 +140,8 @@
|
|||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_marginVertical="12dp"
|
android:layout_marginVertical="16dp"
|
||||||
android:background="#ECEFF1" />
|
android:background="@color/divider" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -155,7 +159,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Modo escuro"
|
android:text="Modo escuro"
|
||||||
android:textColor="#263238"
|
android:textColor="@color/text_primary"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@@ -164,7 +168,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Inativo"
|
android:text="Inativo"
|
||||||
android:textColor="#607D8B"
|
android:textColor="@color/text_secondary"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -181,19 +185,20 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardElevation="2dp"
|
||||||
|
app:cardBackgroundColor="@color/surface_card">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="18dp">
|
android:padding="20dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Ajuda e suporte"
|
android:text="Ajuda e suporte"
|
||||||
android:textColor="#263238"
|
android:textColor="@color/text_primary"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@@ -202,20 +207,19 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:text="Consulta a nossa base de conhecimento ou fala connosco."
|
android:text="Consulta a nossa base de conhecimento ou fala connosco."
|
||||||
android:textColor="#607D8B"
|
android:textColor="@color/text_secondary"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnOpenSystemSettings"
|
android:id="@+id/btnOpenSystemSettings"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="16dp"
|
||||||
android:backgroundTint="#1E88E5"
|
android:backgroundTint="@color/primary_light"
|
||||||
android:text="Abrir definições do sistema"
|
android:text="Abrir definições do sistema"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="#FFFFFF" />
|
android:textColor="@color/white" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user