From e04bfa14f1cd88e623c125a379cdbe1c26d6dc2a Mon Sep 17 00:00:00 2001 From: xfangfang <2553041586@qq.com> Date: Fri, 31 Jan 2025 22:52:25 +0800 Subject: [PATCH] Simplify code --- wiliwili/source/fragment/search_history.cpp | 1 - wiliwili/source/fragment/search_hots.cpp | 1 - wiliwili/source/view/recycling_grid.cpp | 5 +++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/wiliwili/source/fragment/search_history.cpp b/wiliwili/source/fragment/search_history.cpp index f3c0e05b6..1f3b19b3d 100644 --- a/wiliwili/source/fragment/search_history.cpp +++ b/wiliwili/source/fragment/search_history.cpp @@ -25,7 +25,6 @@ brls::View *SearchHistory::create() { return new SearchHistory(); } SearchHistory::~SearchHistory() { brls::Logger::debug("Fragment SearchHistory: delete"); - this->recyclingGrid->clearData(); } class HistoryDataSource : public RecyclingGridDataSource { diff --git a/wiliwili/source/fragment/search_hots.cpp b/wiliwili/source/fragment/search_hots.cpp index 6bcc0765e..5e7c91d87 100644 --- a/wiliwili/source/fragment/search_hots.cpp +++ b/wiliwili/source/fragment/search_hots.cpp @@ -29,7 +29,6 @@ brls::View *SearchHots::create() { return new SearchHots(); } SearchHots::~SearchHots() { brls::Logger::debug("Fragment Hots: delete"); - this->recyclingGrid->clearData(); } class HotsDataSource : public RecyclingGridDataSource { diff --git a/wiliwili/source/view/recycling_grid.cpp b/wiliwili/source/view/recycling_grid.cpp index 5e3e57098..bfc75f6b4 100644 --- a/wiliwili/source/view/recycling_grid.cpp +++ b/wiliwili/source/view/recycling_grid.cpp @@ -288,11 +288,12 @@ void RecyclingGrid::reloadData() { if (!layouted) return; // 将所有节点从屏幕上移除放入重复利用的列表中 - auto children = this->contentBox->getChildren(); + auto &children = this->contentBox->getChildren(); for (auto const& child : children) { queueReusableCell((RecyclingGridItem*)child); - this->removeCell(child); + child->willDisappear(true); } + children.clear(); visibleMin = UINT_MAX; visibleMax = 0;