were introduced in 3.0 / Honeycomb • Easy to build master / detail UIs with fragments as reusable components • FragmentManager - manages the fragments and transactions Source: https://github.com/xxv/android-lifecycle
avoid activity overhead - faster transitions • But: • Fragment order on onResume / onAttachFragment • Illegal states when attempting transactions • More complicated lifecycle • View and business logic often cluttered Source: https://github.com/xxv/android-lifecycle
sub flows • Nested flows - Similar to nested Fragments when used to encapsulate a specific flow within an app. • Navigation stack is reset when flow is exited • Example: Compose Flow Flow
with the Context’s getSystemService • Dependency injection • Provides global access to the persistence bundle • MortarScope • Scopes are build upon • AuthScope and UnAuthScope
provide access to persistance bundle or dependency injection • ViewPresenter for logic and testable • Each Screen in turn has its own Module (adds to Object Graph) • Per MVP concept, both Presenter and View have an instance of one another • Flow • Provides the backstack • Provides definition of the screen
Services • getSystemService is used to access services from any context • Scopes can be added for a particular part such as a compose flow or wizard flow to DI state into each of the screens Root ActivityScope MainScreenScope ApplicationModule SettingsModule ActivityModule MainScreenModule
• Starts with root scope • MortarScopes contain different Services • getSystemService is used to access services from any context • Scopes can be added for a particular part such as a compose flow or wizard flow to DI state into each of the screens
• Starts with root scope • MortarScopes contain different Services • getSystemService is used to access services from any context • Scopes can be added for a particular part such as a compose flow or wizard flow to DI state into each of the screens
Services • getSystemService is used to access services from any context • Scopes can be added for a particular part such as a compose flow or wizard flow to DI state into each of the screens
Services • getSystemService is used to access services from any context • Scopes can be added for a particular part such as a compose flow or wizard flow to DI state into each of the screens
Services • getSystemService is used to access services from any context • Scopes can be added for a particular part such as a compose flow or wizard flow to DI state into each of the screens
Services • getSystemService is used to access services from any context • Scopes can be added for a particular part such as a compose flow or wizard flow to DI state into each of the screens
the history • Provides back navigation in case there is more than one screen on the history stack • Set method’s logic depends on if a Screen is already in the history or not
the history • Provides back navigation in case there is more than one screen on the history stack • Set method’s logic depends on if a Screen is already in the history or not
the history • Provides back navigation in case there is more than one screen on the history stack • Set method’s logic depends on if a Screen is already in the history or not
the history • Provides back navigation in case there is more than one screen on the history stack • Set method’s logic depends on if a Screen is already in the history or not
Flow holds the navigation history • Each Entry contains the Screen/Path object • FlowDelegate propagates a onSaveInstanceState call to the Flow which persists the history • Each Screen/Path is converted into a Parcelable object • Parcelable converter could for example serialize the Path into JSON Flow History / State Persistence
onPause, onResume, onActivityResult • Examples: Sign on integrations, external resizing activity, custom Camera integration • Easy way - set explicit callbacks on *Your*Activity • Better - Manager that Presenters can register and unregister for lifecycle events Activity
onPause, onResume, onActivityResult • Examples: Sign on integrations, external resizing activity, custom Camera integration • Easy way - set explicit callbacks on *Your*Activity • Better - Manager that Presenters can register and unregister for lifecycle events Activity LifecycleOwner
onPause, onResume, onActivityResult • Examples: Sign on integrations, external resizing activity, custom Camera integration • Easy way - set explicit callbacks on *Your*Activity • Better - Manager that Presenters can register and unregister for lifecycle events Activity LifecycleOwner LifecycleViewPresenter
any class • Unique Annotation for each setting • Separate SettingsModule that is included in the ApplicationModule (Root) • No SettingsManager needed and each settings value can be provided as needed