Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/mitchtabian/Open-API-Android-App

Kotlin, MVI, Hilt, Retrofit2, Coroutines, Room Persistence, REST API, Token Authentication
https://github.com/mitchtabian/Open-API-Android-App

android-jetpack-components coroutines-android dagger2 jetpack-android jetpack-lifecycle-components jetpack-navigation kotlin mvvm-architecture navigation-component rest-api retrofit2 room-persistence

Last synced: 4 months ago
JSON representation

Kotlin, MVI, Hilt, Retrofit2, Coroutines, Room Persistence, REST API, Token Authentication

Lists

README

        

# "Clean" Refactor Notes
In July 2021 I did a major refactor. Here's what I did:
1. Migrate from Dagger to [Hilt](https://developer.android.com/training/dependency-injection/hilt-android).
1. Update [Navigation Component](https://developer.android.com/guide/navigation).
- Now supports [multiple backstacks](https://medium.com/androiddevelopers/multiple-back-stacks-b714d974f134) by default.
1. Decoupling.
- Avoid sharing viewmodels. It makes unit testing easier when I can test fragments in isolation.
1. Splitting business models into Entities and Dto's. This way I have a clear [business model](https://github.com/mitchtabian/Open-API-Android-App/blob/master/app/src/main/java/com/codingwithmitch/openapi/business/domain/models/BlogPost.kt), [network model](https://github.com/mitchtabian/Open-API-Android-App/blob/master/app/src/main/java/com/codingwithmitch/openapi/business/datasource/network/main/BlogPostDto.kt), and [caching model](https://github.com/mitchtabian/Open-API-Android-App/blob/master/app/src/main/java/com/codingwithmitch/openapi/business/datasource/cache/blog/BlogPostEntity.kt).
1. Writing use cases.
- Unidirectional data flow with MVI and kotlin sealed classes. (See [Interactors](https://github.com/mitchtabian/Open-API-Android-App/tree/master/app/src/main/java/com/codingwithmitch/openapi/business/interactors))
1. Refactor message handling system to a [Queue](https://github.com/mitchtabian/Open-API-Android-App/blob/master/app/src/main/java/com/codingwithmitch/openapi/business/domain/util/Queue.kt).
1. Migrate from Shared Preferences to [DataStore](https://developer.android.com/topic/libraries/architecture/datastore).
1. Migrate from Kotlin synthetics to [ViewBinding](https://developer.android.com/topic/libraries/view-binding).
1. Write [Unit tests](https://github.com/mitchtabian/Open-API-Android-App/tree/master/app/src/test/java/com/codingwithmitch/openapi/interactors) for use-cases.

# TODO
1. Check out the new [splash screen APIs](https://developer.android.com/about/versions/12/features/splash-screen)
1. Do a [Compose](https://developer.android.com/jetpack/compose) refactor
- I will create a new repo for this

# Test Account

email: `[email protected]`

password: `password`


Powerful Android Apps with Jetpack Architecture


Watch the video course here: Powerful Android Apps with Jetpack Architecture.

In this course you'll learn to build a real application that interacts with the website open-api.xyz.


Open-api.xyz is a sandbox website for codingwithmitch members to practice interacting with a Rest API.



Prerequisites (Recommended not required):




  1. Dagger 2



  2. MVI Architecture



  3. Database Caching (Retrofit + Room)




What you'll learn:




  • Kotlin:


  • Coroutines:


    1. Advanced coroutine management using jobs

    2. Cancelling active jobs

    3. Coroutine scoping




  • Navigation Components:


    1. Bottom Navigation View with fragments

    2. Leveraging multiple navigation graphs (this is cutting edge content)




  • Dagger 2:


    1. custom scopes, fragment injection, activity injection, Viewmodel injection




  • MVI architecture:


    1. Basically this is MVVM with some additions

    2. State management

    3. Building a generic BaseViewModel

    4. Repository pattern (NetworkBoundResource)




  • Room Persistence:


    1. SQLite on Android with Room Persistence library

    2. Custom queries, inserts, deletes, updates

    3. Foreign Key relationships

    4. Multiple database tables




  • Cache:


    1. Database caching (saving data from network into local cache)

    2. Single source of truth principal




  • Retrofit 2:


    1. Handling any type of response from server (success, error, none, etc...)

    2. Returning LiveData from Retrofit calls (Retrofit Call Adapter)




  • ViewModels:


    1. Sharing a ViewModel between several fragments

    2. Building a powerful generic BaseViewModel




  • WebViews:


    1. Interacting with the server through a webview (Javascript)




  • SearchView:


    1. Programmatically implement a SearchView

    2. Execute search queries to network and db cache




  • Images:


    1. Selecting images from phone memory

    2. Cropping images to a specific aspect ratio

    3. Setting limitations on image size and aspect ratio

    4. Uploading a cropped image to server




  • Network Request Management:


    1. Cancelling pending network requests (Kotlin coroutines)

    2. Testing for network delays




  • Pagination:


    1. Paginating objects returned from server and database cache




  • Material Design:


    1. Bottom Navigation View with Fragments

    2. Customizing Bottom Navigation Icon behavior

    3. Handling Different Screen Sizes (ConstraintLayout)

    4. Material Dialogs

    5. Fragment transition animations