doridori / Pilot

An android.* decoupled application stack for Android
Apache License 2.0
116 stars 9 forks source link

SRP - Break up the PilotManager #14

Closed doridori closed 8 years ago

doridori commented 9 years ago

PilotManager is currently a bit bloated and has more than one responsibility.

Its two core responsibilities at present are

1) To allow something with an Android lifecycle (i.e. Activity) to interact with something that is purposefully staying away from any lifecycle hassles (PilotStack). This involves listener management and handling delegated lifecycle methods. 2) Maintains a list of View mappings and listens to stack changes - manifesting the top view mapping and setting it to a root view

The above obviously violates the Single Responsibility Principle (SRP) and should be changed. Pulling out the view manifestation logic into a separate class (with corresponding interface) would allow for easy switching for different approaches i.e. using a Fragment creator rather than view creator. This would make the lib more flexible also as not everyone likes View only approaches but most do suffer from (at least one of) the problems the abstracted stack solves.

This may also open the way for master/detail display as the view creator could be composed at runtime based upon device specs (i.e. screen size). https://github.com/doridori/Pilot/issues/15

Also this may make it easier to cope with transparent view representations of frames. https://github.com/doridori/Pilot/issues/5

doridori commented 9 years ago

We should now be working towards

We still need to split the above to be able to handle Fragments as well as Views (and even old fashioned Dialogs etc)

doridori commented 9 years ago

Need to update this with final SRP refactor once pushed to master and doced. Maybe should rename as above...