Skip to content

fix: show Properties for Recycle Bin and Favorites folders#1087

Open
MiMoHo wants to merge 1 commit into
FossifyOrg:mainfrom
MiMoHo:fix/issue-976
Open

fix: show Properties for Recycle Bin and Favorites folders#1087
MiMoHo wants to merge 1 commit into
FossifyOrg:mainfrom
MiMoHo:fix/issue-976

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 3, 2026

Copy link
Copy Markdown

Type of change(s)

  • Bug fix

What changed and why

Long-pressing the Recycle Bin or Favorites folder and tapping the Properties (i) icon did nothing. DirectoryAdapter.showProperties() opened the single-path PropertiesDialog only inside an if (path != FAVORITES && path != RECYCLE_BIN) guard with no else branch, so both virtual folders fell through and the action was a silent no-op. The guard existed because these folders have virtual DB paths ("recycle_bin" / "favorites") that are not real files, and the single-path PropertiesDialog rejects non-existent paths.

The fix gathers the real underlying media paths and shows them in the multi-path PropertiesDialog:

  • Recycle Bin: getUpdatedDeletedMedia() (rewrites the virtual prefix to the actual recycleBinPath location).
  • Favorites: getFavoritePaths() (FavoritesDao.getValidFavoritePaths()).

Both helpers run Room queries and GalleryDatabase is built without allowMainThreadQueries(), so they must run off the UI thread — otherwise Room throws and the helpers silently return empty lists. They are therefore executed on a background thread via ensureBackgroundThread, then the dialog is shown back on the UI thread. An isNotEmpty() guard avoids passing an empty list to the multi-path constructor (which indexes fileDirItems[0]).

Tests performed

Built the fossDebug variant and verified on an Android 15 (API 35) emulator:

Created a Favorite and a recycle-bin item; on folders screen long-pressed 'Recycle bin' -> Properties opened a dialog (Items selected 1 / Size 1.4 MB / Files 1). Repeated for 'Favorites' -> Properties dialog opened. Previously nothing happened.

Also confirmed detekt, lint, unit tests and the build all pass locally (CI-equivalent).

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator.
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • I have self-reviewed my pull request (no typos, formatting errors, etc.).
  • I understand every change in this pull request.

Coded with Opus 4.8 ultracode.

The Properties action was a no-op when long-pressing the Recycle Bin or
Favorites folder: showProperties() guarded the single-path PropertiesDialog
with an if that had no else branch for these virtual folders, whose paths
("recycle_bin"/"favorites") are not real files.

Gather the actual media file paths instead - via getUpdatedDeletedMedia()
for the Recycle Bin and getFavoritePaths() for Favorites - on a background
thread (the Room-backed helpers must not run on the UI thread) and show
them in the multi-path PropertiesDialog, guarding against an empty list.
@MiMoHo MiMoHo requested a review from naveensingh as a code owner July 3, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Propteries doesn't work on Recycle bin & favorites folder

1 participant