Skip to content

refactor: Move gallery grouping logic to GalleryViewModel - #2064

Draft
aymericmariaux wants to merge 2 commits into
mainfrom
refactor-gallery-viewmodel
Draft

refactor: Move gallery grouping logic to GalleryViewModel#2064
aymericmariaux wants to merge 2 commits into
mainfrom
refactor-gallery-viewmodel

Conversation

@aymericmariaux

Copy link
Copy Markdown
Contributor

No description provided.

@aymericmariaux
aymericmariaux requested a balanced review from Copilot August 5, 2026 13:08
@aymericmariaux aymericmariaux self-assigned this Aug 5, 2026
@aymericmariaux
aymericmariaux marked this pull request as draft August 5, 2026 13:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves gallery grouping and file-list state from the adapter into GalleryViewModel.

Changes:

  • Centralizes gallery grouping, duplication, removal, and clearing.
  • Updates fragment synchronization and preview handling.
  • Simplifies adapter responsibilities and fast-scroll title lookup.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
GalleryViewModel.kt Owns gallery state and grouping logic.
GalleryFragment.kt Coordinates ViewModel and adapter state.
GalleryAdapter.kt Retains display-only list operations.

Comment thread app/src/main/java/com/infomaniak/drive/ui/menu/GalleryFragment.kt Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

app/src/main/java/com/infomaniak/drive/ui/menu/GalleryAdapter.kt:148

  • When duplicated files belong to the existing top month, prependDuplicatedImages deliberately omits a new title, but this method inserts those files at index 0. The gallery then starts with files before their section header; a later duplicate can also create a second header for that month. Preserve the previous behavior by inserting title-less prefixes immediately after the existing title.
    fun insertDuplicatedImages(prefix: List<Any>) {
        itemList.addAll(0, prefix)

@aymericmariaux
aymericmariaux force-pushed the refactor-gallery-viewmodel branch from 46a5fdc to 3708c90 Compare August 6, 2026 06:31
@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

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.

2 participants