Tecnical details
Architecture
The app is structured using the MVVM (Model-View-ViewModel) architectural pattern and employs a modularized design, with each feature encapsulated as a separate module. Fragments are seamlessly connected to their respective XML layout files using data binding, enabling a clear separation of concerns and reducing boilerplate code. ViewModels and LiveData are utilized to manage presentation logic, ensuring reactive and lifecycle-aware UI updates. Repositories serve as an abstraction layer for database operations, facilitating efficient data management and promoting scalability.
Recycle bin
The application leverages Google ML Kit Vision for barcode scanning. Upon successfully reading a barcode, the program executes a query to check if the product exists in the database. If the product is found, it is added to the selling products list. If not, the user is notified that the product is not registered and is offered the option to register it. Once the sale is finalized, a receipt is generated, and its unique key is passed as a navigation argument to allow the user to view the receipt.
Selling functionality
A Pending Intent wraps an Intent that contains the action to mark the task as done. When the “mark as done” button is pulsed, the Pending Intent is activated, consequently sending a broadcast. Then, the broadcast receiver processes the broadcasted action and calls the method to mark the notified task as done.
Most sold product and Sales/revenue graphics
This data is displayed leveraging SQL queries and MPAndroidChart (open-source library).