From 446b6fed75e242cc6effd1a0ed548a9f9b9b1531 Mon Sep 17 00:00:00 2001 From: 230409 <230409@epvc.pt> Date: Wed, 3 Dec 2025 10:21:22 +0000 Subject: [PATCH] first commit --- .gitignore | 15 + .idea/.gitignore | 3 + .idea/AndroidProjectSystem.xml | 6 + .idea/appInsightsSettings.xml | 40 +++ .idea/compiler.xml | 6 + .idea/deploymentTargetSelector.xml | 10 + .idea/gradle.xml | 19 ++ .idea/migrations.xml | 10 + .idea/misc.xml | 10 + .idea/runConfigurations.xml | 17 + .idea/studiobot.xml | 6 + .idea/vcs.xml | 6 + .vscode/settings.json | 3 + app/.gitignore | 1 + app/build.gradle.kts | 44 +++ app/proguard-rules.pro | 21 ++ .../pap_teste/ExampleInstrumentedTest.java | 26 ++ app/src/main/AndroidManifest.xml | 35 ++ .../pap_teste/ClientDashboardActivity.java | 62 ++++ .../EstablishmentDashboardActivity.java | 54 +++ .../com/example/pap_teste/MainActivity.java | 160 +++++++++ app/src/main/res/drawable/bg_tabs.xml | 8 + app/src/main/res/drawable/btn_light.xml | 5 + .../main/res/drawable/btn_light_border.xml | 6 + app/src/main/res/drawable/btn_primary.xml | 18 + app/src/main/res/drawable/circle_bg.xml | 8 + .../res/drawable/ic_launcher_background.xml | 170 ++++++++++ .../res/drawable/ic_launcher_foreground.xml | 30 ++ app/src/main/res/drawable/input_bg.xml | 7 + app/src/main/res/drawable/na_mesa.png | Bin 0 -> 8719 bytes app/src/main/res/drawable/tab_selected.xml | 5 + app/src/main/res/drawable/tab_unselected.xml | 5 + .../res/layout/activity_client_dashboard.xml | 256 +++++++++++++++ .../activity_establishment_dashboard.xml | 309 ++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 167 ++++++++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 6 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 6 + app/src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 0 -> 1404 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 0 -> 2898 bytes app/src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 0 -> 982 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 0 -> 1772 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 0 -> 1900 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 0 -> 3918 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 0 -> 2884 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 0 -> 5914 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 0 -> 3844 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 0 -> 7778 bytes app/src/main/res/values-night/themes.xml | 7 + app/src/main/res/values/colors.xml | 5 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/themes.xml | 9 + app/src/main/res/xml/backup_rules.xml | 13 + .../main/res/xml/data_extraction_rules.xml | 19 ++ .../example/pap_teste/ExampleUnitTest.java | 17 + build.gradle.kts | 4 + gradle.properties | 21 ++ gradle/libs.versions.toml | 24 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59203 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 185 +++++++++++ gradlew.bat | 89 +++++ settings.gradle.kts | 23 ++ 62 files changed, 1985 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/AndroidProjectSystem.xml create mode 100644 .idea/appInsightsSettings.xml create mode 100644 .idea/compiler.xml create mode 100644 .idea/deploymentTargetSelector.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/migrations.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 .idea/studiobot.xml create mode 100644 .idea/vcs.xml create mode 100644 .vscode/settings.json create mode 100644 app/.gitignore create mode 100644 app/build.gradle.kts create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/example/pap_teste/ExampleInstrumentedTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/example/pap_teste/ClientDashboardActivity.java create mode 100644 app/src/main/java/com/example/pap_teste/EstablishmentDashboardActivity.java create mode 100644 app/src/main/java/com/example/pap_teste/MainActivity.java create mode 100644 app/src/main/res/drawable/bg_tabs.xml create mode 100644 app/src/main/res/drawable/btn_light.xml create mode 100644 app/src/main/res/drawable/btn_light_border.xml create mode 100644 app/src/main/res/drawable/btn_primary.xml create mode 100644 app/src/main/res/drawable/circle_bg.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/drawable/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/input_bg.xml create mode 100644 app/src/main/res/drawable/na_mesa.png create mode 100644 app/src/main/res/drawable/tab_selected.xml create mode 100644 app/src/main/res/drawable/tab_unselected.xml create mode 100644 app/src/main/res/layout/activity_client_dashboard.xml create mode 100644 app/src/main/res/layout/activity_establishment_dashboard.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/values-night/themes.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/themes.xml create mode 100644 app/src/main/res/xml/backup_rules.xml create mode 100644 app/src/main/res/xml/data_extraction_rules.xml create mode 100644 app/src/test/java/com/example/pap_teste/ExampleUnitTest.java create mode 100644 build.gradle.kts create mode 100644 gradle.properties create mode 100644 gradle/libs.versions.toml create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle.kts 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 0000000000000000000000000000000000000000..16cacc7d7bfa4a8200bbba69e736fb53df96f4d7 GIT binary patch literal 8719 zcmdUTWmud^)9w&F1P>A*xVr_{;7)LYyX)XC0fIY&6WrY)!C`QB2p-(sIg{P}cK5v3 z`~5%XnX9Mksj9oHtGlMFdO{WDC6Hg^y#@dP$WoG`N{~Jq(k2mJLB7j_IHLf7H?kHY zB8pNXBE*W0cBU5ACIEnBXrem2hVlS*rj`;341%bT^sXFQF;w1{@mG>e0YzWPg{WC5 zVX$~xiq;mzVCY(2Z{(EH5r-qU)=*!!X()c0?G4az$9%P0Q|V>bW_SE}lg0Lu4m=+I z;R^WXdYV6}t%B*tC)GyJLGJfKfICQR|CNe9f|DN-^Dm?=C3z<&7(bJ$Cr@`zWa7c= znn0z4tf!ZHb3`#mD1an;&)&yoV$=;isE#yPB~1Z23)?MPB8R_)m zt`X_C8G{IMXWurSotWe{-{(PlEF^JB)%%9iD(ZeXv9z+h)K%8O-XMA66 zz9FZ_S4^7~`WD9DagJP)$O#An5lRjBn6`wfwNr<(&U_0teL>%~d)EkNt4hoUJ{l#m zbbsd`Ou?w=*+**!jB7+z#u|9K}JJ%l*RmDWq!e z!eM(@W68;d@}mLIZ)Vzvl)#u5e+E;yXk!H!_>@nb+ zMbFRB1FI3l{Dn*A9cm=w&d$}H(^sYW6RtH98r%_Pz*Z#LZAg_qan1H78J zRPWuY*#&uYe^Keij-ZCC-36Y&qWdAeffIFsc4GJp44Hb3x7?$xul>w+|l2Pb&Vw@Ga z`$TdPLh=B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ePG$sFsGNUaL9ISlV$gWgN;r5-?&Nm>}P6 zU4|63jLT;|XWJub;Ao=NAk;N&KXb-OxFmsOpF;2AMi-`sb1pmjen1-}SDb3NnqR zJ>IAwwagJGvV)Vib37C-$Q=&LuJ><7@t0A+8bX|LbDbIXZZIH+WgRA-u?k5~4?#67 zGw#Ez(u%mTWAP;YqRC!KwGYzey$+_>0!%tB2?I&=RD&=m8wI`rP_^DsECHX~#Cgav z?fO0t)Cnvovf(b;m0kohYBgAI52uu>SB{#&Wta}2(DBgA-&%c}V2BEWwl3l@8zn$C zYf%dlbM;bPYEjkM!d1LAjs&i8t>!xWUB1!RVIMLrFDsd5Bi1X;B|yToXxSOfz@N3o z3dHwX7`NR_r%HAz88e4oK-r+bqUtkacqIzW7!x~6-UJCA_2M-pBTS#eHmz3XWblR9 zd0!-ct*l@uHpa%8D>A><#xXcF z0U>j9I17@Yt9{>kI+uU05A%K*MithV@ofk-7CDV2lc>o!jUf?X)iI#hSl8(CK3c4g z0G(xBM7Xa}OaLoYa^A1@H9r{4~u_&?oW11krf&VuJ7IgOu1D2wp4SyHG}5RU_q_Zg9OVxIB_2 zI55JI9_ewQmfc%Q;hF_ACZvXLDke`hvN@DR>rj8d1ZOkn+nH@>5Va~=QbvgwNUx6e wR13IdPs<{9 literal 0 HcmV?d00001 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +