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.51k stars 47 forks source link

Reload upon activity resume #284

Open KopiasCsaba opened 4 weeks ago

KopiasCsaba commented 4 weeks ago

Checklist

Feature description

Upon starting the app or reactivating it (if it was running just switched away and came back), it'd be nice to have an automatic reload of images in that directory. Due to performance reasons I understand if it gets a setting buried somewhere and default off as well.

Why do you want this feature?

So on graphene OS on pixel phones, thankfully we can use the awesome(ly working) factory camera app the google camera app without the google ecosystem. But, it is hardcoded to open google's photo gallery, so if it's not installed it will not open the gallery from the app just whine.

What we (including my wife) do now is manually switching to Fossify gallery. But there is an extra step to update the pictures (pull down), and that could be eliminated with this.

I also wonder to rename the package somehow to get it working straight from the camera app, but that's off topic.

Additional information

I'm very thankful for this project, thank you guys.

Aga-C commented 4 weeks ago

It should already work like this, see the video below (on my two non-rooted devices it works the same):

https://github.com/user-attachments/assets/bcbc142f-7b94-4d45-be29-01ee6820cad4

Are you doing it the same way? If so, maybe it's a problem with loading working too slow. Have you tried to wait a bit more? We have known performance issues related to the image list.

KopiasCsaba commented 3 weeks ago

Dear @Aga-C ,

Thank you for your swift and kind reply, i looked around a bit more to see whats going on, and it is a funny racecondition between the camera app and fossify gallery.

I have made a screenrecording but im on the go, anyhow i switched between the two apps slowly to be visible on the recording. And voila, indeed on activity resume it reloads.

But!

If i make a photo and immediately switch to the gallery app, it refreshes BEFORE the picture is saved back in the camera app. And then it will never show up.

So, steps to reproduce:

If you can't reproduce or curious, at night i'll upload a video where you can see it happening.

So i wonder what would be a nice solution. The absolute nerd option would be two settings parameter:

So maybe an "extra reloads after resume" option that would reload 4 time after resume with one second delay could be something inbetween?

So it would reload asap as the activity is resumed, then 4 more times after a second delay each might be good for most use cases.

Let me know what do you think!

KopiasCsaba commented 3 weeks ago

Here is a video to show it: https://www.youtube.com/watch?v=w_KBMJ048GI

I also wonder that a loading indicator would be nice to be seen when reloading is in progress when it's just because of the activity resume.

Aga-C commented 3 weeks ago

I could only reproduce it by switching quickly between the apps, at the pace you've shown in the video it was working fine. What device model do you have?

naveensingh commented 3 weeks ago

New items should show up regardless because we have a content observer listening for changes:

https://github.com/FossifyOrg/Gallery/blob/f649b1ef615ab0d41433fdf04ccdda3291a6fecc/app/src/main/kotlin/org/fossify/gallery/activities/SimpleActivity.kt#L21-L32

Evidently, it doesn't seem to be working correctly.

KopiasCsaba commented 3 weeks ago

I could only reproduce it by switching quickly between the apps, at the pace you've shown in the video it was working fine. What device model do you have?

Yeah, it probably depends on the device and the camera app. I'm using Pixel 7A with the Google Camera. It appears to think around quite a bit before saving the image to the storage apparently.

But it's good news that there is a pub/sub going on although it might be broken at the moment, but then no need to do extra refreshes.