No description or website provided.
Switch branches/tags
Nothing to show
Clone or download
Latest commit bb3f334 Aug 26, 2018
Permalink
Failed to load latest commit information.
app Adding sample Aug 27, 2018
LICENSE Create LICENSE Aug 27, 2018
README.md Update README.md Aug 27, 2018

README.md

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)
    }
}