From: Caisking <3449750381@qq.com> Date: Tue, 22 Oct 2024 06:42:41 +0000 (+0800) Subject: 表盘:修复自定义表盘更新刷新异常 X-Git-Tag: fd230_release_V1.3.102~207 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=5d38e42a984b4e20e1ace69d34c0adff30d98f3f;p=mirrors%2FFD230.git 表盘:修复自定义表盘更新刷新异常 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp b/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp index e19938cf1..39c387a49 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp @@ -176,8 +176,12 @@ namespace OHOS return true; } /*初始化表盘背景*/ - bool MainClockView::InitBackground(const char *filename) - { + bool MainClockView::InitBackground(const char *filename) { + + if (filename == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "filename is null"); + return false; + } curFace = new UIImageView(); if (curFace == nullptr) { @@ -191,7 +195,7 @@ namespace OHOS if (image == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LoadAllDialFromRam loadimage %s fail", - filename); + filename); curFace->SetSrc(DEFAULT_DIALBACK_PATH); Add(curFace); return false; diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp index 825b1086a..67656e250 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp @@ -408,8 +408,8 @@ void SetDialModel::UpdateDialSetting(uint16_t ID) { if (ID <= 4) { ID++; } - /*判断是否为当前表盘*/ - if (currentDialID == ID) { + /*判断是否为当前表盘 如果是自定义表盘 需要更新*/ + if (currentDialID == ID && ID >=5) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UpdateDialSetting: Current dial cannot be updated"); return; @@ -690,7 +690,8 @@ void SetDialModel::LoadAllDialFromRam() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Processing Dial ID %u: Name: %s", i, dialInfo.dialName.c_str()); - // 加载图像资源 + // 加载图像资源 (因为自定义表盘可能更新。需要先对其进行卸载) + ImageCacheManager::GetInstance().UnloadSingleRes(info->dialImg); ImageInfo *imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(info->dialImg, false); if (imageInfo == nullptr) {