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

when launching app in landscape mode (with auto-rotate on) UI does not reorient properly when switching to portrait #2002

Open
rilygreat opened this issue Jun 22, 2023 · 1 comment · May be fixed by #2087

Comments

@rilygreat
Copy link

Device: realme realme C12
Android Version: 30
AppVersion: Version 4.2.2 (6121)
User ID: fd87d2bb-6690-49ec-ba5e-ec9fe6eaf0ff
Level: 3
Class: warrior
Is in Inn: false
Uses Costume: false
Custom Day Start: 0
Timezone Offset: -330
Details:

When I try to open the app in landscape mode and then switch to portrait mode right before the logo disappears and the app menu shows the side panel is open and I can't close it and the app isn't loaded properly and won't respond either.

steps to reproduce:

  1. fully close habitica app if it's open
  2. hold phone in landscape mode when on the phone's home screen
  3. launch the habitica app
  4. app should be in landscape mode
  5. turn phone back to portrait mode

Screenshot_2023-06-17-20-32-15-12_d3b8fcda37c80214ab0c31f986be6207

@EanLombardo
Copy link
Contributor

I recently switched to a foldable device and this issue is way worse for those devices. If you open habitica with the device unfolded you get the nice wide layout, but when you close it, you get the layout as pictured above.

What is happening here is that the MainActivity has 2 layouts, one for normal screens and one for wide screens. When the device is rotated the screen is wider so that one gets used.

However, the code has:

android:configChanges="screenSize | smallestScreenSize | screenLayout | orientation"

The last bit there tells the system to notify the activity when the orientation changes instead of recreating it. The activity doesn't actually have any code to handle this though.

This means that then app is opened, it ends up using whichever layout is appropriate for the current orientation/screen size, and then it never changes until the Activity is recreated. Since you spend 90% of your time in just this 1 Activity that doesn't happen very often.

There is a commit from a while back mentioning that screenSize and such were added to improve multi window behavior, but it is unclear to me why MainActivity would ever ignore orientation changes.

Removing that bit ca

EanLombardo added a commit to EanLombardo/habitica-android that referenced this issue Oct 1, 2024
MainActivity defines an alternate layout for screen more than 600dp wide, but was ignoring orientation changes.

This caused a bug where if the application was opened with a wide orientation, but then the orientation changed to a small one, the user would be presented with the wide layout compressed into an unusable screen.

fixes HabitRPG#2002
@EanLombardo EanLombardo linked a pull request Oct 1, 2024 that will close this issue
EanLombardo added a commit to EanLombardo/habitica-android that referenced this issue Oct 1, 2024
MainActivity defines an alternate layout for screen more than 600dp wide, but was ignoring orientation changes.

This caused a bug where if the application was opened with a wide orientation, but then the orientation changed to a small one, the user would be presented with the wide layout compressed into an unusable screen.

fixes HabitRPG#2002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants