Skip to content
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

Broken support for the orientation when natural orientation is not portrait #285

Open
NeverwinterMoon opened this issue Nov 13, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@NeverwinterMoon
Copy link

Currently, the app has something like this in the code:

internal fun applyDeviceRotation(deviceRotation: DeviceRotation, useCaseGroup: UseCaseGroup) {
    val targetRotation = deviceRotation.toUiSurfaceRotation()
    useCaseGroup.useCases.forEach {
        when (it) {
            is Preview -> {
                // Preview's target rotation should not be updated with device rotation.
                // Instead, preview rotation should match the display rotation.
                // When Preview is created, it is initialized with the display rotation.
                // This will need to be updated separately if the display rotation is not
                // locked. Currently the app is locked to portrait orientation.
            }

But this statement - "Currently the app is locked to portrait orientation" - is not true. The activity is set up with android:screenOrientation="nosensor" (which is, by the way, officially advised against starting with Android 12). This does not mean that the app is locked to portrait. This means that it's locked to "natural" orientation. For a tablet or even for a foldable, this could be landscape. I've tested this app on a Pixel Tablet and it is indeed broken. The information from the sensor will be cropped in device's natural orientation (will be cropped from 4:3 to 3:4).

I would be really interested in seeing this project show how to handle this kind of thing. And handling of multi-window as well. I am trying to refactor legacy app code in my own app and was using this project as an example. Really appreciate the existence of this and would like to see the support for all these different orientations.

@temcguir temcguir added the enhancement New feature or request label Nov 15, 2024
@temcguir
Copy link
Collaborator

Thank you for the feature request. We have plans to address this.

Some work has been done in #162, but needs to be revisited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants