forked from mutualmobile/Praxis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f916b09
commit 13acefe
Showing
1 changed file
with
39 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,69 @@ | ||
# Praxis Android Clone with Compose | ||
|
||
### Status: π§ In progress π§ | ||
# Praxis | ||
2022 Hit Refresh! Praxis now loves β€οΈ Jetpack Compose | ||
|
||
This is a jetpack compose sample app written in Kotlin following clean architecture principles. | ||
<div align="left"> | ||
<a href = "https://developer.android.com/jetpack/androidx/versions/all-channel#may_5_2021"> | ||
<img src = "https://img.shields.io/badge/Jetpack%20Compose-1.0.0%20beta08-brightgreen" /> | ||
</a> | ||
</div> | ||
<br> | ||
|
||
The purpose of this app to showcase: | ||
This is a sample app written in Kotlin following clean architecture principles which fetches random jokes, trending Github repository and displays it. | ||
|
||
- Implementation of Jetpack Android Architecture components with Dagger Android and Data Binding to | ||
minimize boilerplate code | ||
- Creation of proper components and Subcomponents using Dagger Android and their injection into | ||
Activity, Fragment, View Models and Helper Classes | ||
The purpose of this app to showcase: | ||
- Implementation of Jetpack Android Architecture components with Dagger Hilt and Data Binding to minimize boilerplate code. | ||
- Implementation of an architecture that will support both XML and the new Compose. | ||
- Implementation of Modular Multi Module Navigation Architecture. | ||
- Performing background task with Kotlin Coroutines | ||
|
||
## Screenshots | ||
|
||
| Screenshots | In Progress | | ||
|---------------- |------------------------------ | | ||
| <img src="art/art1.png" alt="drawing" style="width:300px;"/> | <img src="art/art2.png" alt="drawing" style="width:300px;"/> | | ||
| <img src="art/art3.png" alt="drawing" style="width:300px;"/> | <img src="art/art4.png" alt="drawing" style="width:300px;"/> | | ||
| <img src="art/art5.png" alt="drawing" style="width:300px;"/> | <img src="art/art6.png" alt="drawing" style="width:300px;"/> | | ||
| <img src="art/animated_start.gif" alt="drawing" style="width:300px;"/> | <img src="art/animated_search.gif" style="width:300px;"/> | | ||
| <img src="art/art8.gif" alt="drawing" style="width:300px;"/> | <img src="art/art9.png" alt="drawing" style="width:300px;"/> | | ||
|
||
### TODOs and questions to self | ||
|
||
- Rewrite the Colors and light/dark mode compatibility! | ||
- Should we have separate theme for each UI module ? | ||
- How to handle dynamic theme colors ? | ||
|
||
## ποΈοΈ Built with β€οΈ using Jetpack Compose π | ||
# Requirements | ||
1. Android Studio : Arctic Fox | 2020.3.1 3.1 or higher | ||
2. Android Emulator or Physical android device | ||
|
||
| What | How | | ||
|---------------- |------------------------------ | | ||
| π User Interface (Android) | [Jetpack Compose](https://developer.android.com/jetpack/compose) | | ||
| π Architecture | [Clean](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) | | ||
| π DI (Android) | [Hilt](https://developer.android.com/training/dependency-injection/hilt-android) | | ||
| π Async | [Coroutines](https://kotlinlang.org/docs/coroutines-overview.html) + [Flow](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/) | | ||
| π Networking | [Retrofit](https://square.github.io/retrofit/) | | ||
| π Parsing | [KotlinX](https://kotlinlang.org/docs/serialization.html) | | ||
# Built With π | ||
|
||
## Languages, libraries and tools used | ||
| Tools | Link | | ||
| :--- | :---: | | ||
| π€ Kotlin | [Kotlin](https://kotlinlang.org/) | | ||
| π Architecture Components | [Android Architecture Components](https://developer.android.com/topic/libraries/architecture) | | ||
| β Data Binding | [Android Data Binding](https://developer.android.com/topic/libraries/data-binding) | | ||
| π Dagger Hilt | [Dagger Hilt](https://developer.android.com/training/dependency-injection/hilt-android) | | ||
| π Retrofit | [Retrofit](http:https://square.github.io/retrofit/) | | ||
| π¦ OkHttp | [OkHttp](http:https://square.github.io/okhttp/) | | ||
| π Gson Parsing | [Gson](https://github.com/google/gson) | | ||
| π Coroutines | [Kotlin Coroutines](https://developer.android.com/kotlin/coroutines) | | ||
| ππΌββοΈ Flows | [Flows](https://developer.android.com/kotlin/flow) | | ||
|
||
- [Kotlin](https://kotlinlang.org/) | ||
- AndroidX libraries | ||
- [Android Architecture Components](https://developer.android.com/topic/libraries/architecture) | ||
- [Android Data Binding](https://developer.android.com/topic/libraries/data-binding) | ||
- [Dagger 2](https://github.com/google/dagger) | ||
- [Retrofit](http:https://square.github.io/retrofit/) | ||
- [Kotlin Coroutines](https://developer.android.com/kotlin/coroutines) | ||
|
||
## Architecture | ||
|
||
PraxisClone follows the principles of Clean Architecture with Android Architecture Components. | ||
### Praxis follows the principles of Clean Architecture with Android Architecture Components. | ||
|
||
### Architecture's layers & boundaries: | ||
|
||
<img src="art/architecture.jpeg" /> | ||
|
||
**UI Layer** contains _UI (Activities, Composables, Fragments)_ that are coordinated by _ | ||
ViewModels which execute 1 or multiple UseCases._ Presentation Layer depends on Domain Layer. | ||
**Presentation Layer** contains _UI (Activities & Fragments)_ that are coordinated by _ViewModels which execute 1 or multiple UseCases._ Presentation Layer depends on Domain Layer. | ||
|
||
**Domain Layer** is the most INNER part of the circle (no dependencies with other layers) and it | ||
contains _Entities, Use cases & Repository Interfaces._ Use cases combine data from 1 or multiple | ||
Repository Interfaces. | ||
**Domain Layer** is the most INNER part of the circle (no dependencies with other layers) and it contains _Entities, Use cases & Repository Interfaces._ Use cases combine data from 1 or multiple Repository Interfaces. | ||
|
||
**Data Layer** contains _Repository Implementations and 1 or multiple Data Sources._ Repositories | ||
are responsible to coordinate data from the different Data Sources. Data Layer depends on Domain | ||
Layer. | ||
**Data Layer** contains _Repository Implementations and 1 or multiple Data Sources._ Repositories are responsible to coordinate data from the different Data Sources. Data Layer depends on Domain Layer. | ||
|
||
**Notes:** Mapping between response models and transformed models will happen via extension | ||
functions defined in transformed model file | ||
**Notes:** Mapping between response models and transformed models will happen via extension functions defined in transformed model file | ||
|
||
### When writing a new ui module | ||
# Hybrid Architecture ( XML + Compose ) | ||
|
||
- First, Create a new android library module | ||
- Make sure to copy build.gradle.kts from other ui module and paste it in your ui-module | ||
- We need one fragment to host the composables, this fragment will be added to main nav graph. | ||
- the routing within compose world is handled with Compose Navigator | ||
- and to move out of one ui module you need to use the fragment navigator! | ||
Praxis now supports old XML and new Compose as well. | ||
|
||
### Conventions: | ||
<img src = "art/hybrid_arch.jpeg" /> | ||
|
||
### Conventions: | ||
Files are suffixed with be defined Class types. | ||
|
||
- ViewModels are suffixed with **VM**. Ex: `LoginVM` | ||
- UseCases are suffixed with **UseCase**. Ex: `LoginUseCase` | ||
- Sources are suffixed with **Source**. Ex: `LoginRemoteSource`, `LoginLocalSource` | ||
- Repositories are suffixed with **Repo**. Ex: `LoginRepo` | ||
|
||
## Conclusion | ||
|
||
This project can be used as a template for new apps. This project is continually evolving to | ||
integrate other libraries and techniques to keep it up to date. | ||
This project can be used as a template for new apps. | ||
This project is continually evolving to integrate other libraries and techniques to keep it up to date. |