Coder Social home page Coder Social logo

navigator-demo's Introduction

navigator-demo

Using Navigator library to rewrite the Conductor Demo App.

Notable Libraries Used

  • Anko - DSL to write layouts in code rather than in xml
  • Simple Stack - backstack library for simpler navigation between views, fragments, or whatevers

Anko

  • Pros
    • Easier to create layouts through DSL - No xmls. Yay?
    • Faster
    • No more findViewById or ButterKnife
  • Cons
    • No preview (they have a plugin, but I can't make it work)
    • Styles - Styling is not really hard if you create your own, but when using appcompat styles, I needed to look for it's exact styles to mimic them
  • I really think kotlin android extensions is better in terms of ease of use but programmatic views are faster and you wouldn't need to code in xml anymore

Simple Stack

  • Pros
    • It's simple. Like a simplified flow.
    • You have granular control on your lifecycle. Double edged. But I prefer it, all bugs could be blamed by me.
    • Screens are just ViewGroups
  • Cons
    • Multiple Child view with backstack support is hard but I don't think there's a lot of use case for it. Did not continue to implement Multiple Child Routers like in the Conductor demo as it was too hard and I felt like hacking already
  • Simple Stack is nice and simple and I prefer it over Flow or Conductor. Flow is complex and Conductor, I'm just not sure on what happens internally on its lifecycle and I wanted to avoid that like how I'm avoiding fragments now.

Building Blocks

  • ViewKey
    • This interface has lifecycle callbacks and it's the key to use to add to the backstack.
  • ViewLayout
    • This abstract class is the xml. Everything UI or View related is here.
  • ViewStateChanger
    • The code I copied mostly from the DefaultStateChanger of Simple Stack. I wanted to support the ViewLayout class instead of inflating from xml. Lifecycle callbacks are called here, we have full control of the lifecycle here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.