I have a coworker that is asking me an interesting...
# compose
n
I have a coworker that is asking me an interesting question : Is there anyway to lock orientation of "screen" in a Compose app ? I assume we have to use
setRequestedOrientation
in the main activity ? context : setRequestedOrientation might recreate activity, and I read that with Compose we can just override all configChanges as it can be handled directly
t
Compose has nothing to do with this, essentially. Overriding configChanges for orientation means the activity is not recreated
n
yes but the Compose UI will still adapt from portait to landscape right ?
t
Yes, because
ComposeView
will trigger a recomposition on the configuration change
n
but what about displaying in portrait mode, even when the phone is in landscape
t
That wouldn't happen
Oh, you mean locking the orientation to portrait?
n
yes
t
The activity would remain in portrait in that case, and no recomposition would happen
n
if I force the orientation in the activity, right ?
t
Right
n
my example is something like this :

https://miro.medium.com/max/1400/1*p-2ZKX8WwwDrbnZXL5clOg.png

assuming I don't want to lock the activity to portrait, I just want to handle the orientation change in composation to keep the UI as is, but with icon rotated to still be at the good angle for the user