We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

An alternative to fragments: Say Hello to Mortar & Flow

Formale Metadaten

Titel
An alternative to fragments: Say Hello to Mortar & Flow
Serientitel
Anzahl der Teile
46
Autor
Lizenz
CC-Namensnennung 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen.
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
The introduction of fragments made it possible to split activities into smaller, more manageable components and allowed to build responsive UIs. Further taking advantage of the FragmentManager allowed hosting all fragments within a single activity. However fragments also caused headaches; ensuring that a transition is safe, magic fragment re-creation and ensuring the correct fragment is shown after an activity is re-created to name a few. In this talk, we will take a close look at two libraries: Mortar (with Dagger) and Flow. Leveraging these libraries allows creating well structured and cleanly separated components yielding reusable and testable user interfaces. Built as a layer on top of Dagger, Mortar provides scoped injection of components and provides lifecycle callbacks. These scoped subgraphs are only around while a screen that requires them is in scope thus keeping the memory footprint small. The separation of views and presenters fosters code that is easily testable. Flow provides the means to navigate between screens and manages the backstack. Flow can be freely extended to provide custom animations between screens since it is handling plain old views. The takeaways from this talk are that Mortar and Flow provide an excellent alternative to Fragments and utilizing them can help you build well architected applications with responsive UIs as well as being able to easily add unit tests for the business logic in the presenters.