Skip to content

How to do complex master-detail layout? #176

@ZakTaccardi

Description

@ZakTaccardi

The example in the sample doesn't correctly survive configuration changes (you can get the portrait layout in landscape sometimes)

Example of layout I want to achieve

How should I be doing this? I've attempted to achieve this, but I am currently having issues restoring state.

I currently have the whole layout wrapped in a single HomeController, which has three childRouters via homeController.getChildRouter(view, TAG)

  • appBarRouter
  • navDrawerRouter
  • masterRouter (represents the current nav drawer selection)

masterRouter's root is masterControllerA (or masterControllerB when toggled by nav drawer). detailControllerA's is either:

  • pushed onto the masterRouter (in phone config, for single pane layout)
  • the root of the childRouter of its masterController (in tablet config, for two pane layout)

To avoid instantiating unnecessary controllers I'm always checking if the router/controller is already contained in the existing ViewGroup container/router by its tag.

Does any of this throw a red flag?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions