+34 681 386 013 sergioalvarez3000@gmail.com
Select Page

App-shows Android architecture

The “Counter Classic XML Views MVVM” application is a time counter, it counts 10 units every second and has a button to set time flags, these flags record the current value of the counter and display them in a list.

The purpose of this app is to show a clean, efficient and architectural code, in terms of software, that follows the best practices recommended by Google. MVVM implementing livedata, coroutines, room, singleton patterns, strings in strings folder, (simple) view with XML and constraint layout and some other cool stuff!

 

Developed in Android Studio directly illustrates my Android architecture skills.

Link – gitHub

Technical description of the app

Implementing room with coroutines, viewmodel with livedata and reactive UI, this small sample of my skills in Android app architecture focuses the code structure towards the best practices recommended by Google in terms of MVVM such as the use of ViewModels to format data for the UI, which has observers as a means of updating screen data. The UI operates with actions on the ViewModel which implements repository injection through a creational factory pattern for some IO operations that do not require user action, these that do respond to user interaction are treated in the usesCases, which are the CounterUseCase and InsertFlagUseCase.

File structure and overview of some relevant class of the app

The CounterUseCase class, located in the domain layer, is responsible for the unit counter (10 per second), which shows the screen at startup. This class uses coroutines and a Job variable to manage the counting cycle, one problem that arose was that the counter was speeding up in certain situations.

This class implements an interface, which is injected into the viewModel from its factory method, the MainActivity instantiates the use case from the application class. This pattern (repeated in the repository and in the insert flag use case) allows decoupling of classes and maintains the best SOLID principles, which are adhered to to a fairly high degree.

The dependencies that are injected are an example of manual dependency injection. The principle of single responsibility is fulfilled throughout the project.

In short, it’s a sample project following many of the modern Android architecture and development best practices.