Skip to content

A currency calculator Android application with Coroutines, ViewBinding (DataBinding in previous version), and also with MVVM and clean architecture.

Notifications You must be signed in to change notification settings

andrejoshua/alphavantageapp

Repository files navigation

AlphaVantage App

AlphaVantage is just an example of forex (currency) calculator Android application with Clean Architecture approach, integrated with AlphaVantage API. This application is still being maintained to keep updated with current technology standards.

Features (Pages)

As the time of writing, the application only has 2 pages, main pages, and currency pages. Since AlphaVantage doesn't provide the list of currencies, so i fetched it from here. Note: not all currencies can be calculated.

This project also uses API 16 as minimum API level.

Architecture

Module Structure

This architecture mostly follows the mix of this and this. See those links for detailed explanation about Clean Architecture.

Architectural Approach & Separation of Concern

Detailed Class Structure

There are few additional points i will explain given the picture:

  • LiveData<Event> is basically a LiveData that will not retrieve any values until the previous value is consumed. Refer to this.
  • This app uses Navigation components to communicate between Fragments, but directly from ViewModel without sending callback to its Fragment. NavManager class contains navigate(NavDirections) to navigate current fragment to next destination fragment and getArgs(): NavArgs? to get arguments from previous fragment.
  • retrieveNetwork() is a function to integrate repository with asynchronous Flow (which will be converted to LiveData). retrieveNetworkAndSync() is basically previously mentioned function with synchronization to local repository. See Usecase class.
  • Any exceptions retrieved from API client (Retrofit) will be handled in getResult(). See BaseImplementation class.

Project Libraries