优化序列帧操作
authorxue <2144439972@qq.com>
Wed, 24 Dec 2025 09:18:04 +0000 (17:18 +0800)
committerxue <2144439972@qq.com>
Wed, 24 Dec 2025 09:18:04 +0000 (17:18 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdBlueView.h
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdBlueView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdLullabyView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp

index f2f904a..71b4157 100644 (file)
@@ -64,6 +64,7 @@ namespace OHOS
         UIViewGroup *ThunderBirdBlueViewInit(void);
         void ClearAll(void);
         void Show(int16_t showView);
+        void StopAllAnimations(); // 停止所有动画
         void UpdateTaskReminderText(const char* text);
         void RefreshDeviceList(void);
         void HandleBluetoothViewOperation(int16_t view);
index efdee5f..90a9249 100644 (file)
@@ -232,6 +232,14 @@ namespace OHOS
         return group;
     }
 
+    void ThunderBirdBlueView::StopAllAnimations()
+    {
+        if (searchAnimator) {
+            searchAnimator->Stop();
+            searchAnimator->SetVisible(false);
+        }
+    }
+
     void ThunderBirdBlueView::Show(int16_t showView)
     {
         if (group == nullptr) { return; }
index 08cbf06..ce49796 100644 (file)
@@ -165,6 +165,18 @@ namespace OHOS
         return group;
     }
 
+    void ThunderBirdDialogueView::StopAllAnimations()
+    {
+        if (speakAnimator) {
+            speakAnimator->Stop();
+            speakAnimator->SetVisible(false);
+        }
+        if (listenAnimator) {
+            listenAnimator->Stop();
+            listenAnimator->SetVisible(false);
+        }
+    }
+
     void ThunderBirdDialogueView::Show(int16_t showView)
     {
         if (group == nullptr) { return; }
index b781836..2bbb579 100644 (file)
@@ -231,7 +231,7 @@ namespace OHOS
         if (RemindLabel) { RemindLabel->SetVisible(false);}
         if (RemindIcon) { RemindIcon->SetVisible(false); }
         if (RemindIcon2) { RemindIcon2->SetVisible(false); }
-        if (listenAnimator) { listenAnimator->SetVisible(false);listenAnimator->Start(); }
+        if (listenAnimator) { listenAnimator->SetVisible(false); listenAnimator->Stop(); }
 
         switch (showView)
         {
index c091677..6e91025 100644 (file)
@@ -1044,6 +1044,44 @@ namespace OHOS
             {
                 return;
             }
+            // 切换界面时,停止所有正在运行的序列帧动画
+            // 注意:由于Show函数在开始时都会停止动画,这里只处理public的animator
+            // private的animator会在Show函数中被停止
+            switch (hideView)
+            {
+            case THUNDERBIRD_GUIDEVIEW:
+                if (g_pThunderBirdGuideView && g_pThunderBirdGuideView->bandAnimator) {
+                    g_pThunderBirdGuideView->bandAnimator->Stop();
+                    g_pThunderBirdGuideView->bandAnimator->SetVisible(false);
+                }
+                break;
+            case THUNDERBIRD_DIALOGUEVIEW:
+                // speakAnimator和listenAnimator是private的,通过StopAllAnimations()停止
+                if (g_pThunderBirdDialogueView) {
+                    g_pThunderBirdDialogueView->StopAllAnimations();
+                }
+                break;
+            case THUNDERBIRD_ADJUSTVIEW:
+                // netAnimator是private的,通过StopAllAnimations()停止
+                if (g_pThunderBirdAdjustView) {
+                    g_pThunderBirdAdjustView->StopAllAnimations();
+                }
+                break;
+            case THUNDERBIRD_BLUEVIEW:
+                // searchAnimator是private的,通过StopAllAnimations()停止
+                if (g_pThunderBirdBlueView) {
+                    g_pThunderBirdBlueView->StopAllAnimations();
+                }
+                break;
+            case THUNDERBIRD_LULLABYVIEW:
+                if (g_pThunderBirdLullabyView && g_pThunderBirdLullabyView->listenAnimator) {
+                    g_pThunderBirdLullabyView->listenAnimator->Stop();
+                    g_pThunderBirdLullabyView->listenAnimator->SetVisible(false);
+                }
+                break;
+            default:
+                break;
+            }
             group[hideView]->SetVisible(false);
         }
         // 同用遮罩,部分界面在内部自行开启,其余界面关闭
index 9bda200..648b62b 100644 (file)
@@ -1125,7 +1125,7 @@ namespace OHOS
                         // 显示后再设置2秒定时器自动隐藏提示
                     } 
                     networkCount++;
-                    if(networkCount > 2)
+                    if(networkCount > 3)
                     {
                           //重新连接网络
                         do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_CAT1_RESTART, NULL, 0);
@@ -1150,7 +1150,7 @@ namespace OHOS
                             reminderView->dialogue_vad_initializing();
                         }
                     vadAuthCount++;
-                    if(vadAuthCount > 2)
+                    if(vadAuthCount > 3)
                     {
                         //先同步时间
                         cat1_gettime();