From e1d0601fe710d0a5d8846a094f8f075c80ecc6ad Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sat, 22 Jun 2024 16:27:58 +0800 Subject: [PATCH] =?utf8?q?=E6=98=BE=E7=A4=BA=E4=B8=8E=E6=96=B9=E5=BC=8FMod?= =?utf8?q?el=E8=A1=A5=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/themestyle/src/ThemeStyleModel.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStyleModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStyleModel.cpp index 58ba50568..98610024a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStyleModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStyleModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-07 09:21:47 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-22 15:10:07 + * @LastEditTime: 2024-06-22 16:15:02 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/ThemeStyleModel.cpp */ @@ -31,7 +31,12 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThemeStyleModel::GetAppListDisplayStyle"); char temp[STYLE_VALUE_LEN] = {0}; - (void)UtilsGetValue(THEMESTYLE_KEY, temp, STYLE_VALUE_LEN); // 从文件系统或缓存中获取与指定键匹配的值。 + int ret = UtilsGetValue(THEMESTYLE_KEY, temp, STYLE_VALUE_LEN); // 从文件系统或缓存中获取与指定键匹配的值。 + if (ret != EC_SUCCESS) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UtilsGetValue error,temp:%s,ret = %d", temp, ret); + return ThemeStyle::APPLIST_STYLE; + } // 检查是否存在对应的样式选项 auto it = ReverseThemeStyleMap.find(std::string(temp)); @@ -55,11 +60,14 @@ namespace OHOS // 检查是否存在对应的样式选项 if (ThemeStyleMap.find(style) != ThemeStyleMap.end()) { + const char *value = THEMESTYLE_KEY; + const char *key = ThemeStyleMap.at(style).c_str(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "value:%s,key:%s", value, key); // 根据映射设置显示样式值 - int ret = UtilsSetValue(THEMESTYLE_KEY, ThemeStyleMap.at(style).c_str()); + int ret = UtilsSetValue(value, key); if (ret != EC_SUCCESS) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UtilsSetValue error,ret = %d", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UtilsSetValue error,ret = %d", ret); return; } } -- 2.17.1