Skip to content

edwincorea/ComponentizationArchitecture

Repository files navigation

Cloned from Juliano Moraes Repo. https://github.com/julianomoraes/componentizationArch

Netflix’s Android Componentization Architecture

Sample code for Droidcon NYC 2018

Fragment / Activity

...
LoadingPresenter(
    LoadingView(rootViewContainer),
    screenStateEvent,
    destroyObservable
)
...

Presenter

...
screenStateEvent
    .takeUntil(destroyObservable)
    .subscribeBy(
        onNext = {
            when (it) {
                ScreenStateEvent.Loading -> {
                    uiView.show()
                }
                ScreenStateEvent.Loaded -> {
                    uiView.hide()
                }
                ScreenStateEvent.Error -> {
                    uiView.hide()
                }
            }
        }
   )
...   

View

class LoadingView(container: ViewGroup) : UIView<UserInteractionEvent>(container) {
    override val view: View = LayoutInflater.from(container.context).inflate(R.layout.loading, container, false)
    init {
        container.addView(view)
    }
}

About

Sample app from Juliano Moraes's DroidCon Presentation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages