修复蓝牙页面异常
authorxue <2144439972@qq.com>
Tue, 13 Jan 2026 10:33:38 +0000 (18:33 +0800)
committerxue <2144439972@qq.com>
Tue, 13 Jan 2026 10:33:38 +0000 (18:33 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp

index 884d207..7056588 100644 (file)
@@ -1127,7 +1127,7 @@ namespace OHOS
 
     void ThunderBirdMainView::ChangeView(int16_t hideView, int16_t showView, int16_t subView)
     {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdMainView::ChangeView");
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdMainView::ChangeView hideView=%d, showView=%d, subView=%d", hideView, showView, subView);
         if (hideView > MAXVIEW)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdMainView:: SystemViewId Overstep ones bounds");
@@ -1522,12 +1522,18 @@ namespace OHOS
                 printf("imagePath is nullptr\n");
                 return;
             }
-          
+        
+        // 检查是否与当前图片路径相同,避免重复设置
+        const char* currentPath = iconView->GetPath();
+        if (currentPath != nullptr && strcmp(currentPath, imagePath) == 0) {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdMainView::SwitchIconImage: Image already set to %s, skipping", imagePath);
+            return;
+        }
         
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdMainView::SwitchIconImage: Switching to image: %s", imagePath);
         
         // 清除图片缓存,确保重新加载
-        CacheManager::GetInstance().Close(imagePath);
+        // CacheManager::GetInstance().Close(imagePath);
         
         // 设置新的图片源
         iconView->SetSrc(imagePath);