From dcd307f43e44b8542072258c29b235ff6eee96c1 Mon Sep 17 00:00:00 2001 From: yangziyong Date: Mon, 1 Apr 2024 18:56:14 +0800 Subject: [PATCH] =?UTF-8?q?Fix:indexer=E5=BC=B9=E5=87=BA=E6=A1=86=E5=8F=AA?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E4=B8=AA=E6=96=87=E6=9C=AC=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=BA=95=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangziyong Change-Id: I63b462bebb62d9097d223bde674e6492d9a7c989 Signed-off-by: yangziyong --- .../components_ng/pattern/indexer/indexer_pattern.cpp | 8 ++++---- .../core/components_ng/pattern/indexer/indexer_pattern.h | 2 +- .../core/components_ng/pattern/indexer/indexer_theme.h | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frameworks/core/components_ng/pattern/indexer/indexer_pattern.cpp b/frameworks/core/components_ng/pattern/indexer/indexer_pattern.cpp index f8b9a322598..059e37a5bbf 100644 --- a/frameworks/core/components_ng/pattern/indexer/indexer_pattern.cpp +++ b/frameworks/core/components_ng/pattern/indexer/indexer_pattern.cpp @@ -849,7 +849,7 @@ void IndexerPattern::UpdateBubbleView() auto currentListData = popListData ? popListData(actualChildIndex >= 0 ? actualChildIndex : actualIndex) : std::vector(); UpdateBubbleListView(currentListData); - UpdateBubbleLetterView(!currentListData.empty()); + UpdateBubbleLetterView(!currentListData.empty(), currentListData); auto columnRenderContext = popupNode_->GetRenderContext(); CHECK_NULL_VOID(columnRenderContext); if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { @@ -953,7 +953,7 @@ void IndexerPattern::UpdateBubbleSize() popupNode_->MarkDirtyNode(); } -void IndexerPattern::UpdateBubbleLetterView(bool showDivider) +void IndexerPattern::UpdateBubbleLetterView(bool showDivider, std::vector& currentListData) { CHECK_NULL_VOID(popupNode_); auto host = GetHost(); @@ -981,8 +981,8 @@ void IndexerPattern::UpdateBubbleLetterView(bool showDivider) ? paintProperty->GetPopupItemBorderRadiusValue() : Dimension(BUBBLE_ITEM_RADIUS, DimensionUnit::VP); letterContext->UpdateBorderRadius({ radius, radius, radius, radius }); - letterNodeRenderContext->UpdateBackgroundColor( - paintProperty->GetPopupTitleBackground().value_or(indexerTheme->GetPopupTitleBackground())); + letterNodeRenderContext->UpdateBackgroundColor(paintProperty->GetPopupTitleBackground().value_or( + currentListData.size() > 0 ? indexerTheme->GetPopupTitleBackground() : Color(POPUP_TITLE_BG_COLOR_SINGLE))); } else { auto bubbleSize = Dimension(BUBBLE_BOX_SIZE, DimensionUnit::VP).ConvertToPx(); letterLayoutProperty->UpdateUserDefinedIdealSize(CalcSize(CalcLength(bubbleSize), CalcLength(bubbleSize))); diff --git a/frameworks/core/components_ng/pattern/indexer/indexer_pattern.h b/frameworks/core/components_ng/pattern/indexer/indexer_pattern.h index 11f8629fcd0..a8b71324aa0 100644 --- a/frameworks/core/components_ng/pattern/indexer/indexer_pattern.h +++ b/frameworks/core/components_ng/pattern/indexer/indexer_pattern.h @@ -142,7 +142,7 @@ private: RefPtr CreatePopupNode(); void UpdateBubbleView(); void UpdateBubbleSize(); - void UpdateBubbleLetterView(bool showDivider); + void UpdateBubbleLetterView(bool showDivider, std::vector& currentListData); void CreateBubbleListView(std::vector& currentListData); void UpdateBubbleListView(std::vector& currentListData); void UpdatePopupOpacity(float ratio); diff --git a/frameworks/core/components_ng/pattern/indexer/indexer_theme.h b/frameworks/core/components_ng/pattern/indexer/indexer_theme.h index 60e2360970a..d657fed5a4e 100644 --- a/frameworks/core/components_ng/pattern/indexer/indexer_theme.h +++ b/frameworks/core/components_ng/pattern/indexer/indexer_theme.h @@ -97,6 +97,7 @@ inline constexpr float BUBBLE_COLLAPSE_LIST_MAX_SIZE = 178.0f; inline constexpr double GRADIENT_COVER_HEIGHT = 16.0; inline constexpr uint32_t INDEXER_BUBBLE_MAXSIZE_COLLAPSED_API_TWELVE = 3; // 2 items + 1 letter inline constexpr float INDEXER_PADDING_TOP_API_TWELVE = 4.0f; +inline constexpr uint32_t POPUP_TITLE_BG_COLOR_SINGLE = 0x00ffffff; enum class AlignStyle { LEFT = 0,