commit 446b6fed75e242cc6effd1a0ed548a9f9b9b1531 Author: 230409 <230409@epvc.pt> Date: Wed Dec 3 10:21:22 2025 +0000 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/appInsightsSettings.xml b/.idea/appInsightsSettings.xml new file mode 100644 index 0000000..cd944f9 --- /dev/null +++ b/.idea/appInsightsSettings.xml @@ -0,0 +1,40 @@ + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..b268ef3 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..639c779 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..74dd639 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/.idea/studiobot.xml b/.idea/studiobot.xml new file mode 100644 index 0000000..539e3b8 --- /dev/null +++ b/.idea/studiobot.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c5f3f6b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "interactive" +} \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..14b8068 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + alias(libs.plugins.android.application) +} + +android { + namespace = "com.example.pap_teste" + compileSdk = 36 + + defaultConfig { + applicationId = "com.example.pap_teste" + minSdk = 24 + targetSdk = 36 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} + +dependencies { + + implementation(libs.appcompat) + implementation(libs.material) + implementation(libs.activity) + implementation(libs.constraintlayout) + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.espresso.core) + androidTestImplementation(libs.test.core) +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/pap_teste/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/pap_teste/ExampleInstrumentedTest.java new file mode 100644 index 0000000..bf50fcc --- /dev/null +++ b/app/src/androidTest/java/com/example/pap_teste/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.pap_teste; + +import android.content.Context; + +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.example.pap_teste", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..513a5ae --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/pap_teste/ClientDashboardActivity.java b/app/src/main/java/com/example/pap_teste/ClientDashboardActivity.java new file mode 100644 index 0000000..b9de492 --- /dev/null +++ b/app/src/main/java/com/example/pap_teste/ClientDashboardActivity.java @@ -0,0 +1,62 @@ +package com.example.pap_teste; + +import android.os.Bundle; +import android.widget.Button; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +public class ClientDashboardActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + EdgeToEdge.enable(this); + setContentView(R.layout.activity_client_dashboard); + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.clientRoot), (v, insets) -> { + Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); + return insets; + }); + + TextView txtGreeting = findViewById(R.id.txtClientGreeting); + TextView txtStatus = findViewById(R.id.txtClientStatus); + TextView txtReservationStatus = findViewById(R.id.txtReservationStatus); + TextView txtReservationSubtitle = findViewById(R.id.txtReservationSubtitle); + + String actionMode = getIntent().getStringExtra(MainActivity.EXTRA_ACTION_MODE); + String displayName = getIntent().getStringExtra(MainActivity.EXTRA_DISPLAY_NAME); + + boolean isNewAccount = "CRIAR".equalsIgnoreCase(actionMode); + txtGreeting.setText(String.format("Olá, %s", displayName != null ? displayName : "convidado")); + txtStatus.setText(isNewAccount + ? "Conta criada com sucesso! Configure as suas preferências para começarmos." + : "Bom tê-lo de volta! Já deixámos tudo pronto para a sua próxima reserva."); + + txtReservationStatus.setText("Próxima reserva"); + txtReservationSubtitle.setText("Mesa para 2 • Amanhã às 20h • Sabor & Arte"); + + Button btnNewReservation = findViewById(R.id.btnNovaReserva); + Button btnExplore = findViewById(R.id.btnExplorar); + Button btnFavorites = findViewById(R.id.btnFavoritos); + + Button btnCheckIn = findViewById(R.id.btnCheckIn); + Button btnShare = findViewById(R.id.btnPartilhar); + + btnNewReservation.setOnClickListener(v -> showToast("Abrindo fluxo de nova reserva...")); + btnExplore.setOnClickListener(v -> showToast("A explorar restaurantes recomendados.")); + btnFavorites.setOnClickListener(v -> showToast("A mostrar os seus favoritos.")); + btnCheckIn.setOnClickListener(v -> showToast("Check-in antecipado registado!")); + btnShare.setOnClickListener(v -> showToast("Partilhe a reserva com os seus convidados.")); + } + + private void showToast(String message) { + Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); + } +} + diff --git a/app/src/main/java/com/example/pap_teste/EstablishmentDashboardActivity.java b/app/src/main/java/com/example/pap_teste/EstablishmentDashboardActivity.java new file mode 100644 index 0000000..ccff410 --- /dev/null +++ b/app/src/main/java/com/example/pap_teste/EstablishmentDashboardActivity.java @@ -0,0 +1,54 @@ +package com.example.pap_teste; + +import android.os.Bundle; +import android.widget.Button; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +public class EstablishmentDashboardActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + EdgeToEdge.enable(this); + setContentView(R.layout.activity_establishment_dashboard); + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.establishmentRoot), (v, insets) -> { + Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); + return insets; + }); + + TextView txtTitle = findViewById(R.id.txtEstabTitle); + TextView txtSubtitle = findViewById(R.id.txtEstabSubtitle); + + String actionMode = getIntent().getStringExtra(MainActivity.EXTRA_ACTION_MODE); + String displayName = getIntent().getStringExtra(MainActivity.EXTRA_DISPLAY_NAME); + + boolean isNewAccount = "CRIAR".equalsIgnoreCase(actionMode); + txtTitle.setText(displayName != null ? displayName : "Estabelecimento"); + txtSubtitle.setText(isNewAccount + ? "Perfil criado. Configure horários, mesas e abra reservas." + : "Dashboard operacional. Acompanhe as reservas em tempo real."); + + Button btnOpenWalkIns = findViewById(R.id.btnAbrirEspera); + Button btnBlockTime = findViewById(R.id.btnCriarBloqueio); + Button btnStaff = findViewById(R.id.btnGestaoStaff); + Button btnReports = findViewById(R.id.btnVerRelatorios); + + btnOpenWalkIns.setOnClickListener(v -> showToast("Lista de espera aberta para novos clientes.")); + btnBlockTime.setOnClickListener(v -> showToast("Bloqueio criado para o horário selecionado.")); + btnStaff.setOnClickListener(v -> showToast("Gestão de staff disponível em breve.")); + btnReports.setOnClickListener(v -> showToast("Relatórios do dia enviados para o seu email.")); + } + + private void showToast(String message) { + Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); + } +} + diff --git a/app/src/main/java/com/example/pap_teste/MainActivity.java b/app/src/main/java/com/example/pap_teste/MainActivity.java new file mode 100644 index 0000000..4065499 --- /dev/null +++ b/app/src/main/java/com/example/pap_teste/MainActivity.java @@ -0,0 +1,160 @@ +package com.example.pap_teste; + +import android.content.Intent; +import android.graphics.Color; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +public class MainActivity extends AppCompatActivity { + + public static final String EXTRA_ACTION_MODE = "extra_action_mode"; + public static final String EXTRA_DISPLAY_NAME = "extra_display_name"; + public static final String EXTRA_EMAIL = "extra_email"; + + private enum AccountType {CLIENTE, ESTABELECIMENTO} + private enum AccountAction {ENTRAR, CRIAR} + + 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; + private EditText inputName; + private EditText inputEmail; + private EditText inputPassword; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + EdgeToEdge.enable(this); + setContentView(R.layout.activity_main); + 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; + }); + + bindViews(); + setupTypeToggle(); + setupActionToggle(); + setupPrimaryAction(); + } + + 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); + inputName = findViewById(R.id.inputName); + inputEmail = findViewById(R.id.inputEmail); + inputPassword = findViewById(R.id.inputPassword); + } + + private void setupTypeToggle() { + btnCliente.setOnClickListener(v -> { + selectedAccountType = AccountType.CLIENTE; + updateTypeButtons(); + }); + btnEstabelecimento.setOnClickListener(v -> { + selectedAccountType = AccountType.ESTABELECIMENTO; + updateTypeButtons(); + }); + updateTypeButtons(); + } + + private void setupActionToggle() { + btnEntrar.setOnClickListener(v -> { + selectedAccountAction = AccountAction.ENTRAR; + updateActionButtons(); + }); + btnCriarConta.setOnClickListener(v -> { + selectedAccountAction = AccountAction.CRIAR; + updateActionButtons(); + }); + updateActionButtons(); + } + + private void setupPrimaryAction() { + btnPrimaryAction.setOnClickListener(v -> handlePrimaryAction()); + updatePrimaryActionState(); + } + + private void updateTypeButtons() { + setSelectedState(btnCliente, selectedAccountType == AccountType.CLIENTE); + setSelectedState(btnEstabelecimento, selectedAccountType == AccountType.ESTABELECIMENTO); + } + + private void updateActionButtons() { + setSelectedState(btnEntrar, selectedAccountAction == AccountAction.ENTRAR); + setSelectedState(btnCriarConta, selectedAccountAction == AccountAction.CRIAR); + updatePrimaryActionState(); + } + + private void setSelectedState(Button button, boolean isSelected) { + button.setBackgroundResource(isSelected ? R.drawable.tab_selected : R.drawable.tab_unselected); + button.setTextColor(isSelected ? Color.WHITE : Color.parseColor("#00001A")); + } + + private void updatePrimaryActionState() { + boolean creatingAccount = selectedAccountAction == AccountAction.CRIAR; + btnPrimaryAction.setText(creatingAccount ? "Criar Conta" : "Entrar"); + inputName.setVisibility(creatingAccount ? View.VISIBLE : View.GONE); + } + + private void handlePrimaryAction() { + String email = inputEmail.getText().toString().trim(); + String password = inputPassword.getText().toString().trim(); + String providedName = inputName.getText().toString().trim(); + + if (TextUtils.isEmpty(email) || TextUtils.isEmpty(password)) { + Toast.makeText(this, "Preencha email e palavra-passe.", Toast.LENGTH_SHORT).show(); + return; + } + + if (selectedAccountAction == AccountAction.CRIAR && TextUtils.isEmpty(providedName)) { + Toast.makeText(this, "Indique o seu nome para criar conta.", Toast.LENGTH_SHORT).show(); + return; + } + + String fallbackName = !TextUtils.isEmpty(providedName) ? providedName : deriveNameFromEmail(email); + Intent nextScreen; + + if (selectedAccountType == AccountType.CLIENTE) { + nextScreen = new Intent(this, ClientDashboardActivity.class); + } else { + nextScreen = new Intent(this, EstablishmentDashboardActivity.class); + } + + nextScreen.putExtra(EXTRA_ACTION_MODE, selectedAccountAction.name()); + nextScreen.putExtra(EXTRA_DISPLAY_NAME, fallbackName); + nextScreen.putExtra(EXTRA_EMAIL, email); + startActivity(nextScreen); + } + + private String deriveNameFromEmail(String email) { + if (!email.contains("@")) { + return "Utilizador"; + } + String candidate = email.substring(0, email.indexOf("@")); + if (candidate.isEmpty()) { + return "Utilizador"; + } + String firstLetter = candidate.substring(0, 1).toUpperCase(); + String rest = candidate.length() > 1 ? candidate.substring(1) : ""; + return firstLetter + rest; + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_tabs.xml b/app/src/main/res/drawable/bg_tabs.xml new file mode 100644 index 0000000..3508ae9 --- /dev/null +++ b/app/src/main/res/drawable/bg_tabs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/btn_light.xml b/app/src/main/res/drawable/btn_light.xml new file mode 100644 index 0000000..9748faa --- /dev/null +++ b/app/src/main/res/drawable/btn_light.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/btn_light_border.xml b/app/src/main/res/drawable/btn_light_border.xml new file mode 100644 index 0000000..6ece8e5 --- /dev/null +++ b/app/src/main/res/drawable/btn_light_border.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/btn_primary.xml b/app/src/main/res/drawable/btn_primary.xml new file mode 100644 index 0000000..0fa08e8 --- /dev/null +++ b/app/src/main/res/drawable/btn_primary.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/circle_bg.xml b/app/src/main/res/drawable/circle_bg.xml new file mode 100644 index 0000000..60f802b --- /dev/null +++ b/app/src/main/res/drawable/circle_bg.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/input_bg.xml b/app/src/main/res/drawable/input_bg.xml new file mode 100644 index 0000000..ae065a3 --- /dev/null +++ b/app/src/main/res/drawable/input_bg.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/na_mesa.png b/app/src/main/res/drawable/na_mesa.png new file mode 100644 index 0000000..16cacc7 Binary files /dev/null and b/app/src/main/res/drawable/na_mesa.png differ diff --git a/app/src/main/res/drawable/tab_selected.xml b/app/src/main/res/drawable/tab_selected.xml new file mode 100644 index 0000000..f079140 --- /dev/null +++ b/app/src/main/res/drawable/tab_selected.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/tab_unselected.xml b/app/src/main/res/drawable/tab_unselected.xml new file mode 100644 index 0000000..4deeebe --- /dev/null +++ b/app/src/main/res/drawable/tab_unselected.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_client_dashboard.xml b/app/src/main/res/layout/activity_client_dashboard.xml new file mode 100644 index 0000000..dee0a62 --- /dev/null +++ b/app/src/main/res/layout/activity_client_dashboard.xml @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +