The CSTV app show a list with the running and upcoming CS2 matches. It allows you to see the match details like players and scheduled time.
The architecture of the app follows the best practices and recommended architecture for modern app development from the android developer guide.
The overall architecture looks as shown on the image below:
The app has three main well-defined layers, implementing the MVVM architecture pattern, is separated into packages where each package contains a child feature package with each feature's components. The feature packages are mainlist
and matchdetails
.
- Presentation:
- The Presentation layer, also known as UI layer, is responsible for displaying the application data on the screen and also serve as the primary entry point for user interaction.
- Inside the Presentation layer the app has the MainActivity which shows the Splash Screen and adds the Fragments for each feature/screen in the app.
- In this layer the app has the
Activities
,Fragments
and itsViewModels
andAdapters
for the lists used.
- Data:
- The Data layer connects to the Panda Score API pointing to CS:GO endpoints.
- Inside the Data layer the app has the implementation of the domain's repository contract to fetch the data. In this example data is fetched from the api which is accessed using the Retrofit library under the remote package. Finally there is a mapper which is responsible for mapping the response we get from the API, here the app uses a
DTO
andEntity
types of classes to convert between remote and domain models in order for the domain models to not have any dependency to the remote implementation selected.
- Domain:
- The domain Layer contains some core classes that are used on the App.
- There is the
DataResponse
used to pass the data response from data layer to presentation layer whereas Success is used after the execution returned successfully and Error is used when an error occurred during execution. - Each feature has a package following the app architecture with its model and its repository's contract.
Overall this architecture is very robust, follows the official android developer guideline and makes it easy to maintain and scale the application.
For unit testing there is a unit test for each feature view model (MainListViewModelTest
and MatchDetailsViewModelTest
) which is where the business logic of the application is.
This is a standard Android application. To run the project you will need to follow the steps:
- Import the project into Android Studio
- Create a
local.properties
file under app project folder- Inside the new file add the line:
pandascore_token="you panda score api token string here"
- Inside the new file add the line:
- Build and Run the project
Watch the demo video on Google Drive
The project was developed using some of the Android Jetpack Libraries and some third-party libraries as well.
- View Binding: Feature that allows to write code that interacts with views, replacing the
findViewById
. For more details see the official docs. - Paging3: The Paging Library makes it easier for you to load data gradually and gracefully within your app's RecyclerView. See the official page.
- SwipeRefreshLayout: A widget to implement the swipe to refresh UI-pattern. Docs.
- Kotlin coroutines: used to manage long-running tasks that might otherwise block the main thread. For more information see The Kotlin coroutines official doc for Android
- Kotlin coroutines flow: used to emit multiple values sequentially from the data layer to the presentation layer. For more details check Kotlin flows on Android
- Hilt: dependency injection library for Android that reduces the boilerplate of doing manual dependency injection in the project. For more details see the Dependency injection with Hilt
- SplashScreen API: Library to implement splash screen easily on Android. Check Android official docs.
- Retrofit + OkHttp: Http clients to simplify the communication with the Panda Score Docs. Official docs
- Glide: Used to load the url images into the ImageView for the events. Official docs
- MockK: a mocking library for Kotlin. Official website
- Turbine: a library to test kotlinx.coroutines flows. Official repository and docs