#644,解决,计时器显示问题bug
authorluozheng <1732036298@qq.com>
Fri, 13 Sep 2024 02:07:06 +0000 (10:07 +0800)
committerluozheng <1732036298@qq.com>
Fri, 13 Sep 2024 02:07:06 +0000 (10:07 +0800)
#645,解决,  计时器显示错误bug

code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp

index c1f5b4c..55a1cc7 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-04-07 18:15:53\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-09-07 17:12:44\r
+ * @LastEditTime: 2024-09-13 09:41:37\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp\r
  */\r
 #include "countdown/include/CountDownModel.h"\r
@@ -231,7 +231,7 @@ namespace OHOS
      */\r
     int CountDownModel::StopRingtonePlaybackAndReleaseResources(void)\r
     {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownModel::StopRingtonePlaybackAndReleaseResources");\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CountDownModel::StopRingtonePlaybackAndReleaseResources");\r
         int32_t ret = 0;\r
         int32_t state = 0;\r
         AudioManager &amIntance = AudioManager::GetInstance();\r
index 9574f68..319005d 100644 (file)
@@ -167,22 +167,25 @@ namespace OHOS
                 CountDownModel::GetInstance()->SetRingTime(timePicker->GetSelectValue());      // 设置响铃时间\r
             }\r
 \r
-            if (strcmp(CountDownModel::GetInstance()->GetCountDownTime().c_str(), "00:00:00") == 0)\r
+            if (strcmp(CountDownModel::GetInstance()->GetCountDownTime().c_str(), "00:00:00") == 0) // 如果自定义时间设置为0\r
             {\r
                 p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, COUNTDOWN_TIMENOTNULL);\r
                 return true;\r
             }\r
             else\r
             {\r
-                if (p_MainCountDownView->GetStartCountDownView() != nullptr)\r
+                p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, START_COUNTDOWN);\r
+                if (p_StartCountDownView != nullptr)\r
                 {\r
-                    p_MainCountDownView->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText(CountDownModel::GetInstance()->GetCountDownTime().c_str());\r
-                    p_MainCountDownView->GetStartCountDownView()->GetShowTheRingTimelabel()->SetText(CountDownModel::GetInstance()->GetRingTime().c_str());\r
-                    p_MainCountDownView->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetVisible(true);\r
-                    p_MainCountDownView->GetStartCountDownView()->GetRepeatButton()->SetVisible(false);\r
+                    std::string CountDownTime = CountDownModel::GetInstance()->GetCountDownTime();\r
+                    std::string RingTime = CountDownModel::GetInstance()->GetRingTime();\r
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownTime = %s RingTime = %s", CountDownTime.c_str(),RingTime.c_str());\r
+                    p_StartCountDownView->GetShowCountDownTimelabel()->SetText(CountDownTime.c_str());\r
+                    p_StartCountDownView->GetShowTheRingTimelabel()->SetText(RingTime.c_str());\r
+                    p_StartCountDownView->GetPlayOrPauseToggleButton()->SetVisible(true);\r
+                    p_StartCountDownView->GetRepeatButton()->SetVisible(false);\r
                 }\r
 \r
-                p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, START_COUNTDOWN);\r
                 return true;\r
             }\r
         }\r
@@ -202,9 +205,10 @@ namespace OHOS
             CountDownModel::GetInstance()->SetCountDownTime("00:00:00");\r
             CountDownModel::GetInstance()->SetRingTime("00:00:00");\r
             CountDownModel::GetInstance()->StopRingtonePlaybackAndReleaseResources();\r
-            MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetTouchable(true);\r
-            MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetState(false);\r
+            p_StartCountDownView->GetPlayOrPauseToggleButton()->SetTouchable(true);\r
+            p_StartCountDownView->GetPlayOrPauseToggleButton()->SetState(false);\r
             p_MainCountDownView->ChangeView(START_COUNTDOWN, MAIN_COUNTDOWN);\r
+            p_StartCountDownView->ShowEndView(false);\r
 \r
             return true;\r
         }\r
index fbfe362..749f3fc 100644 (file)
@@ -244,11 +244,12 @@ namespace OHOS
         button->SetLabelPosition(0, 61);\r
         button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
         button->SetStyle(STYLE_LINE_HEIGHT, 35);\r
-        button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);\r
+        button->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
         button->SetStyleForState(STYLE_BORDER_RADIUS, 50, UIButton::PRESSED);\r
         return button;\r
     }\r
 \r
+    //获取开始倒计时视图\r
     StartCountDownView *MainCountDownView::GetStartCountDownView(void)\r
     {\r
         return p_StartCountDownView;\r
index 00d3bb3..8b7fbc6 100644 (file)
@@ -270,6 +270,7 @@ namespace OHOS
 \r
         vectorbigImage->SetVisible(state);\r
         showTheEndRingTime->SetVisible(state);\r
+        showTheEndRingTime->SetText(showTheRingTime->GetText());\r
     }\r
     void StartCountDownView::UpdateimageAndLabelPosition(void)\r
     {\r