优化电量显示
authorxue <2144439972@qq.com>
Thu, 13 Nov 2025 08:34:28 +0000 (16:34 +0800)
committerxue <2144439972@qq.com>
Thu, 13 Nov 2025 08:34:28 +0000 (16:34 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp

index 2d5ae25..0b613ba 100644 (file)
@@ -787,8 +787,20 @@ namespace OHOS
             }
         }
 
+        hairIcon = new UIImageView();
+        if (hairIcon == nullptr)
+        {
+            GRAPHIC_LOGE("hairIcon is nullptr\n");
+            return;
+        }
+        hairIcon->SetAutoEnable(false);
+        hairIcon->SetPosition(0, 0, 360, 360);
+        hairIcon->SetResizeMode(UIImageView::COVER);
+        hairIcon->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+        hairIcon->SetVisible(false);
         ScrollView_->Add(surfaceView_);
         ScrollView_->Add(curFace);
+        ScrollView_->Add(hairIcon);//图层逻辑:(从下往上)surfaceView_(视频) -> curFace(头发) -> hairIcon(头发图标)
     }
 
     void ThunderBirdMainView::SwitchHair(const char *hairPath)
@@ -799,6 +811,24 @@ namespace OHOS
         curFace->SetSrc(hairPath);
         curFace->Invalidate();
     }
+    void ThunderBirdMainView::SwitchHairIcon(const char *hairIconPath)
+    {
+        if (hairIcon == nullptr || hairIconPath == nullptr) {
+            return;
+        }
+        hairIcon->SetSrc(hairIconPath);
+        hairIcon->SetVisible(true);
+        hairIcon->Invalidate();
+    }
+
+    void ThunderBirdMainView::StopHairIcon(void)
+    {
+        if (hairIcon == nullptr) {
+            return;
+        }
+        hairIcon->SetVisible(false);
+        hairIcon->Invalidate();
+    }
     
    //获取是否开启屏保模式
    bool ThunderBirdMainView::GetIsOpenScreenImageModel(void)
@@ -1003,8 +1033,8 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "progress new fail");
             return nullptr;
         }
-        progress->SetPosition(batteryimage->GetX() + 5, batteryimage->GetY() + 4, 18, 12);
-        progress->SetValidWidth(18);
+        progress->SetPosition(batteryimage->GetX() + 5, batteryimage->GetY() + 4, 20 ,12);
+        progress->SetValidWidth(20);
         progress->SetValidHeight(12);
         progress->SetRange(100, 0);
         progress->SetStyle(STYLE_BORDER_RADIUS, 3);