-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to do complex master-detail layout? #176
Comments
I've tried using a single dagger module with all routers/controllers in the same scope - but I hit this error when swapping nav drawer options (aka changing the root of the
I'm guessing it has something to do with swapping setting the root of the |
What's the problem with the way it's implemented in the demo app? The only time you can get the portrait layout in landscape is if you flip the phone when you're already in the detail view (I think). If there's another case I'm not aware of, please let me know. Regarding your question, the only thing that throws a red flag is that it sounds like you're reusing potentially destroyed controllers. It all looks good besides that. As for your crash, you're exactly right. If you try to use a Router that isn't attached to a host of any kind (ex: a child router whose controller isn't attached), you're not gonna have a good time. |
Is this considered a bug? (I think it should be) |
Yeah, it probably should be considered a bug. I just wrote that as a quick demo without giving it too much thought. I've never had to use a master/detail view for much - how do apps typically handle this case? The master/detail example created by Android Studio's new project wizard seems to do what the demo does. |
My confusion stems around how I should be restoring the state of routers and controllers in a configuration change when you switch from portrait to landscape (single pane layout to two pane layout). I see two general approaches:
The demo utilizes a single, static |
@ZakTaccardi did you ever find a good solution to this? |
I think currently there is no easy way to handle this in Conductor. The workaround that I came up with is this: I have an
landscape-layout is easy: prortrait-layout needs more work
|
The example in the sample doesn't correctly survive configuration changes (you can get the portrait layout in landscape sometimes)
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 threechildRouters
viahomeController.getChildRouter(view, TAG)
appBarRouter
navDrawerRouter
masterRouter
(represents the current nav drawer selection)masterRouter
's root ismasterControllerA
(ormasterControllerB
when toggled by nav drawer).detailControllerA
's is either:masterRouter
(in phone config, for single pane layout)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 existingViewGroup container
/router
by itstag
.Does any of this throw a red flag?
The text was updated successfully, but these errors were encountered: