Skip to content

An optimized Android framework using Kotlin and RxJava

Notifications You must be signed in to change notification settings

mitenko/CleanFramework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clean MVP

Goal

To build an MVP Fragment swapping framework that minimizes boilerplate code and minimizes all code in general

Key Tools

Kotlin
RxKotlin
Retrofit2
Dagger

Implementation Details

Data Flow

Presenters implement Observer<MVPObservable> and are to be used to subscribe to all UI events (via RxKotlin) as well as all Retrofit2 observables

State Save / Restore

State save / restore is managed in the presenter via FragmentLifecycleCallbacks and Kotlin's @Parcelize

Known Limitations

Kotlin doesn't enable heritable data classes

This means the RootFragmentState can't be a data class.

As a consequence, the RootPresenter can't access the RootFragmentState as a data class and make use of the ```copy()``` function.

All new states must be generated by the subclass, even though the RootPresenter is set up to handle 'root' events like errors and loading states.

Ideally, the RootPresenter should be able to generate these new states as well, removing the necessity of handling these root events in the children fragments.

Dagger2 won't inject from a parent class (boilerplate)

The call to inject must be made from the subclassed presenter, it can't be handled by the RootPresenter.

About

An optimized Android framework using Kotlin and RxJava

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages