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");
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);