DroidconKE2020App
Android app fully written in Kotlin for droidconKE2020
Install / Use
/learn @droidconKE/DroidconKE2020AppREADME
Table of contents
1 About the App<br> 2 General Preview<br> 3 Technical<br> 4 Work in Progress<br> 5 Contributing<br> 6 License<br> 7 Versions<br> 8 Contributors<br>
:point_down: :point_down: :point_down: :point_down: :point_down:
About the App
Android app for the 3rd Android Developer conference- droidcon to be held in Nairobi from August 6-8th 2020.
This project is the Android app for the conference. The app supports devices running Android 5.0+, and is optimized for phones and tablets of all shapes and sizes. The source reflects the app as at droidconKE 2020!
Features
=======
droidconKE 2020 Android App
Android app for the third Android Developer conference-droidcon in Nairobi 2020
This project is the Android app for the conference. The app supports devices running Android 5.0+, and is optimized for phones and tablets of all shapes and sizes.
Source
The source code in this repository reflects the app as of droidconKE 2020.
Features
App will have the following features:
- Sessions
- Feed
- About
- Home
- Speakers
- Auth
- Feedback
To learn how it was built, we put this series together:
(NOT YET OUT) - Coming soon! Building the droidconKE 2020 App
Like, share claps... :wink:
General Preview
Screenshots
Coming soon! <img src="#" width="30%"><img src="#" width="30%"><img src="#" width="30%">
Demo
a You can give it a spin here on appetize
b.Compile the project on android studio and run it.
c. download it from the playstore:
Technical
Running the project
1. Required to run project: check "dependencies" below
- Use Android studio 3.4 and later. It will be less messy.
2. Clone this repository:
`git clone https://github.com/droidconKE/droidconKE2020App.git`
3. open Project in Android Studio
4. Build Project
5. In case of an error when building project, update your gradle version, Build Tools download
6. Add the following credentials to your local.properties
clientId=GOOGLE CLIENT ID
clientSecret=GOOGLE CLIENT SECRET
apiKey=SERVER API KEY
Note: Reache out to @wangerekaharun or @michaelbukachi to obtain credentials
=======
Development Environment
The app is written fully in Kotlin and uses the Gradle build system.
To build the app, use the gradlew build command or use "Import Project" in Android Studio. A canary or stable version >= 3.4 of Android Studio is required and may be downloaded here.
Architecture
Proposed Architecture:
We will be using libraries, modules and dynamic feature modules too.
Architecture Introduction
We took a modularisation approach to develop the application. There are immense benefits that come about with modularising an application; faster builds due to gradle caching and parallelism, benefit of dynamic features which can be delivered on demand therefore reducing initial apk size, clear separation of concerns and ease of maintaining and adding new features. An application can be modularised either by feature or by layer, we decided to take a hybrid approach that combines both approaches.
Data Module
The data module provides support for data persistence and offline caching. It consists of room database, entities and daos. We opted for a single database source of truth as opposed to having multiple databases for each feature. At the point of developing this application, Room did not support multi-database queries and thus having a single database will save us time trying to combine data from multiple databases. In addition to this, a single database helps us avoid duplication of data and tests. The data module exposes itself to the repository layer via a datasource interface to prevent the repository from knowing the implementation details of the data layer thus observing the dependency rule. This will also enhance the flexibility of the application as we can easily switch from Room to SQLite or Realm if need be. This module consists of a mapper to convert entities to data classes that can be passed around.
Network Module
The network module provides support for making network requests to external APIs. This module basically consists of retrofit interfaces, response data classes and mappers to convert the response classes. The network module is exposed to the repository layer via a remote datasource.
Repository module
The repository module depends on the data module and the network module. The role of this module is to sync data from different sources and present it as a single source. Ideally, the repository module observes the repository pattern recommended by Google.
Features
The application contains three features i.e. schedule, feed & about and one dynamic feature i.e tickets. The features depend on the repository module and the core module. The dynamic feature depends on the app module.
App
The app module handles navigation between the features. It also consists of key UI activities or fragments. e.g. Login.
Base Core
Consists of classes and logic that is to be shared across the application. It contains utility classes and functions as well. The base core is a library.
<p align="center"> <img src="Droid Con Architectire.png" width="500" alt="App Architecture"> </p>Modules To Be There:
With the above in mind, here are the actual modules in the droidconKE2020 app following the guidelines laid above
-
app
-
core (library)
-
data (library)
-
features - directory for grouping all the feature modules together. It has the following dynamic feature modules:
- about - has the details of the event, team members and their details that is when each team member card is clicked
- auth - has the sign-up, sign-in, forgot password and reset password logic
- feed - has a #droidconKE newsfeed
- feedback - has session and event feedback logic
- home - shows sponsors, promoted stuff, organizers and changes according to time ie before and during the event
- sessions - shows each days sessions(day one, day two, day three) session details, and also has filter sessions logic and show a user's favorited sessions
- speaker - shows speaker details
-
repository(library)
-
network(library)
Koin Integration & Guides
Dependency injection is integrated into the project based on the project's architecture. Each modules gradle file has koin dependencies.
Data module
The data module define a databaseModule in Module.kt file. The module defines a room database like:
`single {
Room.databaseBuilder(
androidApplication(),
DroidConDB::class.java,
"droidCon.db")
.build()
}`
Then define entity in its on directory. Each entity defines a Data Access Object interfaces and data sources. For example, the user directory includes; user model file, UserDao interface and a LocalUserDataSource file. To define dependencies follow these steps;
Define a data access object like this;
`@Dao
interface UserDao {
@Query("SELECT * FROM user")
fun getUser(): User
}`
Then define a koin dependency like this:
`factory { get<DroidConDB>().userDao() }`
and a data source dependencies like this:
`factory { LocalUserDataSource(get()) }`
Network Module
The network module also defines individual entities which shall contain response and request bodies (DTOs), if they are necessary, api service interface and a data source.
To inject dependencies for data sources, do this:
`factory { get<Retrofit>().create(UserAPIService::class.java) }`
for api service interface dependency injection definition add this:
`factory { RemoteUserDataSource(get()) }`
to define data source dependencies.
Repository Module
The repository is dependent on the network and data module. To define a repository dependency, do this:
`factory { UserRepository(get(), get()) }`
The first parameter is the UserLocalDataSource from the data module and the second is the UserRemoteDataSource from the network module.
Features
Each feature depend on the repository module. ViewModel dependencies require repository dependencies. for viewmodel injection, follow this steps;
create a class, for example LoginViewModel,
`class AuthViewModel(private val repository: UserRepository): ViewModel() {
fun login(username: String, password: String) {
repository.login(username, password) }
}`
Then in the features di directory, add a viewmodel injection like this:
`viewModel { AuthViewModel(get()) }`
then inject the viewmodel into a fragment/activity
`class AuthFragment: Fragment() {
**val authFragment: AuthFragment by viewModel()**
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return super.onCreateView(inflater, container, savedInstanceState)
}
}`
Gradle
Th

