commit 05308a944e4d503bb9886f32e1181a404c42b98d Author: 230402 <230402@epvc.pt> Date: Wed Jan 21 10:38:40 2026 +0000 login, registrar e tela home adicionados 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/.name b/.idea/.name new file mode 100644 index 0000000..66e3dbc --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Finzora \ No newline at end of file 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/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..b2c751a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ 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/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/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..a3dcf35 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + alias(libs.plugins.android.application) +} + +android { + namespace = "com.example.finzora" + compileSdk { + version = release(36) + } + + defaultConfig { + applicationId = "com.example.finzora" + 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) +} \ 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/finzora/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/finzora/ExampleInstrumentedTest.java new file mode 100644 index 0000000..c3f4ba3 --- /dev/null +++ b/app/src/androidTest/java/com/example/finzora/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.finzora; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +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.finzora", 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..55134a1 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/finzora/DicasFragment.java b/app/src/main/java/com/example/finzora/DicasFragment.java new file mode 100644 index 0000000..f05b067 --- /dev/null +++ b/app/src/main/java/com/example/finzora/DicasFragment.java @@ -0,0 +1,6 @@ +package com.example.finzora; + +import androidx.fragment.app.Fragment; + +public class DicasFragment extends Fragment { +} diff --git a/app/src/main/java/com/example/finzora/GraficosFragment.java b/app/src/main/java/com/example/finzora/GraficosFragment.java new file mode 100644 index 0000000..a7e3774 --- /dev/null +++ b/app/src/main/java/com/example/finzora/GraficosFragment.java @@ -0,0 +1,6 @@ +package com.example.finzora; + +import androidx.fragment.app.Fragment; + +public class GraficosFragment extends Fragment { +} diff --git a/app/src/main/java/com/example/finzora/LoginActivity.java b/app/src/main/java/com/example/finzora/LoginActivity.java new file mode 100644 index 0000000..3689b84 --- /dev/null +++ b/app/src/main/java/com/example/finzora/LoginActivity.java @@ -0,0 +1,69 @@ +package com.example.finzora; + +import android.content.Intent; +import android.os.Bundle; +import android.text.TextUtils; +import android.widget.Button; +import android.widget.TextView; +import android.widget.Toast; +import androidx.appcompat.app.AppCompatActivity; +import com.google.android.material.textfield.TextInputEditText; + +public class LoginActivity extends AppCompatActivity { + + private TextInputEditText editEmail, editPassword; + private Button btnEntrar; + private TextView txtRegistrar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login); + + // 1. Inicializar os componentes da interface + inicializarComponentes(); + + // 2. Configurar o clique no botão "Entrar" + btnEntrar.setOnClickListener(v -> validarDados()); + + // 3. Configurar o clique para ir para a tela de Registo + txtRegistrar.setOnClickListener(v -> { + Intent intent = new Intent(LoginActivity.this, RegisterActivity.class); + startActivity(intent); + }); + } + + private void validarDados() { + String email = editEmail.getText().toString().trim(); + String password = editPassword.getText().toString().trim(); + + if (TextUtils.isEmpty(email)) { + editEmail.setError("Introduza o seu email"); + editEmail.requestFocus(); + } else if (TextUtils.isEmpty(password)) { + editPassword.setError("Introduza a sua palavra-passe"); + editPassword.requestFocus(); + } else { + // Se tudo estiver OK, por enquanto vamos apenas simular o login + // e saltar para o Dashboard (que será a nossa próxima fase) + Toast.makeText(this, "Login efetuado com sucesso!", Toast.LENGTH_SHORT).show(); + + // Aqui é onde irás validar com a Base de Dados ou Firebase no futuro + irParaDashboard(); + } + } + + private void irParaDashboard() { + // Altera 'MainActivity' para o nome da tua classe do Dashboard + Intent intent = new Intent(LoginActivity.this, MainActivity.class); + startActivity(intent); + finish(); // Fecha o login para o utilizador não voltar atrás ao carregar no botão 'back' + } + + private void inicializarComponentes() { + editEmail = findViewById(R.id.editEmail); + editPassword = findViewById(R.id.editPassword); + btnEntrar = findViewById(R.id.btnEntrar); + txtRegistrar = findViewById(R.id.txtRegistrar); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/finzora/MainActivity.java b/app/src/main/java/com/example/finzora/MainActivity.java new file mode 100644 index 0000000..9e47a25 --- /dev/null +++ b/app/src/main/java/com/example/finzora/MainActivity.java @@ -0,0 +1,77 @@ +package com.example.finzora; + +import android.content.Intent; +import android.os.Bundle; +import android.widget.Button; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.viewpager2.widget.ViewPager2; +import com.google.android.material.tabs.TabLayout; +import com.google.android.material.tabs.TabLayoutMediator; + +public class MainActivity extends AppCompatActivity { + + private Button btnSair; + private TabLayout tabLayout; + private ViewPager2 viewPager; + private TextView tvNomeUsuario; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + // 1. PRIMEIRO PASSO OBRIGATÓRIO: Ligar as variáveis ao XML + inicializarComponentes(); + + // 2. Agora sim, podemos tentar mudar o nome com segurança + try { + String nomeRecebido = getIntent().getStringExtra("CHAVE_NOME"); + + // Só altera o texto se realmente tivermos recebido um nome (ex: vindo do Registo) + if (nomeRecebido != null) { + tvNomeUsuario.setText("Olá, " + nomeRecebido + "!"); + } + } catch (Exception e) { + e.printStackTrace(); // Se der erro, ignora e mantém o texto original + } + + // 3. Configurar os botões e abas + configurarBotaoSair(); + configurarAbas(); + } + + private void inicializarComponentes() { + btnSair = findViewById(R.id.btnSair); + tabLayout = findViewById(R.id.tabLayoutDashboard); + viewPager = findViewById(R.id.viewPager); + tvNomeUsuario = findViewById(R.id.tvNomeUsuario); // Certifica-te que este ID existe no XML + } + + private void configurarBotaoSair() { + btnSair.setOnClickListener(v -> { + Intent intent = new Intent(MainActivity.this, LoginActivity.class); + startActivity(intent); + finish(); + }); + } + + private void configurarAbas() { + ViewPagerAdapter adapter = new ViewPagerAdapter(this); + viewPager.setAdapter(adapter); + + new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> { + switch (position) { + case 0: + tab.setText("Transações"); + break; + case 1: + tab.setText("Gráficos"); + break; + case 2: + tab.setText("Dicas"); + break; + } + }).attach(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/finzora/RegisterActivity.java b/app/src/main/java/com/example/finzora/RegisterActivity.java new file mode 100644 index 0000000..ebe8c97 --- /dev/null +++ b/app/src/main/java/com/example/finzora/RegisterActivity.java @@ -0,0 +1,66 @@ +package com.example.finzora; + +import android.content.Intent; +import android.os.Bundle; +import android.text.TextUtils; +import android.widget.Button; +import android.widget.TextView; +import android.widget.Toast; +import androidx.appcompat.app.AppCompatActivity; +import com.google.android.material.textfield.TextInputEditText; + +public class RegisterActivity extends AppCompatActivity { + + private TextInputEditText editNome, editEmail, editPassword, editConfirmPassword; + private Button btnCriarConta; + private TextView txtLogin; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_register); + + inicializarComponentes(); + + // Volta para a tela de Login + txtLogin.setOnClickListener(v -> finish()); + + // Valida e cria a conta + btnCriarConta.setOnClickListener(v -> validarDados()); + } + + private void validarDados() { + String nome = editNome.getText().toString().trim(); + String email = editEmail.getText().toString().trim(); + String password = editPassword.getText().toString().trim(); + String confirmPass = editConfirmPassword.getText().toString().trim(); + + if (TextUtils.isEmpty(nome)) { + editNome.setError("Introduza o seu nome"); + } else if (TextUtils.isEmpty(email)) { + editEmail.setError("Introduza um email válido"); + } else if (TextUtils.isEmpty(password)) { + editPassword.setError("Defina uma palavra-passe"); + } else if (password.length() < 6) { + editPassword.setError("A senha deve ter pelo menos 6 caracteres"); + } else if (!password.equals(confirmPass)) { + editConfirmPassword.setError("As palavras-passe não coincidem"); + } else { + + Toast.makeText(this, "Conta criada com sucesso!", Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(RegisterActivity.this, MainActivity.class); + intent.putExtra("CHAVE_NOME", nome); + startActivity(intent); + finish(); + } + } + + private void inicializarComponentes() { + editNome = findViewById(R.id.editNome); + editEmail = findViewById(R.id.editEmailRegister); + editPassword = findViewById(R.id.editPassRegister); + editConfirmPassword = findViewById(R.id.editConfirmPass); + btnCriarConta = findViewById(R.id.btnCriarConta); + txtLogin = findViewById(R.id.txtLogin); + } +} diff --git a/app/src/main/java/com/example/finzora/TransacoesFragment.java b/app/src/main/java/com/example/finzora/TransacoesFragment.java new file mode 100644 index 0000000..f9a0849 --- /dev/null +++ b/app/src/main/java/com/example/finzora/TransacoesFragment.java @@ -0,0 +1,6 @@ +package com.example.finzora; + +import androidx.fragment.app.Fragment; + +public class TransacoesFragment extends Fragment { +} diff --git a/app/src/main/java/com/example/finzora/ViewPagerAdapter.java b/app/src/main/java/com/example/finzora/ViewPagerAdapter.java new file mode 100644 index 0000000..bcdee36 --- /dev/null +++ b/app/src/main/java/com/example/finzora/ViewPagerAdapter.java @@ -0,0 +1,30 @@ +package com.example.finzora; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.viewpager2.adapter.FragmentStateAdapter; + +public class ViewPagerAdapter extends FragmentStateAdapter { + + public ViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) { + super(fragmentActivity); + } + + @NonNull + @Override + public Fragment createFragment(int position) { + // Aqui definimos a ordem das abas + switch (position) { + case 0: return new TransacoesFragment(); // Aba 1 + case 1: return new GraficosFragment(); // Aba 2 + case 2: return new DicasFragment(); // Aba 3 + default: return new TransacoesFragment(); + } + } + + @Override + public int getItemCount() { + return 3; // Temos 3 abas no total + } +} diff --git a/app/src/main/res/drawable/greenarrow.png b/app/src/main/res/drawable/greenarrow.png new file mode 100644 index 0000000..b1ec68a Binary files /dev/null and b/app/src/main/res/drawable/greenarrow.png differ 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/ic_wallet.xml b/app/src/main/res/drawable/ic_wallet.xml new file mode 100644 index 0000000..d7707dd --- /dev/null +++ b/app/src/main/res/drawable/ic_wallet.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/imagem_convertida.png b/app/src/main/res/drawable/imagem_convertida.png new file mode 100644 index 0000000..842cd2b Binary files /dev/null and b/app/src/main/res/drawable/imagem_convertida.png differ diff --git a/app/src/main/res/drawable/logout.png b/app/src/main/res/drawable/logout.png new file mode 100644 index 0000000..831ba25 Binary files /dev/null and b/app/src/main/res/drawable/logout.png differ diff --git a/app/src/main/res/drawable/redarrow.png b/app/src/main/res/drawable/redarrow.png new file mode 100644 index 0000000..73c9be6 Binary files /dev/null and b/app/src/main/res/drawable/redarrow.png differ diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml new file mode 100644 index 0000000..c82bf90 --- /dev/null +++ b/app/src/main/res/layout/activity_login.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + +