Implement pagination for file entries in View class (#486)
* Implement pagination for file entries in View class * Add resolveDirentFromListIndex method and refactor entry handling in View class * Fix current_start_index calculation in View::update to prevent out-of-bounds access
This commit is contained in:
committed by
GitHub
parent
2aa41cb562
commit
7e24105d0c
@@ -11,6 +11,10 @@ namespace tt::app::files {
|
||||
|
||||
class View final {
|
||||
std::shared_ptr<State> state;
|
||||
|
||||
size_t current_start_index = 0;
|
||||
size_t last_loaded_index = 0;
|
||||
const size_t MAX_BATCH = 50;
|
||||
|
||||
lv_obj_t* dir_entry_list = nullptr;
|
||||
lv_obj_t* action_list = nullptr;
|
||||
@@ -33,7 +37,7 @@ public:
|
||||
explicit View(const std::shared_ptr<State>& state) : state(state) {}
|
||||
|
||||
void init(const AppContext& appContext, lv_obj_t* parent);
|
||||
void update();
|
||||
void update(size_t start_index = 0);
|
||||
|
||||
void onNavigateUpPressed();
|
||||
void onDirEntryPressed(uint32_t index);
|
||||
@@ -45,6 +49,10 @@ public:
|
||||
void onDirEntryListScrollBegin();
|
||||
void onResult(LaunchId launchId, Result result, std::unique_ptr<Bundle> bundle);
|
||||
void deinit(const AppContext& appContext);
|
||||
|
||||
private:
|
||||
|
||||
bool resolveDirentFromListIndex(int32_t list_index, dirent& out_entry);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user