FossifyOrg / Gallery

Browse your memories without any interruptions with this photo and video gallery
https://www.fossify.org
GNU General Public License v3.0
1.78k stars 61 forks source link

Rotating the view when viewing fullscreen media causes the UI to get stuck visible #275

Open CommanderPirx opened 4 months ago

CommanderPirx commented 4 months ago

Checklist

Affected app version

1.1.3

Affected Android/Custom ROM version

Android 14/-

Affected device model

Pixel 7 Pro

How did you install the app?

Google Play Store

Steps to reproduce the bug

  1. Open any folder with images
  2. Click on an image in order to go to the fullscreen view
  3. Rotate the view of the image by any of the listed means:
    • With the Fossify's Rotate fullscreen media by setting set to "System setting", and the system auto rotation setting set to On, rotate the device from vertical to horizontal (or the other way around if you started out horizontal)
    • With the Fossify's Rotate fullscreen media by setting set to "Device rotation", rotate the device from vertical to horizontal (or the other way around if you started out horizontal)
    • With the Fossify's Rotate fullscreen media by setting set to "Aspect ratio", swipe to switch an image with a different aspect ratio than the one you started out from (if you started out on an image with portrait aspect ratio, you want to get to a landscape one and vice versa)
    • Using the rotation button in the bottom right of the screen
  4. Observe the issue.

Expected behavior

Tapping on the image causes the UI's visibility to toggle, regardless of prior rotation events.

Actual behavior

If the view of the image in fullscreen view gets rotated in any of the ways listed in the repro steps, the UI becomes stuck in the visible state, and stops responding to tapping the image (which would normally cause it to be toggled invisible). This behavior persists while scrolling through different images, and even if the view is rotated again. The only way I found to get rid of it is to exit the fullscreen view and enter it again (but then if the reprosteps are repeated, it occurs again of course).

Screenshots/Screen recordings

No response

Additional information

Please note that the SimpleMobileTools's Gallery Pro app currently has a similar bug, but in their version of the app the rotating also causes the view to snap back to the image that the fullscreen mode was opened on (even if the rotation occured on a different image), and that behavior has 100% repro rate on their app, while the locking of the UI does not always occur (but it does most of the time), while on Fossify Gallery the locking UI occurs every time I try.

Aga-C commented 4 months ago

Can you show what settings you have set in sections Fullscreen media, Deep zoomable images and Extended details?

CommanderPirx commented 4 months ago

Can you show what settings you have set in sections Fullscreen media, Deep zoomable images and Extended details?

Sure thing, here's a screenshot: Screenshot_20240730-173423

RatzzFatzz commented 3 months ago

A similar behavior occurs when 'Automatically hide System UI when fullscreen media' is active. The UI will disappear and it's not possible to make it visible again. It's basically the reverse of the problem described, but I think it will have the same error origin.

rry-je commented 1 month ago

I ran into this bug on a device running MIUI 14, where it would happen consistently on each rotation. I was able to reproduce it on a device running Android 14 (LineageOS 21) by enabling "Don't keep activities" in developer settings, then, when viewing an image, pressing the home button and returning to the app via recents.

Upon investigation, it looks like some state is lost when the ViewPagerActivity is recreated. In particular, PhotoFragment.listener is null after recreation, so the call listener?.fragmentClicked() in photoClicked() does nothing.

It seems the fragments are not recreated through MyPagerAdapter.getItem(), which would properly set the listener, but manually instantiated by the FragmentManager. MyPagerAdapter.instantiateItem() is still called, however, so a simple workaround would be to just set fragment.listener = activity there.

I tested this approach, and it fixed the issue for me, so I'm opening a separate PR. Feel free to review and merge it if you're happy with it.