A series of layered frameworks implementing two user interface architecture patterns for Android.
The frameworks are implemented as a set of libraries and two annotation processors.
- Each layer is intended to add a specific characteristic
- Dependency injection is considered a branching feature with one branch using dagger and the other not using injection (to allow you to implement it yourself)
ul-android: Unified Lifecycle
- Intended to eliminate most of the differences between Fragment and Activity lifecycle for development.
- Using this framework it is possible to interchange a UI component from Activity and Fragment by simply changing the class it extends.
- Introduces the Object Registry (a simple mechanisim for preserving complex objects and "live" code) across UI component configuration changes (Rotation).
uistatepreserve-android: User Interface Preservation
- Adds User Interface State preservation to the Unified Lifecycle library
- Uses the Ui State Preservation annotation processor
- Fields in UI components can be automatically preserved and restored between configuration changes (Rotation).
- This is the branching layer that introduces Dagger Dependency Injection. All layers from here down offer two variants, Dagger injection or No Injection. The Dagger variant of this layer is an extension of this layer named "uistatepreserve-dagger-android".
smvp-android: Simple Model View Presenter
- Included mainly for backwards compatibility with some of my projects
- Preserves the presenter and model during Activity configuration change (Rotation)
- Requires explicit restore of state following configuration change (redraw of view - which can be a pain)
- Currently does not include UI state preservation - I might change this in the future. For now it is to avoid confusion around state responsibilities.
ucs-android: User Interface, Coordinator and Statemanager (MVP with different names to encourage you to think more about the roles of those components)
- An evolution of SMVP based on what proved to be painful when implementing applications using SMVP
- Has mechanisms to preserve presenter, model and last state of view during Activity configuration change (Rotation)
- Applies updated state following configuration change automatically
- Automatically shifts calls from ui to coordinator onto a background thread
- Automatically shifts calls from coordinator to ui onto the UI thread
- Fairly productive once you get used to it, but like anything.. there are some inconveniences (no function return values. All async).
Ultimately they will all hopefully be published to maven central, but for now they can be installed to mavenLocal()
Quickstart / TLDR;
run the "Clean, Build and Install Framework" configuration or run "gradlew clean build install" from command line.
See the (very simple) examples: testapp-ucs-dagger
testapp-smvp-dagger example has nothing in it at this point. Nor are there any unit tests. Sorry. Progress is slow due to spare time availability.
Debugging the Annotation Processors
From a command line, run debugapttestappucsdagger (bat file or bash script) then attach to the "remote" process. A run configuration "Debug Annotation Processor" is included for convenience.