修复AI语音聆听中界面计时标签显示问题
authorluozheng <1732036298@qq.com>
Sat, 28 Sep 2024 06:23:43 +0000 (14:23 +0800)
committerluozheng <1732036298@qq.com>
Sat, 28 Sep 2024 06:23:43 +0000 (14:23 +0800)
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp

index 724d37d..6230e28 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-20 15:14:50
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-26 22:12:14
+ * @LastEditTime: 2024-09-28 10:30:19
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp
  */
 #include "aivoice/include/AiVoiceModel.h"
@@ -861,16 +861,14 @@ namespace OHOS
     static void AIListeningCallbackProc(int data)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AIListeningCallbackProc %d", LISTENING_TIMEOUT);
+        LISTENING_TIMEOUT--;
         if (LISTENING_TIMEOUT <= 0)
         {
             AiVoiceModel::GetInstance().StopListenAndRecordingUserQuestion(); //停止聆听用户问题
             AiVoiceModel::GetInstance().stop_listening_timer(); //停止聆听定时器
             if (AiVoiceView::GetInstance() && AivoiceListeningView::GetInstance() )
             {
-                AivoiceListeningView::GetInstance()->GetShowtimeoutLabel()->SetText("");
-                AivoiceListeningView::GetInstance()->GetShowtimeoutLabel()->Invalidate();
                 AiVoiceView::GetInstance()->ChangeView(AIVOICE_LISTENING_VIEWID, AIVOICE_THINKING_VIEWID); // 切换到思考中界面
-               
                 AiVoiceModel::GetInstance().AIVoice_StartTimer();
             }
         }
@@ -882,7 +880,6 @@ namespace OHOS
                 AivoiceListeningView::GetInstance()->GetShowtimeoutLabel()->Invalidate();
             }
         }
-        LISTENING_TIMEOUT--;
     }
     static void AIListeningCallback(int data)
     {
index c88853d..5753767 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-05-07 11:25:58
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-26 15:37:15
+ * @LastEditTime: 2024-09-28 14:18:24
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp
  */
 #include "aivoice/include/AiVoicePresenter.h"
@@ -588,6 +588,11 @@ namespace OHOS
             AiVoiceScrollView[thisView] = p_AivoiceListeningView->CreateAivoiceListeningView();
             container_->Add(AiVoiceScrollView[thisView]);
         }
+        if(p_AivoiceListeningView)
+        {
+            p_AivoiceListeningView->GetShowtimeoutLabel()->SetText("15");
+            p_AivoiceListeningView->GetShowtimeoutLabel()->Invalidate();
+        }
         AiVoiceModel::GetInstance().start_listening_timer();
         return true;
     }