bluelinelabs / Conductor

A small, yet full-featured framework that allows building View-based Android applications
Apache License 2.0
3.9k stars 343 forks source link

Allowing landscape mode for a specific controller #345

Open fullkomnun opened 7 years ago

fullkomnun commented 7 years ago

I'm currently using Conductor in an app that is mostly single-activity-multi-controllers (great library BTW!). The aformentioned activity is defined as 'portrait' only in the app's manifest. I would like to allow landscape mode for a specific screen. One way to implement it would be to use a separate activity for that screen but assuming that I would like to use a controller instead, what would be the recommended implementation?

I tried to implement it simply by using the Controller's 'onChangeStarted'(swapped-in) and 'onChangeEnded'(swapped-out) methods to invoke the getActivity().setRequestedOrientation(..) and it basically did the trick(tried to apply it to the demo app).

EricKuck commented 7 years ago

Your end solution is actually exactly what I did for a similar use-case. I had an app that could rotate freely with a signature screen that needed to stay in landscape and it worked great for me.