Skip to content

Implement pagination for file entries in View class#486

Open
Revers-BR wants to merge 3 commits intoTactilityProject:mainfrom
Revers-BR:feature/files-pagination-next-back
Open

Implement pagination for file entries in View class#486
Revers-BR wants to merge 3 commits intoTactilityProject:mainfrom
Revers-BR:feature/files-pagination-next-back

Conversation

@Revers-BR
Copy link
Contributor

@Revers-BR Revers-BR commented Feb 6, 2026

Implement pagination for file entries in View

This PR introduces pagination for the file entries in the View class to handle folders with a large number of files efficiently.

Changes:

  • Added member variables to View:

    • current_start_index – tracks the start index of the currently displayed batch.
    • last_loaded_index – tracks the index for the next batch.
    • MAX_BATCH – sets the maximum number of files displayed per page (50).
  • Updated View::update():

    • Displays only a batch of MAX_BATCH file entries at a time.
    • Adds Next and Back buttons for navigation between pages.
    • Automatically hides the Next button if there are no more files to show.
    • Shows the Back button only when the user has advanced from the first batch.
    • Ensures that the list is replaced with each new batch instead of appending.
  • Navigation buttons (Back and Next) are in English to maintain UI consistency.

Benefits:

  • Improves performance and responsiveness when opening folders with many files (e.g., sdcard).
  • Provides clear navigation for large directories without overwhelming the UI.
  • Keeps the root folder navigation intact (navigate_up_button visibility remains correct).

Screenshots (optional):

  • Root folder: shows data, sdcard, and Next if more than 50 entries.
  • sdcard folder: pagination works correctly with Next/Back buttons.

Summary by CodeRabbit

  • New Features

    • Directory listings load in batches for faster browsing of large folders.
    • Added Next and Back controls to page through directory entries.
    • File labels now include file size for regular files.
  • Bug Fixes

    • Improved synchronization and stability during file-list rendering to reduce hangs and glitches.
    • More consistent handling of directory, file, and symlink selection behavior.

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

The View class signature changed: update()update(size_t start_index = 0). Three new members track batching: current_start_index, last_loaded_index, and MAX_BATCH (const, 50). Rendering was refactored to produce directory entries in batches, with Back and Next navigation controls when applicable. A new helper resolveDirentFromListIndex(int32_t, dirent&) centralizes index-to-dirent mapping. LVGL mutex acquisition now returns early on failure.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Implement pagination for file entries in View class' accurately describes the main change: introducing pagination functionality to handle file entries in batches with navigation controls.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

@KenVanHoeylandt
Copy link
Contributor

That looks like a good feature to have, thanks!

CodeRabbit seems to have found some potential issues, so please take a look.
If you think it's not a bug, just put a comment in the relevant thread with the reasoning why.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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