With Random sorting, a photo deleted in the fullscreen view stays in the folder grid

Aperta Adatta ai principianti
#1,235 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, kotlin
Ambito
mobile

Direzione di ricerca

Inizia da MediaActivity.onResume in app/src/main/kotlin/org/fossify/gallery/activities/MediaActivity.kt, in particolare dal controllo di ricaricamento dell’ordinamento casuale e dalla gestione di mWasFullscreenViewOpen. Riproduci il problema eliminando o rinominando una foto a schermo intero con l’ordinamento casuale limitato alla cartella, quindi tornando alla cartella. Il lavoro è completato quando la griglia della cartella e la navigazione tramite scorrimento non includono più il percorso eliminato o precedente, mentre le foto rimanenti mantengono il loro ordine.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug needs triage
Checklist
  • I can reproduce the bug with the latest version given here.
  • I made sure that there are no existing issues - open or closed - to which I could contribute my information.
  • I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
  • I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.
Affected app version

1.14.3

Affected Android/Custom ROM version

Android 11 (API 30), stock emulator image

Affected device model

Android Emulator (x86, 1080×1920)

How did you install the app?

None

Steps to reproduce the bug
  1. Open a folder with a few photos (here Trip with blue.jpg, green.jpg, purple.jpg, red.jpg, yellow.jpg).
  2. Sort by → Random → tick "Use for this folder only" → OK.
  3. Tap blue.jpg to open it in fullscreen.
  4. Tap Delete → Yes. The viewer moves on to the next photo.
  5. Press Back to return to the folder.
  6. Tap another photo and swipe through the folder.
Expected behavior

blue.jpg is no longer in the folder grid, as with every other sorting.

Actual behavior

The grid still shows the thumbnail of blue.jpg, although the file is gone from the folder (it is in the recycle bin). Tapping it does nothing. Opening a neighbouring photo and swiping reaches a page titled blue.jpg that says "Failed to load media."

The same happens with Rename in the fullscreen view: after renaming yellow.jpg to yellow2.jpg and going back, the grid still shows yellow.jpg.

It stays like this until the folder is refreshed by pull-to-refresh or closed and opened again. With the default sorting (not Random), the same steps remove the photo from the grid right away.

Screenshots/Screen recordings
grid after delete in viewer viewer failed to load
01-grid-after-delete-in-viewer 02-viewer-failed-to-load
Step 5: back in the Random-sorted folder, blue.jpg is still in the grid after it was deleted in the fullscreen view. Step 6: swiping from a neighbouring photo reaches blue.jpg, "Failed to load media."
grid after rename in viewer
03-grid-after-rename-in-viewer
After renaming yellow.jpg to yellow2.jpg in the fullscreen view, the grid still shows yellow.jpg.
Additional information

MediaActivity.onResume skips the reload for Random sorting once a fullscreen view has been opened, so that the order is not reshuffled when coming back:
https://github.com/FossifyOrg/Gallery/blob/bde42f4a055205382bff299a5f06a399bc7da99d/app/src/main/kotlin/org/fossify/gallery/activities/MediaActivity.kt#L252-L254

Nothing removes or updates the changed item in the list that is kept, and mWasFullscreenViewOpen is never set back to false after it is set here, so later returns to the folder do not reload it either:
https://github.com/FossifyOrg/Gallery/blob/bde42f4a055205382bff299a5f06a399bc7da99d/app/src/main/kotlin/org/fossify/gallery/activities/MediaActivity.kt#L968

Possible fix: on resume, remove the paths that no longer exist from the kept list (without reshuffling); that keeps the order and drops deleted or renamed items.

Lingua principale
Kotlin
Stelle
3.8k
Fork
270
Merge medio
1g 6h
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di FossifyOrg/Gallery

Tutte le issue di FossifyOrg/Gallery

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.