!29930 当indexer弹出框只有一个文本时不显示底板

Merge pull request !29930 from yangziyong/indexer
This commit is contained in:
openharmony_ci 2024-04-09 14:36:22 +00:00 committed by Gitee
commit 83290cf9d8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 6 additions and 5 deletions

View File

@ -849,7 +849,7 @@ void IndexerPattern::UpdateBubbleView()
auto currentListData =
popListData ? popListData(actualChildIndex >= 0 ? actualChildIndex : actualIndex) : std::vector<std::string>();
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<std::string>& 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)));

View File

@ -142,7 +142,7 @@ private:
RefPtr<FrameNode> CreatePopupNode();
void UpdateBubbleView();
void UpdateBubbleSize();
void UpdateBubbleLetterView(bool showDivider);
void UpdateBubbleLetterView(bool showDivider, std::vector<std::string>& currentListData);
void CreateBubbleListView(std::vector<std::string>& currentListData);
void UpdateBubbleListView(std::vector<std::string>& currentListData);
void UpdatePopupOpacity(float ratio);

View File

@ -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,