From 33849f76712ec4048328ad7ded287a59a54af321 Mon Sep 17 00:00:00 2001 From: r00447448 Date: Thu, 23 Nov 2023 20:54:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=AE=A1=E7=90=86=E6=9C=BA?= =?UTF-8?q?=E5=88=B6=E5=BD=92=E4=B8=80=5Frating=E8=B5=84=E6=BA=90=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E4=BD=BF=E7=94=A8sys=5Fresource=20Signed-off-by:=20ra?= =?UTF-8?q?nzhiqiang=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/components/rating/rating_theme.h | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/frameworks/core/components/rating/rating_theme.h b/frameworks/core/components/rating/rating_theme.h index 8a588db9ca0..e2d1640bbe6 100644 --- a/frameworks/core/components/rating/rating_theme.h +++ b/frameworks/core/components/rating/rating_theme.h @@ -47,33 +47,30 @@ public: if (!themeConstants) { return theme; } - theme->starNum_ = themeConstants->GetInt(THEME_RATING_STAR_NUM); - theme->ratingScore_ = themeConstants->GetDouble(THEME_RATING_SCORE); - theme->ratingMiniScore_ = themeConstants->GetDouble(THEME_RATING_MINI_SCORE); - theme->stepSize_ = themeConstants->GetDouble(THEME_RATING_STEPSIZE); - theme->paddingVertical_ = themeConstants->GetDimension(THEME_RATING_PADDING_VERTICAL); - theme->ratingWidth_ = themeConstants->GetDimension(THEME_RATING_BIG_WIDTH); - theme->ratingHeight_ = themeConstants->GetDimension(THEME_RATING_BIG_HEIGHT); - theme->ratingMiniWidth_ = themeConstants->GetDimension(THEME_RATING_MINI_WIDTH); - theme->ratingMiniHeight_ = themeConstants->GetDimension(THEME_RATING_MINI_HEIGHT); theme->foregroundResourceId_ = themeConstants->GetResourceId(THEME_RATING_RESOURCE_ID_BIG_ON); theme->secondaryResourceId_ = themeConstants->GetResourceId(THEME_RATING_RESOURCE_ID_BIG_HALF); theme->backgroundResourceId_ = themeConstants->GetResourceId(THEME_RATING_RESOURCE_ID_BIG_OFF); theme->foregroundMiniResourceId_ = themeConstants->GetResourceId(THEME_RATING_RESOURCE_ID_MINI_ON); theme->secondaryMiniResourceId_ = themeConstants->GetResourceId(THEME_RATING_RESOURCE_ID_MINI_HALF); theme->backgroundMiniResourceId_ = themeConstants->GetResourceId(THEME_RATING_RESOURCE_ID_MINI_OFF); - theme->designedStarAspectRatio_ = themeConstants->GetDouble(THEME_RATING_DESIGNED_STAR_ASPECT_RATIO); - theme->focusBorderWidth_ = themeConstants->GetDimension(THEME_RATING_FOCUS_BORDER_WIDTH); - theme->hoverColor_ = themeConstants->GetColor(THEME_RATING_HOVER_COLOR); - theme->starColorActive_ = themeConstants->GetColor(THEME_RATING_STAR_COLOR_ACTIVE); - theme->starColorInactive_ = themeConstants->GetColor(THEME_RATING_STAR_COLOR_INACTIVE); - theme->borderRadius_ = themeConstants->GetDimension(THEME_RATING_FOCUS_BORDER_RADIUS); + auto themeStyle = themeConstants->GetThemeStyle(); if (!themeStyle) { return theme; } auto pattern = themeStyle->GetAttr>(THEME_PATTERN_RATING, nullptr); if (pattern) { + theme->starNum_ = static_cast(pattern->GetAttr("rating_start_num", 0.0)); + theme->ratingScore_ = pattern->GetAttr("rating_score", 0.0); + theme->ratingMiniScore_ = pattern->GetAttr("rating_mini_score", 0.0); + theme->stepSize_ = pattern->GetAttr("rating_step_size", 0.0); + theme->paddingVertical_ = pattern->GetAttr("rating_padding_vertical", 0.0_vp); + theme->ratingWidth_ = pattern->GetAttr("rating_big_width", 0.0_vp); + theme->ratingHeight_ = pattern->GetAttr("rating_big_height", 0.0_vp); + theme->ratingMiniWidth_ = pattern->GetAttr("rating_mini_width", 0.0_vp); + theme->ratingMiniHeight_ = pattern->GetAttr("rating_mini_height", 0.0_vp); + theme->designedStarAspectRatio_ = pattern->GetAttr("rating_designed_start_aspect_ratio", 0.0); + theme->focusBorderWidth_ = pattern->GetAttr("rating_focus_border_width", 0.0_vp); theme->hoverColor_ = pattern->GetAttr(PATTERN_BG_COLOR_HOVERED, STAR_HOVER_COLOR); theme->pressColor_ = pattern->GetAttr(PATTERN_BG_COLOR_PRESSED, STAR_PRESS_COLOR); theme->starColorActive_ = pattern->GetAttr("icon_color_active", Color::RED); -- Gitee