Compare commits
12 Commits
19c889fcd2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d5c457c9a6 | |||
| 526da66c5f | |||
| a715199bbe | |||
| 2f2719101f | |||
| f9b1b4fc5d | |||
| e582e7ce6b | |||
| 2e7e22c89a | |||
| ccd2323114 | |||
| cf578e17b8 | |||
| 2e3b914d50 | |||
| 1c68112436 | |||
| 906849e4b7 |
13
.idea/deviceManager.xml
generated
Normal file
13
.idea/deviceManager.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DeviceTable">
|
||||||
|
<option name="columnSorters">
|
||||||
|
<list>
|
||||||
|
<ColumnSorterState>
|
||||||
|
<option name="column" value="Name" />
|
||||||
|
<option name="order" value="ASCENDING" />
|
||||||
|
</ColumnSorterState>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/markdown.xml
generated
Normal file
8
.idea/markdown.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MarkdownSettings">
|
||||||
|
<option name="previewPanelProviderInfo">
|
||||||
|
<ProviderInfo name="Compose (experimental)" className="com.intellij.markdown.compose.preview.ComposePanelProvider" />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -1,4 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ dependencies {
|
|||||||
implementation(platform(libs.firebase.bom))
|
implementation(platform(libs.firebase.bom))
|
||||||
implementation("com.google.firebase:firebase-firestore")
|
implementation("com.google.firebase:firebase-firestore")
|
||||||
implementation("com.google.firebase:firebase-auth")
|
implementation("com.google.firebase:firebase-auth")
|
||||||
|
implementation(libs.firebase.database)
|
||||||
testImplementation(libs.junit)
|
testImplementation(libs.junit)
|
||||||
androidTestImplementation(libs.ext.junit)
|
androidTestImplementation(libs.ext.junit)
|
||||||
androidTestImplementation(libs.espresso.core)
|
androidTestImplementation(libs.espresso.core)
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
@@ -11,6 +13,9 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Pap_teste">
|
android:theme="@style/Theme.Pap_teste">
|
||||||
|
<activity
|
||||||
|
android:name=".AddStaffActivity"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".DetalhesReservasActivity"
|
android:name=".DetalhesReservasActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
|||||||
130
app/src/main/java/com/example/pap_teste/AddStaffActivity.java
Normal file
130
app/src/main/java/com/example/pap_teste/AddStaffActivity.java
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
package com.example.pap_teste;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.text.InputType;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
import com.example.pap_teste.models.Staff;
|
||||||
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.database.FirebaseDatabase;
|
||||||
|
|
||||||
|
public class AddStaffActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private Button addButton;
|
||||||
|
private EditText nameEditText;
|
||||||
|
private Spinner zonaSpinner;
|
||||||
|
private Button btnAddZone;
|
||||||
|
private Spinner mesaSpinner;
|
||||||
|
private ArrayList<String> zones;
|
||||||
|
private ArrayList<String> mesas;
|
||||||
|
private ArrayAdapter<String> adapter;
|
||||||
|
private ArrayAdapter<String> mesaAdapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
setContentView(R.layout.activity_add_staff);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
addButton = findViewById(R.id.addButton);
|
||||||
|
nameEditText = findViewById(R.id.nammeEditText);
|
||||||
|
zonaSpinner = findViewById(R.id.zonaSpinner);
|
||||||
|
btnAddZone = findViewById(R.id.btnAddZone);
|
||||||
|
mesaSpinner = findViewById(R.id.mesaSpinner);
|
||||||
|
|
||||||
|
zones = new ArrayList<>();
|
||||||
|
zones.add("Sala");
|
||||||
|
zones.add("Esplanada");
|
||||||
|
zones.add("Balcão");
|
||||||
|
|
||||||
|
adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, zones);
|
||||||
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
zonaSpinner.setAdapter(adapter);
|
||||||
|
|
||||||
|
mesas = new ArrayList<>();
|
||||||
|
for (int i = 1; i <= 10; i++) {
|
||||||
|
mesas.add("Mesa " + i);
|
||||||
|
}
|
||||||
|
mesaAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, mesas);
|
||||||
|
mesaAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
mesaSpinner.setAdapter(mesaAdapter);
|
||||||
|
|
||||||
|
btnAddZone.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(AddStaffActivity.this);
|
||||||
|
builder.setTitle("Adicionar Zona");
|
||||||
|
|
||||||
|
final EditText input = new EditText(AddStaffActivity.this);
|
||||||
|
input.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||||
|
builder.setView(input);
|
||||||
|
|
||||||
|
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
String newZone = input.getText().toString();
|
||||||
|
if (!newZone.isEmpty()) {
|
||||||
|
zones.add(newZone);
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
zonaSpinner.setSelection(zones.size() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
String name = nameEditText.getText().toString();
|
||||||
|
String zona = "";
|
||||||
|
if (zonaSpinner.getSelectedItem() != null) {
|
||||||
|
zona = zonaSpinner.getSelectedItem().toString();
|
||||||
|
}
|
||||||
|
String mesa = "";
|
||||||
|
if (mesaSpinner.getSelectedItem() != null) {
|
||||||
|
mesa = mesaSpinner.getSelectedItem().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!name.isEmpty()) {
|
||||||
|
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("Staff");
|
||||||
|
String uuid = java.util.UUID.randomUUID().toString();
|
||||||
|
Staff staff = new Staff(name, zona, mesa, uuid);
|
||||||
|
databaseReference.child(uuid).setValue(staff);
|
||||||
|
|
||||||
|
Toast.makeText(AddStaffActivity.this, "Staff adicionado com sucesso!", Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(AddStaffActivity.this, "Erro: Preencha todos os campos", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -76,10 +76,5 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
|||||||
btnBack.setOnClickListener(v -> finish());
|
btnBack.setOnClickListener(v -> finish());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mantemos este método caso seja útil no futuro para feedback rápido.
|
|
||||||
// private void showToast(String message) {
|
|
||||||
// Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,10 +75,5 @@ public class EstablishmentDashboardActivity extends AppCompatActivity {
|
|||||||
btnBack.setOnClickListener(v -> finish());
|
btnBack.setOnClickListener(v -> finish());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mantemos este método caso seja útil no futuro para feedback rápido.
|
|
||||||
// private void showToast(String message) {
|
|
||||||
// Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,18 +15,28 @@ import androidx.core.graphics.Insets;
|
|||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
import com.example.pap_teste.models.Mesa;
|
||||||
|
import com.google.firebase.database.DataSnapshot;
|
||||||
|
import com.google.firebase.database.DatabaseError;
|
||||||
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.database.FirebaseDatabase;
|
||||||
|
import com.google.firebase.database.ValueEventListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
public class GerirMesasActivity extends AppCompatActivity {
|
public class GerirMesasActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private final List<MesaItem> mesas = new ArrayList<>();
|
private final List<Mesa> mesas = new ArrayList<>();
|
||||||
private ArrayAdapter<String> adapter;
|
private ArrayAdapter<String> adapter;
|
||||||
private ListView listMesas;
|
private ListView listMesas;
|
||||||
private EditText inputNumero;
|
private EditText inputNumero;
|
||||||
private EditText inputCapacidade;
|
private EditText inputCapacidade;
|
||||||
private Spinner spinnerEstado;
|
private Spinner spinnerEstado;
|
||||||
private TextView txtMensagem;
|
private TextView txtMensagem;
|
||||||
|
private DatabaseReference mDatabase;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -40,7 +50,9 @@ public class GerirMesasActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
bindViews();
|
bindViews();
|
||||||
seedMesasDemo();
|
|
||||||
|
mDatabase = FirebaseDatabase.getInstance().getReference("Mesas");
|
||||||
|
|
||||||
setupList();
|
setupList();
|
||||||
setupFormActions();
|
setupFormActions();
|
||||||
}
|
}
|
||||||
@@ -60,29 +72,44 @@ public class GerirMesasActivity extends AppCompatActivity {
|
|||||||
ArrayAdapter<String> estadoAdapter = new ArrayAdapter<>(
|
ArrayAdapter<String> estadoAdapter = new ArrayAdapter<>(
|
||||||
this,
|
this,
|
||||||
android.R.layout.simple_spinner_dropdown_item,
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
new String[]{"Livre", "Ocupada", "Reservada"}
|
new String[] { "Livre", "Ocupada", "Reservada" });
|
||||||
);
|
|
||||||
spinnerEstado.setAdapter(estadoAdapter);
|
spinnerEstado.setAdapter(estadoAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void seedMesasDemo() {
|
|
||||||
mesas.add(new MesaItem(1, 4, "Livre"));
|
|
||||||
mesas.add(new MesaItem(2, 2, "Reservada"));
|
|
||||||
mesas.add(new MesaItem(3, 6, "Ocupada"));
|
|
||||||
mesas.add(new MesaItem(4, 4, "Livre"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupList() {
|
private void setupList() {
|
||||||
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_activated_1);
|
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_activated_1);
|
||||||
listMesas.setAdapter(adapter);
|
listMesas.setAdapter(adapter);
|
||||||
refreshList();
|
|
||||||
|
mDatabase.addValueEventListener(new ValueEventListener() {
|
||||||
|
@Override
|
||||||
|
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||||
|
mesas.clear();
|
||||||
|
adapter.clear();
|
||||||
|
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
|
||||||
|
Mesa mesa = postSnapshot.getValue(Mesa.class);
|
||||||
|
if (mesa != null) {
|
||||||
|
mesas.add(mesa);
|
||||||
|
String resumo = String.format("Mesa %02d • %d lugares • %s", mesa.getNumero(),
|
||||||
|
mesa.getCapacidade(), mesa.getEstado());
|
||||||
|
adapter.add(resumo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelled(@NonNull DatabaseError error) {
|
||||||
|
Toast.makeText(GerirMesasActivity.this, "Erro ao carregar mesas: " + error.getMessage(),
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
listMesas.setOnItemClickListener((parent, view, position, id) -> {
|
listMesas.setOnItemClickListener((parent, view, position, id) -> {
|
||||||
MesaItem item = mesas.get(position);
|
Mesa item = mesas.get(position);
|
||||||
inputNumero.setText(String.valueOf(item.numero));
|
inputNumero.setText(String.valueOf(item.getNumero()));
|
||||||
inputCapacidade.setText(String.valueOf(item.capacidade));
|
inputCapacidade.setText(String.valueOf(item.getCapacidade()));
|
||||||
spinnerEstado.setSelection(getEstadoIndex(item.estado));
|
spinnerEstado.setSelection(getEstadoIndex(item.getEstado()));
|
||||||
txtMensagem.setText(String.format("Editar mesa %d", item.numero));
|
txtMensagem.setText(String.format("Editar mesa %d", item.getNumero()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,56 +150,36 @@ public class GerirMesasActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MesaItem existente = findMesa(numero);
|
Mesa existente = findMesa(numero);
|
||||||
|
String mesaId;
|
||||||
|
|
||||||
if (existente == null) {
|
if (existente == null) {
|
||||||
mesas.add(new MesaItem(numero, capacidade, estado));
|
mesaId = mDatabase.push().getKey();
|
||||||
txtMensagem.setText(String.format("Mesa %d adicionada/atualizada.", numero));
|
Mesa novaMesa = new Mesa(mesaId, numero, capacidade, estado);
|
||||||
|
if (mesaId != null) {
|
||||||
|
mDatabase.child(mesaId).setValue(novaMesa);
|
||||||
|
}
|
||||||
|
txtMensagem.setText(String.format("Mesa %d adicionada.", numero));
|
||||||
} else {
|
} else {
|
||||||
existente.capacidade = capacidade;
|
mesaId = existente.getId();
|
||||||
existente.estado = estado;
|
existente.setCapacidade(capacidade);
|
||||||
|
existente.setEstado(estado);
|
||||||
|
mDatabase.child(mesaId).setValue(existente);
|
||||||
txtMensagem.setText(String.format("Mesa %d atualizada.", numero));
|
txtMensagem.setText(String.format("Mesa %d atualizada.", numero));
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshList();
|
// Clearing inputs
|
||||||
|
inputNumero.setText("");
|
||||||
|
inputCapacidade.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private MesaItem findMesa(int numero) {
|
private Mesa findMesa(int numero) {
|
||||||
for (MesaItem item : mesas) {
|
for (Mesa item : mesas) {
|
||||||
if (item.numero == numero) {
|
if (item.getNumero() == numero) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshList() {
|
|
||||||
adapter.clear();
|
|
||||||
for (MesaItem item : mesas) {
|
|
||||||
String resumo = String.format("Mesa %02d • %d lugares • %s", item.numero, item.capacidade, item.estado);
|
|
||||||
adapter.add(resumo);
|
|
||||||
}
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class MesaItem {
|
|
||||||
int numero;
|
|
||||||
int capacidade;
|
|
||||||
String estado;
|
|
||||||
|
|
||||||
MesaItem(int numero, int capacidade, String estado) {
|
|
||||||
this.numero = numero;
|
|
||||||
this.capacidade = capacidade;
|
|
||||||
this.estado = estado;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
package com.example.pap_teste;
|
package com.example.pap_teste;
|
||||||
|
|
||||||
|
import com.example.pap_teste.models.Mesa;
|
||||||
|
import com.example.pap_teste.models.Staff;
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
import com.google.firebase.database.DataSnapshot;
|
||||||
|
import com.google.firebase.database.DatabaseError;
|
||||||
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.database.FirebaseDatabase;
|
||||||
|
import com.google.firebase.database.ValueEventListener;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -20,13 +32,24 @@ import java.util.List;
|
|||||||
|
|
||||||
public class GestaoStaffActivity extends AppCompatActivity {
|
public class GestaoStaffActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private final List<StaffAssignment> staffAssignments = new ArrayList<>();
|
private final List<Staff> staffList = new ArrayList<>();
|
||||||
private ArrayAdapter<String> staffAdapter;
|
private ArrayAdapter<String> staffAdapter;
|
||||||
private ListView listStaffMesas;
|
private ListView listStaffMesas;
|
||||||
private EditText inputNomeStaff;
|
|
||||||
|
private Spinner spinnerNomeStaff;
|
||||||
private Spinner spinnerMesaStaff;
|
private Spinner spinnerMesaStaff;
|
||||||
private TextView txtMensagemStaff;
|
private TextView txtMensagemStaff;
|
||||||
|
|
||||||
|
private DatabaseReference staffRef;
|
||||||
|
private DatabaseReference mesasRef;
|
||||||
|
|
||||||
|
private List<String> staffNames = new ArrayList<>();
|
||||||
|
private List<Mesa> mesasDisponiveis = new ArrayList<>();
|
||||||
|
private ArrayAdapter<String> staffNameAdapter;
|
||||||
|
private ArrayAdapter<String> mesaSpinnerAdapter;
|
||||||
|
|
||||||
|
private FloatingActionButton floatingActionButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -38,6 +61,9 @@ public class GestaoStaffActivity extends AppCompatActivity {
|
|||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
staffRef = FirebaseDatabase.getInstance().getReference("Staff");
|
||||||
|
mesasRef = FirebaseDatabase.getInstance().getReference("Mesas");
|
||||||
|
|
||||||
Button back = findViewById(R.id.btnVoltar);
|
Button back = findViewById(R.id.btnVoltar);
|
||||||
if (back != null) {
|
if (back != null) {
|
||||||
back.setOnClickListener(v -> finish());
|
back.setOnClickListener(v -> finish());
|
||||||
@@ -51,9 +77,10 @@ public class GestaoStaffActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void bindViews() {
|
private void bindViews() {
|
||||||
listStaffMesas = findViewById(R.id.listStaffMesas);
|
listStaffMesas = findViewById(R.id.listStaffMesas);
|
||||||
inputNomeStaff = findViewById(R.id.inputNomeStaff);
|
spinnerNomeStaff = findViewById(R.id.spinnerNomeStaff);
|
||||||
spinnerMesaStaff = findViewById(R.id.spinnerMesaStaff);
|
spinnerMesaStaff = findViewById(R.id.spinnerMesaStaff);
|
||||||
txtMensagemStaff = findViewById(R.id.txtMensagemStaff);
|
txtMensagemStaff = findViewById(R.id.txtMensagemStaff);
|
||||||
|
floatingActionButton = findViewById(R.id.floatingActionButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,29 +88,69 @@ public class GestaoStaffActivity extends AppCompatActivity {
|
|||||||
* Mais tarde isto pode ser ligado às mesas reais configuradas em "Gerir Mesas".
|
* Mais tarde isto pode ser ligado às mesas reais configuradas em "Gerir Mesas".
|
||||||
*/
|
*/
|
||||||
private void setupMesaSpinner() {
|
private void setupMesaSpinner() {
|
||||||
ArrayAdapter<String> mesaAdapter = new ArrayAdapter<>(
|
mesaSpinnerAdapter = new ArrayAdapter<>(
|
||||||
this,
|
this,
|
||||||
android.R.layout.simple_spinner_dropdown_item
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
);
|
|
||||||
|
|
||||||
for (int i = 1; i <= 20; i++) {
|
staffNameAdapter = new ArrayAdapter<>(
|
||||||
mesaAdapter.add(String.format("Mesa %02d", i));
|
this,
|
||||||
}
|
android.R.layout.simple_spinner_dropdown_item,
|
||||||
|
staffNames);
|
||||||
|
spinnerNomeStaff.setAdapter(staffNameAdapter);
|
||||||
|
|
||||||
spinnerMesaStaff.setAdapter(mesaAdapter);
|
loadStaffMembers();
|
||||||
|
loadMesas();
|
||||||
|
|
||||||
|
spinnerMesaStaff.setAdapter(mesaSpinnerAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadMesas() {
|
||||||
|
mesasRef.addValueEventListener(new ValueEventListener() {
|
||||||
|
@Override
|
||||||
|
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||||
|
mesasDisponiveis.clear();
|
||||||
|
mesaSpinnerAdapter.clear();
|
||||||
|
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
|
||||||
|
Mesa mesa = postSnapshot.getValue(Mesa.class);
|
||||||
|
if (mesa != null) {
|
||||||
|
mesasDisponiveis.add(mesa);
|
||||||
|
mesaSpinnerAdapter.add("Mesa " + mesa.getNumero());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mesaSpinnerAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelled(@NonNull DatabaseError error) {
|
||||||
|
Toast.makeText(GestaoStaffActivity.this, "Erro ao carregar mesas.", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupList() {
|
private void setupList() {
|
||||||
staffAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_activated_1);
|
staffAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_activated_1);
|
||||||
listStaffMesas.setAdapter(staffAdapter);
|
listStaffMesas.setAdapter(staffAdapter);
|
||||||
refreshList();
|
|
||||||
|
|
||||||
listStaffMesas.setOnItemClickListener((parent, view, position, id) -> {
|
listStaffMesas.setOnItemClickListener((parent, view, position, id) -> {
|
||||||
StaffAssignment item = staffAssignments.get(position);
|
Staff item = staffList.get(position);
|
||||||
inputNomeStaff.setText(item.nome);
|
// Select staff in spinner
|
||||||
int index = Math.max(0, Math.min(spinnerMesaStaff.getCount() - 1, item.mesaNumero - 1));
|
int staffIndex = staffNames.indexOf(item.getName());
|
||||||
spinnerMesaStaff.setSelection(index);
|
if (staffIndex >= 0) {
|
||||||
txtMensagemStaff.setText(String.format("A editar: %s (Mesa %02d)", item.nome, item.mesaNumero));
|
spinnerNomeStaff.setSelection(staffIndex);
|
||||||
|
}
|
||||||
|
// Select mesa in spinner
|
||||||
|
// Simple string matching for now since Mesa is stored as String in Staff
|
||||||
|
String assignedMesa = item.getMesa();
|
||||||
|
if (assignedMesa != null) {
|
||||||
|
for (int i = 0; i < mesaSpinnerAdapter.getCount(); i++) {
|
||||||
|
if (mesaSpinnerAdapter.getItem(i).equals(assignedMesa)) {
|
||||||
|
spinnerMesaStaff.setSelection(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
txtMensagemStaff.setText(String.format("A editar: %s", item.getName()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,12 +159,26 @@ public class GestaoStaffActivity extends AppCompatActivity {
|
|||||||
if (btnAtribuir != null) {
|
if (btnAtribuir != null) {
|
||||||
btnAtribuir.setOnClickListener(v -> guardarAtribuicao());
|
btnAtribuir.setOnClickListener(v -> guardarAtribuicao());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (floatingActionButton != null) {
|
||||||
|
floatingActionButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(GestaoStaffActivity.this, AddStaffActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void guardarAtribuicao() {
|
private void guardarAtribuicao() {
|
||||||
String nome = inputNomeStaff != null ? inputNomeStaff.getText().toString().trim() : "";
|
String nome = "";
|
||||||
|
if (spinnerNomeStaff.getSelectedItem() != null) {
|
||||||
|
nome = spinnerNomeStaff.getSelectedItem().toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (nome.isEmpty()) {
|
if (nome.isEmpty()) {
|
||||||
Toast.makeText(this, "Indique o nome do funcionário.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Selecione um funcionário.", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,52 +187,64 @@ public class GestaoStaffActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mesaNumero = spinnerMesaStaff.getSelectedItemPosition() + 1;
|
String mesaSelecionada = spinnerMesaStaff.getSelectedItem().toString();
|
||||||
|
|
||||||
StaffAssignment existente = findByNome(nome);
|
Staff staffToUpdate = findByNome(nome);
|
||||||
if (existente == null) {
|
if (staffToUpdate != null) {
|
||||||
staffAssignments.add(new StaffAssignment(nome, mesaNumero));
|
staffToUpdate.setMesa(mesaSelecionada);
|
||||||
txtMensagemStaff.setText(String.format("%s atribuído à mesa %02d.", nome, mesaNumero));
|
|
||||||
|
final String finalNome = nome;
|
||||||
|
final String finalMesa = mesaSelecionada;
|
||||||
|
|
||||||
|
staffRef.child(staffToUpdate.getId()).setValue(staffToUpdate)
|
||||||
|
.addOnSuccessListener(aVoid -> {
|
||||||
|
txtMensagemStaff.setText(String.format("%s atribuído à %s.", finalNome, finalMesa));
|
||||||
|
})
|
||||||
|
.addOnFailureListener(e -> {
|
||||||
|
Toast.makeText(this, "Erro ao atualizar: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
existente.mesaNumero = mesaNumero;
|
Toast.makeText(this, "Erro: Staff não encontrado.", Toast.LENGTH_SHORT).show();
|
||||||
txtMensagemStaff.setText(String.format("Mesa de %s atualizada para %02d.", nome, mesaNumero));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private StaffAssignment findByNome(String nome) {
|
private Staff findByNome(String nome) {
|
||||||
for (StaffAssignment item : staffAssignments) {
|
for (Staff item : staffList) {
|
||||||
if (item.nome.equalsIgnoreCase(nome)) {
|
if (item.getName().equalsIgnoreCase(nome)) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshList() {
|
private void loadStaffMembers() {
|
||||||
if (staffAdapter == null) return;
|
staffRef.addValueEventListener(new ValueEventListener() {
|
||||||
|
@Override
|
||||||
|
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||||
|
staffList.clear();
|
||||||
|
staffNames.clear();
|
||||||
|
staffAdapter.clear();
|
||||||
|
|
||||||
staffAdapter.clear();
|
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
|
||||||
for (StaffAssignment item : staffAssignments) {
|
Staff staff = postSnapshot.getValue(Staff.class);
|
||||||
String resumo = String.format("%s • Mesa %02d", item.nome, item.mesaNumero);
|
if (staff != null && staff.getName() != null) {
|
||||||
staffAdapter.add(resumo);
|
staffList.add(staff);
|
||||||
}
|
staffNames.add(staff.getName());
|
||||||
staffAdapter.notifyDataSetChanged();
|
|
||||||
|
String mesaInfo = staff.getMesa() != null ? staff.getMesa() : "Sem Mesa";
|
||||||
|
String resumo = String.format("%s • %s • %s", staff.getName(), staff.getZona(), mesaInfo);
|
||||||
|
staffAdapter.add(resumo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
staffNameAdapter.notifyDataSetChanged();
|
||||||
|
staffAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelled(@NonNull DatabaseError error) {
|
||||||
|
Toast.makeText(GestaoStaffActivity.this, "Erro ao carregar staff.", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private static class StaffAssignment {
|
|
||||||
String nome;
|
|
||||||
int mesaNumero;
|
|
||||||
|
|
||||||
StaffAssignment(String nome, int mesaNumero) {
|
|
||||||
this.nome = nome;
|
|
||||||
this.mesaNumero = mesaNumero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -18,8 +18,9 @@ import androidx.core.view.WindowInsetsCompat;
|
|||||||
|
|
||||||
import com.google.firebase.FirebaseApp;
|
import com.google.firebase.FirebaseApp;
|
||||||
import com.google.firebase.auth.FirebaseAuth;
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
import com.google.firebase.firestore.FirebaseFirestore;
|
import com.google.firebase.database.DataSnapshot;
|
||||||
import com.google.firebase.firestore.SetOptions;
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.database.FirebaseDatabase;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -34,8 +35,13 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
private static final String PREFS_NAME = "pap_prefs";
|
private static final String PREFS_NAME = "pap_prefs";
|
||||||
private static final String KEY_HAS_CREATED_ACCOUNT = "has_created_account";
|
private static final String KEY_HAS_CREATED_ACCOUNT = "has_created_account";
|
||||||
|
|
||||||
public enum AccountType {CLIENTE, ESTABELECIMENTO}
|
public enum AccountType {
|
||||||
public enum AccountAction {ENTRAR, CRIAR}
|
CLIENTE, ESTABELECIMENTO
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AccountAction {
|
||||||
|
ENTRAR, CRIAR
|
||||||
|
}
|
||||||
|
|
||||||
private AccountType selectedAccountType = AccountType.CLIENTE;
|
private AccountType selectedAccountType = AccountType.CLIENTE;
|
||||||
private AccountAction selectedAccountAction = AccountAction.ENTRAR;
|
private AccountAction selectedAccountAction = AccountAction.ENTRAR;
|
||||||
@@ -54,7 +60,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
private EditText inputEstablishmentPhone;
|
private EditText inputEstablishmentPhone;
|
||||||
private boolean hasCreatedAccount;
|
private boolean hasCreatedAccount;
|
||||||
private FirebaseAuth firebaseAuth;
|
private FirebaseAuth firebaseAuth;
|
||||||
private FirebaseFirestore firestore;
|
private DatabaseReference databaseReference;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -69,13 +75,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
FirebaseApp.initializeApp(this);
|
FirebaseApp.initializeApp(this);
|
||||||
firebaseAuth = FirebaseAuth.getInstance();
|
firebaseAuth = FirebaseAuth.getInstance();
|
||||||
firestore = FirebaseFirestore.getInstance();
|
databaseReference = FirebaseDatabase.getInstance().getReference();
|
||||||
|
|
||||||
bindViews();
|
bindViews();
|
||||||
setupTypeToggle();
|
setupTypeToggle();
|
||||||
setupActionToggle();
|
setupActionToggle();
|
||||||
setupPrimaryAction();
|
setupPrimaryAction();
|
||||||
enforceFirstAccountCreation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindViews() {
|
private void bindViews() {
|
||||||
@@ -170,13 +175,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
String establishmentEmail = inputEstablishmentEmail.getText().toString().trim();
|
String establishmentEmail = inputEstablishmentEmail.getText().toString().trim();
|
||||||
String establishmentPhone = inputEstablishmentPhone.getText().toString().trim();
|
String establishmentPhone = inputEstablishmentPhone.getText().toString().trim();
|
||||||
|
|
||||||
if (selectedAccountAction == AccountAction.ENTRAR && !hasCreatedAccount) {
|
|
||||||
Toast.makeText(this, "Crie uma conta para começar a usar a app.", Toast.LENGTH_SHORT).show();
|
|
||||||
selectedAccountAction = AccountAction.CRIAR;
|
|
||||||
updateActionButtons();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TextUtils.isEmpty(email) || TextUtils.isEmpty(password)) {
|
if (TextUtils.isEmpty(email) || TextUtils.isEmpty(password)) {
|
||||||
Toast.makeText(this, "Preencha email e palavra-passe.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Preencha email e palavra-passe.", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
@@ -184,6 +182,10 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
boolean creatingAccount = selectedAccountAction == AccountAction.CRIAR;
|
boolean creatingAccount = selectedAccountAction == AccountAction.CRIAR;
|
||||||
|
|
||||||
|
if (creatingAccount && !isValidPassword(password)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (creatingAccount) {
|
if (creatingAccount) {
|
||||||
if (selectedAccountType == AccountType.CLIENTE && TextUtils.isEmpty(providedName)) {
|
if (selectedAccountType == AccountType.CLIENTE && TextUtils.isEmpty(providedName)) {
|
||||||
Toast.makeText(this, "Indique o seu nome para criar conta.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Indique o seu nome para criar conta.", Toast.LENGTH_SHORT).show();
|
||||||
@@ -197,7 +199,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|| TextUtils.isEmpty(establishmentPhone);
|
|| TextUtils.isEmpty(establishmentPhone);
|
||||||
|
|
||||||
if (missingOwner || missingEstablishment) {
|
if (missingOwner || missingEstablishment) {
|
||||||
Toast.makeText(this, "Preencha os dados do proprietário e do estabelecimento.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Preencha os dados do proprietário e do estabelecimento.", Toast.LENGTH_SHORT)
|
||||||
|
.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,8 +219,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
establishmentEmail,
|
establishmentEmail,
|
||||||
establishmentPhone,
|
establishmentPhone,
|
||||||
fallbackName,
|
fallbackName,
|
||||||
resolvedRole
|
resolvedRole);
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,18 +239,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return firstLetter + rest;
|
return firstLetter + rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enforceFirstAccountCreation() {
|
|
||||||
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
|
||||||
hasCreatedAccount = prefs.getBoolean(KEY_HAS_CREATED_ACCOUNT, false);
|
|
||||||
|
|
||||||
if (!hasCreatedAccount) {
|
|
||||||
selectedAccountAction = AccountAction.CRIAR;
|
|
||||||
Toast.makeText(this, "Crie uma conta para começar a usar a app.", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateActionButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void markAccountCreated() {
|
private void markAccountCreated() {
|
||||||
hasCreatedAccount = true;
|
hasCreatedAccount = true;
|
||||||
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
||||||
@@ -264,7 +254,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean ensureFirebaseReady() {
|
private boolean ensureFirebaseReady() {
|
||||||
boolean ready = firebaseAuth != null && firestore != null;
|
boolean ready = firebaseAuth != null && databaseReference != null;
|
||||||
if (!ready) {
|
if (!ready) {
|
||||||
Toast.makeText(this, "Ligue-se ao Firebase para continuar.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Ligue-se ao Firebase para continuar.", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
@@ -277,12 +267,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
firebaseAuth.signInWithEmailAndPassword(email, password)
|
firebaseAuth.signInWithEmailAndPassword(email, password)
|
||||||
.addOnSuccessListener(authResult ->
|
.addOnSuccessListener(authResult -> fetchAccountAndNavigate(email, fallbackName, resolvedRole))
|
||||||
fetchAccountAndNavigate(email, fallbackName, resolvedRole)
|
.addOnFailureListener(e -> {
|
||||||
)
|
android.util.Log.e("LoginError", "SignIn failed", e);
|
||||||
.addOnFailureListener(e ->
|
Toast.makeText(this, "Não foi possível iniciar sessão: " + e.getMessage(), Toast.LENGTH_SHORT)
|
||||||
Toast.makeText(this, "Não foi possível iniciar sessão: " + e.getMessage(), Toast.LENGTH_SHORT).show()
|
.show();
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAccountInFirebase(
|
private void createAccountInFirebase(
|
||||||
@@ -294,8 +284,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
String establishmentEmail,
|
String establishmentEmail,
|
||||||
String establishmentPhone,
|
String establishmentPhone,
|
||||||
String fallbackName,
|
String fallbackName,
|
||||||
String resolvedRole
|
String resolvedRole) {
|
||||||
) {
|
|
||||||
if (!ensureFirebaseReady()) {
|
if (!ensureFirebaseReady()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -305,9 +294,10 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
if (!hasCreatedAccount) {
|
if (!hasCreatedAccount) {
|
||||||
markAccountCreated();
|
markAccountCreated();
|
||||||
}
|
}
|
||||||
String finalDisplayName = selectedAccountType == AccountType.ESTABELECIMENTO && !TextUtils.isEmpty(establishmentName)
|
String finalDisplayName = selectedAccountType == AccountType.ESTABELECIMENTO
|
||||||
? establishmentName
|
&& !TextUtils.isEmpty(establishmentName)
|
||||||
: fallbackName;
|
? establishmentName
|
||||||
|
: fallbackName;
|
||||||
String uid = result.getUser() != null ? result.getUser().getUid() : null;
|
String uid = result.getUser() != null ? result.getUser().getUid() : null;
|
||||||
|
|
||||||
persistAccountInFirebase(
|
persistAccountInFirebase(
|
||||||
@@ -320,71 +310,77 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
establishmentPhone,
|
establishmentPhone,
|
||||||
uid,
|
uid,
|
||||||
() -> {
|
() -> {
|
||||||
Intent createdScreen = new Intent(this, AccountCreatedActivity.class);
|
Toast.makeText(this, "Conta criada com sucesso! Carregue em Entrar.", Toast.LENGTH_LONG)
|
||||||
createdScreen.putExtra(EXTRA_ACTION_MODE, selectedAccountAction.name());
|
.show();
|
||||||
createdScreen.putExtra(EXTRA_DISPLAY_NAME, finalDisplayName);
|
selectedAccountAction = AccountAction.ENTRAR;
|
||||||
createdScreen.putExtra(EXTRA_EMAIL, email);
|
updateActionButtons();
|
||||||
createdScreen.putExtra(EXTRA_ACCOUNT_TYPE, selectedAccountType.name());
|
});
|
||||||
createdScreen.putExtra(EXTRA_ROLE, resolvedRole);
|
|
||||||
startActivity(createdScreen);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.addOnFailureListener(e ->
|
.addOnFailureListener(e -> {
|
||||||
Toast.makeText(this, "Falha ao criar conta: " + e.getMessage(), Toast.LENGTH_SHORT).show()
|
android.util.Log.e("LoginError", "CreateUser failed", e);
|
||||||
);
|
Toast.makeText(this, "Falha ao criar conta: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchAccountAndNavigate(String email, String fallbackName, String resolvedRole) {
|
private void fetchAccountAndNavigate(String email, String fallbackName, String resolvedRole) {
|
||||||
if (firestore == null) {
|
if (databaseReference == null) {
|
||||||
Toast.makeText(this, "Firebase indisponível.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Firebase indisponível.", Toast.LENGTH_SHORT).show();
|
||||||
|
navigateToDashboard(email, fallbackName, resolvedRole);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String documentId = buildDocumentId(email);
|
String documentId = buildDocumentId(email);
|
||||||
firestore.collection("users")
|
databaseReference.child("users").child(documentId).get().addOnCompleteListener(task -> {
|
||||||
.document(documentId)
|
if (!task.isSuccessful()) {
|
||||||
.get()
|
android.util.Log.e("LoginError", "Database check failed", task.getException());
|
||||||
.addOnSuccessListener(snapshot -> {
|
Toast.makeText(this, "Falha ao validar perfil na cloud. A entrar em modo básico.", Toast.LENGTH_SHORT)
|
||||||
if (snapshot == null || !snapshot.exists()) {
|
.show();
|
||||||
Toast.makeText(this, "Conta não encontrada no Firebase.", Toast.LENGTH_SHORT).show();
|
navigateToDashboard(email, fallbackName, resolvedRole);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String accountTypeInFirebase = snapshot.getString("accountType");
|
DataSnapshot snapshot = task.getResult();
|
||||||
if (accountTypeInFirebase != null
|
if (snapshot == null || !snapshot.exists()) {
|
||||||
&& !accountTypeInFirebase.equalsIgnoreCase(selectedAccountType.name())) {
|
Toast.makeText(this, "Conta sem perfil na cloud. A entrar em modo básico.", Toast.LENGTH_SHORT).show();
|
||||||
Toast.makeText(this, "Tipo de conta não corresponde ao registo no Firebase.", Toast.LENGTH_SHORT).show();
|
navigateToDashboard(email, fallbackName, resolvedRole);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String displayNameFromDb = snapshot.getString("displayName");
|
String accountTypeInFirebase = snapshot.child("accountType").getValue(String.class);
|
||||||
String establishmentName = snapshot.getString("establishmentName");
|
if (accountTypeInFirebase != null
|
||||||
String ownerName = snapshot.getString("ownerName");
|
&& !accountTypeInFirebase.equalsIgnoreCase(selectedAccountType.name())) {
|
||||||
String roleFromDb = snapshot.getString("role");
|
Toast.makeText(this, "Tipo de conta não corresponde ao registo no Firebase.", Toast.LENGTH_SHORT)
|
||||||
|
.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String finalDisplayName = !TextUtils.isEmpty(establishmentName)
|
String displayNameFromDb = snapshot.child("displayName").getValue(String.class);
|
||||||
? establishmentName
|
String establishmentName = snapshot.child("establishmentName").getValue(String.class);
|
||||||
: !TextUtils.isEmpty(displayNameFromDb) ? displayNameFromDb
|
String ownerName = snapshot.child("ownerName").getValue(String.class);
|
||||||
|
String roleFromDb = snapshot.child("role").getValue(String.class);
|
||||||
|
|
||||||
|
String finalDisplayName = !TextUtils.isEmpty(establishmentName)
|
||||||
|
? establishmentName
|
||||||
|
: !TextUtils.isEmpty(displayNameFromDb) ? displayNameFromDb
|
||||||
: !TextUtils.isEmpty(ownerName) ? ownerName
|
: !TextUtils.isEmpty(ownerName) ? ownerName
|
||||||
: fallbackName;
|
: fallbackName;
|
||||||
|
|
||||||
String finalRole = !TextUtils.isEmpty(roleFromDb) ? roleFromDb : resolvedRole;
|
String finalRole = !TextUtils.isEmpty(roleFromDb) ? roleFromDb : resolvedRole;
|
||||||
|
navigateToDashboard(email, finalDisplayName, finalRole);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Intent nextScreen = selectedAccountType == AccountType.CLIENTE
|
private void navigateToDashboard(String email, String displayName, String role) {
|
||||||
? new Intent(this, ClientDashboardActivity.class)
|
Intent nextScreen = selectedAccountType == AccountType.CLIENTE
|
||||||
: new Intent(this, EstablishmentDashboardActivity.class);
|
? new Intent(this, ClientDashboardActivity.class)
|
||||||
|
: new Intent(this, EstablishmentDashboardActivity.class);
|
||||||
|
|
||||||
nextScreen.putExtra(EXTRA_ACTION_MODE, selectedAccountAction.name());
|
nextScreen.putExtra(EXTRA_ACTION_MODE, selectedAccountAction.name());
|
||||||
nextScreen.putExtra(EXTRA_DISPLAY_NAME, finalDisplayName);
|
nextScreen.putExtra(EXTRA_DISPLAY_NAME, displayName);
|
||||||
nextScreen.putExtra(EXTRA_EMAIL, email);
|
nextScreen.putExtra(EXTRA_EMAIL, email);
|
||||||
nextScreen.putExtra(EXTRA_ACCOUNT_TYPE, selectedAccountType.name());
|
nextScreen.putExtra(EXTRA_ACCOUNT_TYPE, selectedAccountType.name());
|
||||||
nextScreen.putExtra(EXTRA_ROLE, finalRole);
|
nextScreen.putExtra(EXTRA_ROLE, role);
|
||||||
startActivity(nextScreen);
|
startActivity(nextScreen);
|
||||||
})
|
|
||||||
.addOnFailureListener(e ->
|
|
||||||
Toast.makeText(this, "Erro ao verificar conta no Firebase.", Toast.LENGTH_SHORT).show()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void persistAccountInFirebase(
|
private void persistAccountInFirebase(
|
||||||
@@ -396,9 +392,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
String establishmentEmail,
|
String establishmentEmail,
|
||||||
String establishmentPhone,
|
String establishmentPhone,
|
||||||
String uid,
|
String uid,
|
||||||
Runnable onSuccess
|
Runnable onSuccess) {
|
||||||
) {
|
if (databaseReference == null) {
|
||||||
if (firestore == null) {
|
|
||||||
Toast.makeText(this, "Firebase indisponível.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Firebase indisponível.", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -423,19 +418,40 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
payload.put("establishmentPhone", establishmentPhone);
|
payload.put("establishmentPhone", establishmentPhone);
|
||||||
}
|
}
|
||||||
|
|
||||||
firestore.collection("users")
|
databaseReference.child("users").child(documentId).updateChildren(payload)
|
||||||
.document(documentId)
|
.addOnSuccessListener(unused -> {
|
||||||
.set(payload, SetOptions.merge())
|
Toast.makeText(this, "Conta guardada na cloud.", Toast.LENGTH_SHORT).show();
|
||||||
.addOnSuccessListener(unused ->
|
if (onSuccess != null) {
|
||||||
{
|
onSuccess.run();
|
||||||
Toast.makeText(this, "Conta guardada na cloud.", Toast.LENGTH_SHORT).show();
|
}
|
||||||
if (onSuccess != null) {
|
})
|
||||||
onSuccess.run();
|
.addOnFailureListener(
|
||||||
}
|
e -> Toast.makeText(this, "Não foi possível guardar na cloud.", Toast.LENGTH_SHORT).show());
|
||||||
}
|
}
|
||||||
)
|
|
||||||
.addOnFailureListener(e ->
|
private boolean isValidPassword(String password) {
|
||||||
Toast.makeText(this, "Não foi possível guardar na cloud.", Toast.LENGTH_SHORT).show()
|
if (password.length() < 6) {
|
||||||
);
|
Toast.makeText(this, "A palavra-passe deve ter pelo menos 6 caracteres.", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean hasLower = false;
|
||||||
|
boolean hasDigit = false;
|
||||||
|
boolean hasSpecial = false;
|
||||||
|
|
||||||
|
for (char c : password.toCharArray()) {
|
||||||
|
if (Character.isLowerCase(c))
|
||||||
|
hasLower = true;
|
||||||
|
else if (Character.isDigit(c))
|
||||||
|
hasDigit = true;
|
||||||
|
else if (!Character.isLetterOrDigit(c))
|
||||||
|
hasSpecial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasLower || !hasDigit || !hasSpecial) {
|
||||||
|
Toast.makeText(this, "A palavra-passe deve conter minúsculas, números e símbolos.", Toast.LENGTH_LONG)
|
||||||
|
.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
56
app/src/main/java/com/example/pap_teste/models/Mesa.java
Normal file
56
app/src/main/java/com/example/pap_teste/models/Mesa.java
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package com.example.pap_teste.models;
|
||||||
|
|
||||||
|
public class Mesa {
|
||||||
|
private String id;
|
||||||
|
private int numero;
|
||||||
|
private int capacidade;
|
||||||
|
private String estado;
|
||||||
|
|
||||||
|
public Mesa() {
|
||||||
|
// Default constructor required for calls to DataSnapshot.getValue(Mesa.class)
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mesa(String id, int numero, int capacidade, String estado) {
|
||||||
|
this.id = id;
|
||||||
|
this.numero = numero;
|
||||||
|
this.capacidade = capacidade;
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumero() {
|
||||||
|
return numero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumero(int numero) {
|
||||||
|
this.numero = numero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCapacidade() {
|
||||||
|
return capacidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCapacidade(int capacidade) {
|
||||||
|
this.capacidade = capacidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEstado() {
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(String estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Mesa " + numero;
|
||||||
|
}
|
||||||
|
}
|
||||||
51
app/src/main/java/com/example/pap_teste/models/Staff.java
Normal file
51
app/src/main/java/com/example/pap_teste/models/Staff.java
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package com.example.pap_teste.models;
|
||||||
|
|
||||||
|
public class Staff {
|
||||||
|
private String name;
|
||||||
|
private String zona;
|
||||||
|
private String mesa;
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
public Staff(String name, String zona, String mesa, String id) {
|
||||||
|
this.name = name;
|
||||||
|
this.zona = zona;
|
||||||
|
this.mesa = mesa;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Staff() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZona() {
|
||||||
|
return zona;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZona(String zona) {
|
||||||
|
this.zona = zona;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMesa() {
|
||||||
|
return mesa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMesa(String mesa) {
|
||||||
|
this.mesa = mesa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
73
app/src/main/res/layout/activity_add_staff.xml
Normal file
73
app/src/main/res/layout/activity_add_staff.xml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".AddStaffActivity">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/nammeEditText"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Name"
|
||||||
|
android:inputType="text"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/zoneLayout"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/nammeEditText"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/nammeEditText"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/nammeEditText">
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/zonaSpinner"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:minHeight="48dp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnAddZone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="+" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/mesaLayout"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/zoneLayout"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/zoneLayout"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/zoneLayout">
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/mesaSpinner"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:minHeight="48dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/addButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Button"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -67,15 +67,13 @@
|
|||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<EditText
|
<Spinner
|
||||||
android:id="@+id/inputNomeStaff"
|
android:id="@+id/spinnerNomeStaff"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:background="@drawable/input_bg"
|
android:background="@drawable/input_bg"
|
||||||
android:hint="Nome do funcionário"
|
android:padding="0dp" />
|
||||||
android:inputType="textPersonName"
|
|
||||||
android:padding="12dp" />
|
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/spinnerMesaStaff"
|
android:id="@+id/spinnerMesaStaff"
|
||||||
@@ -130,7 +128,21 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@id/txtListaStaffTitulo"
|
app:layout_constraintTop_toBottomOf="@id/txtListaStaffTitulo"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" >
|
||||||
|
|
||||||
|
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/floatingActionButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:layout_marginBottom="32dp"
|
||||||
|
android:clickable="true"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
tools:srcCompat="@tools:sample/avatars" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,8 @@
|
|||||||
android:background="@drawable/input_bg"
|
android:background="@drawable/input_bg"
|
||||||
android:hint="Email"
|
android:hint="Email"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
android:padding="12dp" />
|
android:padding="12dp"
|
||||||
|
android:text="EstabelecimentoPap@gmail.com" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/inputOwnerPhone"
|
android:id="@+id/inputOwnerPhone"
|
||||||
@@ -207,7 +208,8 @@
|
|||||||
android:background="@drawable/input_bg"
|
android:background="@drawable/input_bg"
|
||||||
android:hint="Palavra-passe"
|
android:hint="Palavra-passe"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:padding="12dp" />
|
android:padding="12dp"
|
||||||
|
android:text="PaP@P.1" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnFinalCriarConta"
|
android:id="@+id/btnFinalCriarConta"
|
||||||
|
|||||||
@@ -18,4 +18,14 @@ android.useAndroidX=true
|
|||||||
# Enables namespacing of each library's R class so that its R class includes only the
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
android.defaults.buildfeatures.resvalues=true
|
||||||
|
android.sdk.defaultTargetSdkToCompileSdkIfUnset=false
|
||||||
|
android.enableAppCompileTimeRClass=false
|
||||||
|
android.usesSdkInManifest.disallowed=false
|
||||||
|
android.uniquePackageNames=false
|
||||||
|
android.dependency.useConstraints=true
|
||||||
|
android.r8.strictFullModeForKeepRules=false
|
||||||
|
android.r8.optimizedResourceShrinking=false
|
||||||
|
android.builtInKotlin=false
|
||||||
|
android.newDsl=false
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "8.13.2"
|
agp = "9.0.1"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
junitVersion = "1.3.0"
|
junitVersion = "1.3.0"
|
||||||
espressoCore = "3.7.0"
|
espressoCore = "3.7.0"
|
||||||
@@ -10,6 +10,7 @@ activity = "1.11.0"
|
|||||||
constraintlayout = "2.2.1"
|
constraintlayout = "2.2.1"
|
||||||
firebaseBom = "33.7.0"
|
firebaseBom = "33.7.0"
|
||||||
googleServices = "4.4.2"
|
googleServices = "4.4.2"
|
||||||
|
firebaseDatabase = "22.0.1"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
@@ -21,6 +22,7 @@ material = { group = "com.google.android.material", name = "material", version.r
|
|||||||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||||
firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebaseBom" }
|
firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebaseBom" }
|
||||||
|
firebase-database = { group = "com.google.firebase", name = "firebase-database", version.ref = "firebaseDatabase" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
#Tue Jan 20 14:11:23 WET 2026
|
#Tue Jan 20 14:11:23 WET 2026
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
Reference in New Issue
Block a user