android / sunflower

A gardening app illustrating Android development best practices with migrating a View-based app to Jetpack Compose.
https://d.android.com/jetpack
Apache License 2.0
17.66k stars 4.71k forks source link

Will you ever bring back master-detail tablet layout? #312

Open Zhuinden opened 5 years ago

Zhuinden commented 5 years ago

I see that master detail was removed in https://github.com/googlesamples/android-sunflower/commit/7990334ad654fc9347dd9ba0e71761232da56678 and it's actually kinda sad because I was secretly hoping for the past 8 months that this will be that one sample that shows how to create a master-detail flow with Navigation AAC.

Is there any chance that this will be that one sample, or should I give up on my hopes and dreams regarding Nav AAC's ability to potentially model the option of showing multiple interdependent screens based on screen size?

MarcusWolschon commented 5 years ago

We have the same issue in googlesamples/android-architecture-components
https://github.com/googlesamples/android-architecture-components/issues/377

Zhuinden commented 5 years ago

I saw https://proandroiddev.com/master-detail-views-with-navigation-components-a20405f31974 and it makes sense.

MarcusWolschon commented 5 years ago

Looks great. Except I would use data binding and I would not choose one of 2 layouts in code when I could have both of them with the same name in /res/layout and /res/layou-sw300dp and let Android do the choosing. (as written in the "update" secion of that example)

danielwilson1702 commented 5 years ago

I'm trying to implement this with tabs and it's pretty hard. If I want a master-detail layout for each tab the proandroiddev solution does not work so well because there's no easy way to fit it into a FragmentPagerAdapter :(

Zhuinden commented 5 years ago

Each tab with a master detail layout?? I've never seen anything like that, can you send me a mockup? 😄

Even in Paint it's fine, I just need to see where the tabs are and where the master-detail comes in (and if it's orientation based or width based).

Especially if we are talking top tabs. This sounds curious.

danielwilson1702 commented 5 years ago

Haha well I wrote a terrible article on what I managed to conjure up for posterity. You are right I hadn't considered how unusual what I was trying to do actually is. The app needs to display a lot of info from several lists, and will mostly be used on landscape tablets.

It's one job doing a master-detail layout, another doing tabs + nested fragments and quite another one trying to jam it into a navigation graph. Maybe what I've written down is of some use to future googlers.

Zhuinden commented 5 years ago

@danielwilson1702 well I did test against config changes and also process death and it seems to be restoring back properly. Nice one. 😲

fklappan commented 4 years ago

Any news regarding this issue?

ananddamodaran commented 4 years ago

Eagerly waiting ⌛

Zhuinden commented 2 years ago

https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:navigation/integration-tests/testapp/src/main/java/androidx/navigation/testapp/TwoPaneFragment.kt?q=abstractlistdetailfragment

danielwilson1702 commented 2 years ago

I only bloody saw they added this after I rewrote my implementation using SlidingPaneLayout 😆