Skip to content

Repository files navigation

Banking Project – Bank Account Management Application

Project Overview

This project is an Android application for bank account management built using the MVVM architecture. It uses Room for local data persistence, LiveData for reactive UI updates, and ViewModel to separate business logic from the user interface.

Implemented Features

The following sections describe the features implemented based on the instructor's roadmap. These 18 implemented features cover the requirements proposed in the assignment.

Completed Features

1. RecyclerView in ContasActivity Integrated with LiveData

The RecyclerView was configured to display the list of accounts provided by the ContaViewModel through LiveData<List<Conta>>. This ensures that the UI is automatically updated whenever the database changes.

2. Dynamic Account Icon in ContaViewHolder

Each account item displays an icon based on its balance. Accounts with a negative balance show a warning icon, while accounts with a positive balance display a confirmation icon, making it easier to identify an account's status.

3. Account Removal from ContaViewHolder

A delete button was added directly to each RecyclerView item. It invokes the corresponding method in the ContaViewModel, allowing accounts to be removed instantly, with changes immediately reflected in the UI.

4. Passing the Account Number to EditarContaActivity

The account number is passed through an Intent when opening EditarContaActivity. This allows the activity to identify and load the correct account for editing or deletion.

5. Account Validation During Creation

AdicionarContaActivity includes complete form validation, checking required fields and ensuring the account balance is a valid numeric value. This prevents inconsistent records from being stored in the database.

6. Update and Delete Methods in the DAO

ContaDAO was extended with @Update and @Delete methods, allowing centralized update and deletion operations.

7. Custom DAO Queries

Custom SQL queries were implemented to search accounts by account number, account holder's name, or CPF, providing greater flexibility for searches.

8. Repository and ViewModel Support for CRUD Operations

ContaRepository and ContaViewModel were expanded to support updating, deleting, and searching accounts. All database operations run on background threads, following Android best practices.

9. Account Editing

EditarContaActivity retrieves the account number from the Intent, loads the corresponding account from the database, validates user input, and provides options to update or remove the account. The validation logic is consistent with the account creation screen.

10. BancoViewModel for Financial Operations

BancoViewModel centralizes all financial operations, including deposits, withdrawals, and transfers. This keeps business rules separate from the UI layer.

11. Validation for Financial Transactions

The corresponding Activities validate that accounts exist and that transaction amounts are positive before performing deposits, withdrawals, or transfers. This prevents invalid or inconsistent operations.

12. Transaction Logging

Every financial operation generates a transaction record in the database. Transfers create two records: one debit transaction and one credit transaction, ensuring complete traceability.

13. Account Search by Multiple Criteria

PesquisarActivity provides a search system that allows users to search by account number, account holder's name, or CPF. Search results update the RecyclerView dynamically, improving the user experience.

14. Total Bank Balance Displayed on the Main Screen

The main screen displays the total balance across all accounts by summing every account balance, including negative balances, providing a realistic overview of the bank's financial status.

15. Color Highlighting for Debit Transactions

In TransacaoViewHolder, debit transaction amounts are displayed in red to improve the readability of the transaction history.

16. Transaction Queries

TransacaoDAO, TransacaoRepository, and TransacaoViewModel include search methods that filter transactions by account number, date, or transaction type (credit, debit, or all transactions).

17. Transaction History Screen

TransacoesActivity initially displays all transactions and allows users to filter them according to different criteria, making it easier to review financial activity.

18. Integration Between BancoViewModel and TransacaoViewModel

Financial operations performed through BancoViewModel are integrated with TransacaoViewModel, ensuring that every operation automatically generates and stores a corresponding transaction record.

Project Structure

UI Layer: ContasActivity, EditarContaActivity, AdicionarContaActivity, PesquisarActivity, TransacoesActivity, along with their adapters and view holders.

ViewModels: ContaViewModel, BancoViewModel, TransacaoViewModel.

Repositories: ContaRepository, TransacaoRepository.

DAOs: ContaDAO, TransacaoDAO.

Database: BancoDB class using Room as the local database.

Application Architecture & Component Interaction

Application Structure Component Interaction

Implementation Decisions

MVVM Architecture: The MVVM pattern was adopted to ensure a clear separation of responsibilities between the UI, business logic, and data layers.

Room Database: Room was chosen as the local persistence solution because of its simplicity, reliability, and seamless integration with Android Architecture Components.

Background Threads: All database operations are executed on background threads using @WorkerThread, preventing UI blocking and maintaining application responsiveness.

Intent-Based Parameter Passing: Intent.putExtra() is used to pass the account number between Activities, enabling smooth navigation and data sharing.

Reactive UI Updates: LiveData is used to observe account and transaction lists, allowing the RecyclerView to update automatically whenever the underlying data changes.

Conditional Icons: ContaViewHolder contains simple logic to display different icons depending on whether the account balance is positive or negative.

DAO-Level Filtering: Search filters are implemented directly in SQL queries within the DAO layer, improving performance and minimizing processing in the UI layer.

Code Organization and Reusability: Data access is centralized within the Repository layer, providing a single access point for database operations and making the codebase easier to maintain and extend.

UI Design: The application's color palette is based on the official colors of the Center for Informatics (CIn), giving the interface a visual style consistent with the institution's academic identity.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages