...
This commit is contained in:
@@ -53,6 +53,7 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
updateGreeting();
|
||||
fetchProfilePicture();
|
||||
setupCategories();
|
||||
setupActions();
|
||||
}
|
||||
@@ -61,6 +62,22 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
||||
txtGreeting.setText(String.format("Olá, %s", displayName != null ? displayName : "convidado"));
|
||||
}
|
||||
|
||||
private void fetchProfilePicture() {
|
||||
if (email == null) return;
|
||||
String documentId = email.replace(".", "_").replace("@", "_at_");
|
||||
com.google.firebase.database.FirebaseDatabase.getInstance().getReference()
|
||||
.child("users").child(documentId).child("photoUrl")
|
||||
.get().addOnSuccessListener(snapshot -> {
|
||||
if (!isDestroyed() && snapshot.exists()) {
|
||||
String photoUrl = snapshot.getValue(String.class);
|
||||
if (photoUrl != null && !photoUrl.isEmpty()) {
|
||||
android.widget.ImageView imgProfile = findViewById(R.id.imgProfile);
|
||||
com.bumptech.glide.Glide.with(this).load(photoUrl).circleCrop().into(imgProfile);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupCategories() {
|
||||
RecyclerView rv = findViewById(R.id.rvCategories);
|
||||
List<FoodCategory> cats = new ArrayList<>();
|
||||
@@ -90,9 +107,14 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
||||
findViewById(R.id.btnVoltar).setOnClickListener(v -> finish());
|
||||
|
||||
findViewById(R.id.btnCheckIn).setOnClickListener(v -> {
|
||||
Intent intent = new Intent(this, CheckInAntecipadoActivity.class);
|
||||
intent.putExtra("restaurant_email", "sabor_arte@restaurante.com");
|
||||
startActivity(intent);
|
||||
boolean hasLocationPermission = androidx.core.app.ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
if (!hasLocationPermission) {
|
||||
android.widget.Toast.makeText(this, "Dê permissões de localização para aceder ao check-in.", android.widget.Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Intent intent = new Intent(this, CheckInAntecipadoActivity.class);
|
||||
intent.putExtra("restaurant_email", "sabor_arte@restaurante.com");
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnPartilhar).setOnClickListener(
|
||||
|
||||
Reference in New Issue
Block a user