Sample app which access the TDC (The Developer's Conference) REST API.
In this sample I tried to follow the Clean Architecture principles and use some cool Android libraries.
The Application is divided in modules as displayed below:
- UI contains all UI related classes (Activities, Fragments, Adapters, etc.). The dependency injection is also declared in this layer.
- Presentation stores all view model classes, once this project is trying to follow the MVVM pattern.
- Domain in this module are declared the application's use cases and the basic data classes used as DTO. This layer also declares the basic operations that must be provided by the application's repository.
- Data defines a basic repository flow to access two data sources: a remote (to retrieve data from the sever); and local (for now, just to save bookmarked sessions).
- Data Remote contains a implementation of a remote data source.
- Data Local contains a implementation of a local data source.
- Data Memory could be used as remote repository for development purposes (or if you don't have an API key, see the section ).
This screen lists all events organized by Global Code organized by date and showing the most recent on top.
The activities (e.g.: sessions, workshops, etc.) that will/were occur in the event are displayed in this screen grouped by date.
This screen display the sessions for a given modality sorted by time.
Session details are shown in this screen, including the speaker and his mini-bio.
This project is written in Kotlin and it's using the following libraries:
- AppCompat
- Android Architecture Components (View Model, Lifecycle, LiveData and Room)
- ConstraintLayout
- Material Design Components Library
- Glide
- Gson
- JUnit
- Koin
- Mockito
- OkHttp
- Retrofit
- Robolectric
- RXJava
This application were created using Android 3.3 Canary 2.
To run this application, you must have a Client ID and Secret to access the TDC REST API.
To get those information, access the Global Code web site, create an account and request your credentials.
After that, create the apikey.properties
file in the root's project directory and put your credentials as below:
apiClientId="<YOUR_CLIENT_ID>"
apiSecret="<YOUR_API_SECRET>"
But if want to test the app without real data (or you cannot have an API key), just make the following change in the PersistenceModule.kt file.
package br.com.nglauber.tdcapp.di
// ...
val persistenceModule = module {
...
single {
// Instead of this --> TdcRemoteDataSource(tdcWebService = get()) as RemoteDataSource
InMemoryRepository() as RemoteDataSource // Use this one
}
}
And that's it! You're good to go.
This sample is based on the sample presented by Joe Birch in his course at caster.io.
Any feedback and/or PR's are appreciated! :)