Repository navigation
feat(gallery): Drag to select photos - #3
Merged
Merged
Conversation
…r dates The gallery used to always sort by last modified date, which changes whenever a photo is copied, restored or edited. It now sorts by the file's creation date by default, which uploads from Android fill in from the photo's date taken. A new toolbar button, left of the period filter, opens a sheet to pick between date taken, date modified and date added. The choice is persisted, triggers a reload from the API with the matching order, and section headers use the same date. The offline cache is re-sorted locally by the chosen date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017EHLLDTsEsyzxGQ8uPBdn2
fabiocatalao
marked this pull request as ready for review
October 2, 2026 16:17
…t button Drag to select only existed in the file list. The gallery now uses the same DragSelectTouchListener, skipping month headers, which share the list with the photos. A long press now selects the photo instead of toggling it. The drag listener reacts to the same long press, so a toggle would unselect the photo right after the listener selected it. Selection changes redraw only the checkmark, so thumbnails don't reload while dragging. The sort button showed a calendar; it now shows a sort icon. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This reverts the sort part of 5f4eafa. The gallery loads through /3/drive/{id}/files/search, which only accepts order_by=last_modified_at or relevance. The server rejects added_at and created_at with a 422, so Date added and Date taken showed only the cached photos and never loaded more. Sorting the whole gallery on the device doesn't scale to a large library, so the gallery goes back to the server's date-modified order. Drag to select from the previous commit is kept. The sort icon goes away with the button. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012mej6ZVyiQ7aAfoRJYT1d4
fabiocatalao
added a commit
that referenced
this pull request
Nov 27, 2026
Add drag-to-select support to the gallery by reusing DragSelectTouchListener from the file list in GalleryFragment and GalleryAdapter: - Skip month header rows when selecting or deselecting ranges across adapter positions. - Select rather than toggle on long press so the card listener and drag listener do not cancel each other out (tapping still toggles). - Redraw only the checkmark via a selection payload so thumbnails do not reload while dragging. Squashes PR #3 (add sort / drag-to-select + sort icon / revert sort) into its net drag-to-select diff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
In the file list you can long-press and drag to select a range of files. The gallery didn't support this, so selecting many photos meant tapping each one.
What changes
Implementation
GalleryFragment.setupDragSelection()attaches the existingDragSelectTouchListener(fromui/fileList), set up the same way asFileListFragment.setupDragSelection().GalleryAdapter:isFileSelectableAt()andsetFilesSelectedInRange(), which work on adapter positions and skip header rows. Selection goes through the selection model, so a photo is never added to the selected items twice. A payload bind updates only the checkmark.Sort by date taken: dropped
This PR first added a gallery sort toggle (Date taken / Date modified / Date added). It's reverted in the last commit:
/3/drive/{id}/files/searchaccepts onlyorder_by=last_modified_atorrelevanceand rejectscreated_atandadded_atwith a 422. As a result, the two new options showed only the cached photos and never loaded more. Sorting the whole gallery on the device doesn't scale to large libraries, so the gallery keeps the server's date-modified order.Verification
compileStandardDebugKotlinandtestStandardDebugUnitTestpass🤖 Generated with Claude Code
https://claude.ai/code/session_012mej6ZVyiQ7aAfoRJYT1d4