Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Exploring View-Base Application with Conductor

Esa Firman
December 08, 2017

Exploring View-Base Application with Conductor

Esa Firman

December 08, 2017
Tweet

More Decks by Esa Firman

Other Decks in Programming

Transcript

  1. What’s the worst thing that could happen when you’re using

    Android Activity as your page representation?
  2. Task and Back Stack Intent intent = new Intent(LoginActivity.this, MainMenuActivity.class);

    intent.addFlags(...) // FLAG_ACTIVITY_CLEAR_TOP, NEW_TASK, etc ... startActivity(intent); finish(); Or use `launchMode` in AndroidManifest.xml
  3. What about Fragment? • Introduce more complex lifecycle • Never

    use it since last year ( expect for Google Map ) • ¯\_(ツ)_/¯
  4. Conductor A small, yet full-featured framework that allows building View-based

    Android applications. Conductor provides a light-weight wrapper around standard Android Views that does just about everything you'd want
  5. Controller The Controller is the View wrapper that will give

    you all of your lifecycle management features. Think of it as a lighter-weight and more predictable Fragment alternative with an easier to manage lifecycle. TL;DR this is your Fragment
  6. Router A Router implements navigation and backstack handling for Controllers.

    Router objects are attached to Activity/containing ViewGroup pairs. Routers do not directly render or push Views to the container ViewGroup, but instead defer this responsibility to the ControllerChangeHandler specified in a given transaction. TL;DR this is your FragmentManager
  7. ControllerChangeHandlers ControllerChangeHandlers are responsible for swapping the View for one

    Controller to the View of another. They can be useful for performing animations and transitions between Controllers. Several default ControllerChangeHandlers are included.
  8. ControllerTransaction Transactions are used to define data about adding Controllers.

    RouterControllerTransactions are used to push a Controller to a Router with specified ControllerChangeHandlers, while ChildControllerTransactions are used to add child Controllers. TL;DR this is your FragmentTransaction