..asd
This commit is contained in:
@@ -166,7 +166,7 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
||||
layoutAllRestaurants.setVisibility(View.GONE);
|
||||
|
||||
DatabaseReference usersRef = FirebaseDatabase.getInstance().getReference("Restaurantes");
|
||||
usersRef.addListenerForSingleValueEvent(new ValueEventListener() {
|
||||
usersRef.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@androidx.annotation.NonNull DataSnapshot snapshot) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
@@ -176,7 +176,8 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
||||
String role = ds.child("role").getValue(String.class);
|
||||
String accountType = ds.child("accountType").getValue(String.class);
|
||||
|
||||
if ("ADMIN".equalsIgnoreCase(role) || "ESTABELECIMENTO".equalsIgnoreCase(accountType)) {
|
||||
// Aceitar todos os registos na coleção Restaurantes
|
||||
if (true) {
|
||||
String name = ds.child("establishmentName").getValue(String.class);
|
||||
if (name == null)
|
||||
name = ds.child("displayName").getValue(String.class);
|
||||
|
||||
@@ -135,7 +135,7 @@ public class ExplorarRestaurantesActivity extends AppCompatActivity {
|
||||
if (progressBar != null)
|
||||
progressBar.setVisibility(android.view.View.VISIBLE);
|
||||
|
||||
query.addListenerForSingleValueEvent(new com.google.firebase.database.ValueEventListener() {
|
||||
query.addValueEventListener(new com.google.firebase.database.ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@androidx.annotation.NonNull com.google.firebase.database.DataSnapshot snapshot) {
|
||||
if (progressBar != null)
|
||||
@@ -145,7 +145,8 @@ public class ExplorarRestaurantesActivity extends AppCompatActivity {
|
||||
String role = ds.child("role").getValue(String.class);
|
||||
String accountType = ds.child("accountType").getValue(String.class);
|
||||
|
||||
if ("ADMIN".equalsIgnoreCase(role) || "ESTABELECIMENTO".equalsIgnoreCase(accountType)) {
|
||||
// Aceitar todos os registos na coleção Restaurantes
|
||||
if (true) {
|
||||
String name = ds.child("establishmentName").getValue(String.class);
|
||||
if (name == null)
|
||||
name = ds.child("displayName").getValue(String.class);
|
||||
|
||||
@@ -54,9 +54,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private AccountType selectedAccountType = AccountType.CLIENTE;
|
||||
private AccountAction selectedAccountAction = AccountAction.ENTRAR;
|
||||
|
||||
private Button btnCliente;
|
||||
private Button btnEstabelecimento;
|
||||
private Button btnEntrar;
|
||||
private Button btnCriarConta;
|
||||
private Button btnPrimaryAction;
|
||||
@@ -101,12 +98,13 @@ public class MainActivity extends AppCompatActivity {
|
||||
return insets;
|
||||
});
|
||||
|
||||
selectedAccountType = AccountType.CLIENTE;
|
||||
|
||||
FirebaseApp.initializeApp(this);
|
||||
firebaseAuth = FirebaseAuth.getInstance();
|
||||
databaseReference = FirebaseDatabase.getInstance().getReference();
|
||||
|
||||
bindViews();
|
||||
setupTypeToggle();
|
||||
setupActionToggle();
|
||||
setupPrimaryAction();
|
||||
checkPermissions();
|
||||
@@ -177,8 +175,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void bindViews() {
|
||||
btnCliente = findViewById(R.id.btnCliente);
|
||||
btnEstabelecimento = findViewById(R.id.btnEstabelecimento);
|
||||
btnEntrar = findViewById(R.id.btnEntrar);
|
||||
btnCriarConta = findViewById(R.id.btnCriarConta);
|
||||
btnPrimaryAction = findViewById(R.id.btnFinalCriarConta);
|
||||
@@ -240,17 +236,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void setupTypeToggle() {
|
||||
btnCliente.setOnClickListener(v -> {
|
||||
selectedAccountType = AccountType.CLIENTE;
|
||||
updateTypeButtons();
|
||||
});
|
||||
btnEstabelecimento.setOnClickListener(v -> {
|
||||
selectedAccountType = AccountType.ESTABELECIMENTO;
|
||||
updateTypeButtons();
|
||||
});
|
||||
updateTypeButtons();
|
||||
}
|
||||
|
||||
private void setupActionToggle() {
|
||||
btnEntrar.setOnClickListener(v -> {
|
||||
@@ -269,11 +254,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
updatePrimaryActionState();
|
||||
}
|
||||
|
||||
private void updateTypeButtons() {
|
||||
setSelectedState(btnCliente, selectedAccountType == AccountType.CLIENTE);
|
||||
setSelectedState(btnEstabelecimento, selectedAccountType == AccountType.ESTABELECIMENTO);
|
||||
updateInputVisibility();
|
||||
}
|
||||
|
||||
private void updateActionButtons() {
|
||||
setSelectedState(btnEntrar, selectedAccountAction == AccountAction.ENTRAR);
|
||||
|
||||
@@ -119,7 +119,8 @@ public class NovaReservaActivity extends AppCompatActivity {
|
||||
String role = ds.child("role").getValue(String.class);
|
||||
String accountType = ds.child("accountType").getValue(String.class);
|
||||
|
||||
if ("ADMIN".equalsIgnoreCase(role) || "ESTABELECIMENTO".equalsIgnoreCase(accountType)) {
|
||||
// Aceitar todos os registos na coleção Restaurantes
|
||||
if (true) {
|
||||
String name = ds.child("establishmentName").getValue(String.class);
|
||||
if (name == null)
|
||||
name = ds.child("displayName").getValue(String.class);
|
||||
|
||||
@@ -79,30 +79,7 @@
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/bg_tabs"
|
||||
android:orientation="horizontal"
|
||||
android:padding="3dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCliente"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/btn_light"
|
||||
android:text="Cliente"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#231F1F"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnEstabelecimento"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:text="Estabelecimento"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorTextSecondary"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
android:padding="3dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user