Piwigo / Piwigo-Android

Piwigo Native Android App
GNU General Public License v3.0
141 stars 43 forks source link

Rotation in MainView messes up the back-stack #152

Closed ramack closed 4 years ago

ramack commented 4 years ago

Describe the bug and how to reproduce

You will see the album again, but additional back button actions do not do anything. Also the "up"-navigation to the parent album is broken and instead of the "back" symbol the menu sandwich is shown.

Expected behavior

Valou447 commented 4 years ago

This is not "really" related to the PhotoViewer itself.

If you navigate through albums and rotate the device, the sandwich icon is shown and the navigation is broken. Either you opened the photo in the photo viewer or not, the behavior is the same..

To me, this is likely related to the activity recreation event on screen rotation..

ramack commented 4 years ago

Oh, I just recognized it when I was playing with the photoviewer. If it is due.to.recreation of the activity, then we have messed up with the viewmodel, because.this.is exactly the reason.why.we.have a viewmodel, which shall.carry the state of the view that shall.be kept over recreation of the activity... so we might need to shift some logic from.the activity into the viewmodel...

Valou447 commented 4 years ago

More than just messing up the back-stack, recreating the activity causes the photos to refresh, and may cause some unnecessary data usage..

ramack commented 4 years ago

More than just messing up the back-stack, recreating the activity causes the photos to refresh, and may cause some unnecessary data usage..

yes that was true. I think that okhttp should cache quite some amount of the data transfer and your picasso-cache also, but still I added a small commit to prevent this reloading from the category if not needed. I hope to have catched all cases where a real refresh is needed.