解绑确认弹窗添加关机动画
authorluozheng <1732036298@qq.com>
Tue, 8 Oct 2024 08:46:38 +0000 (16:46 +0800)
committerluozheng <1732036298@qq.com>
Tue, 8 Oct 2024 08:46:38 +0000 (16:46 +0800)
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp
code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp
code/sdk/drivers/peripheral/utils/custom_utils.c

index 7cf2bed..ca29a38 100644 (file)
@@ -10,6 +10,7 @@
 #include <custom_utils.h>
 #include "uicomponents/UIComponents.h"
 #include "vibrator_service.h"
+#include "bleEvent.h"
 namespace OHOS
 {
 
@@ -61,6 +62,10 @@ namespace OHOS
         case 2:
             do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);
             break;
+        case 3:
+            #ifdef SUPPORT_BLE_SERVICE
+            cleanUnbindInfor(1);
+            #endif
         default:
             break;
         }
@@ -71,7 +76,7 @@ namespace OHOS
         return shutDownImageAnimatorView;
     }
 
-    //  0 关机 1 重启 2 恢复出厂
+    //  0 关机 1 重启 2 恢复出厂 3解绑恢复出厂
     void ShutDownImageAnimatorView::ShutDownImageAnimator_Start(int type)
     {
         OperationType = type;
index 0d2d954..e6090d8 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-22 10:04:36
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-29 14:36:41
+ * @LastEditTime: 2024-10-08 16:33:30
  * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp
  */
 #include "notification_manager.h"
@@ -29,7 +29,7 @@
 #include <custom_runtime.h>
 #include "../../../../../../drivers/peripheral/vibrator/service/vibrator_service.h"
 #include <ui_service.h>
-
+#include "rebootandshutdown/include/ShutDownImageAnimatorView.h"
 namespace OHOS
 {
     UIViewGroup *DeviceBindingView{nullptr};
@@ -76,6 +76,9 @@ namespace OHOS
     UIButton *DeviceUnbindingRequestButtonOK{nullptr};         // 设备解除绑定请求(与新设备连接)确认
     UIButton *DeviceUnbindingRequestButtonCancel{nullptr};     // 设备解除绑定请求(与新设备连接)取消
 
+    ShutDownImageAnimatorView *p_ShutDownImageAnimatorView{nullptr}; // 关机动画
+    UIViewGroup *ShutDownImageAnimatorGroupView{nullptr};
+
     PairingViewEventListener::PairingViewEventListener()
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener::PairingViewEventListener");
@@ -145,11 +148,24 @@ namespace OHOS
         else if (&view == DeviceUnbindingRequestButtonOK) // 设备解除绑定请求(与新设备连接)确认
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceUnbindingRequestButtonOK  OnClick");
-            // 关闭通知界面
-#ifdef SUPPORT_BLE_SERVICE
-            cleanUnbindInfor(1);
-#endif
-            NotificationManager::GetInstance()->StopNotify();
+            if (p_ShutDownImageAnimatorView == nullptr)
+            {
+                p_ShutDownImageAnimatorView = new ShutDownImageAnimatorView();
+                if (p_ShutDownImageAnimatorView == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "p_ShutDownImageAnimatorView new fail!!");
+                    return false;
+                }
+                ShutDownImageAnimatorGroupView = p_ShutDownImageAnimatorView->ShutDownAnimatorViewInit();
+                if (ShutDownImageAnimatorGroupView == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownImageAnimatorGroupView new fail!!");
+                    return false;
+                }
+                DeviceUnbindingRequestGroupView->SetVisible(false);
+                RootView::GetInstance()->Add(ShutDownImageAnimatorGroupView);
+            }
+            ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(3);
         }
         else if (&view == DeviceUnbindingRequestButtonCancel) // 设备解除绑定请求(与新设备连接)取消
         {
@@ -358,7 +374,7 @@ namespace OHOS
             DeviceBindingView->Add(DeviceBindingScrollView);
         }
 
-        //震动一次
+        // 震动一次
         if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             ui_api_vibrate_once_func();
@@ -366,7 +382,7 @@ namespace OHOS
 
         ScreenTurnOn(40 * 1000); // 亮屏操作  40秒关闭
 
-        PairingViewEventListener::GetInstance().Pairing_StartTimer(); //开启一个40s后弹窗自动销毁定时器
+        PairingViewEventListener::GetInstance().Pairing_StartTimer(); // 开启一个40s后弹窗自动销毁定时器
 
         NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceBindingView);
         return DeviceBindingView;
@@ -529,7 +545,7 @@ namespace OHOS
 
         ScreenTurnOn(40 * 1000); // 亮屏操作  40秒关闭
 
-        PairingViewEventListener::GetInstance().Pairing_StartTimer(); //开启一个40s后弹窗自动销毁定时器
+        PairingViewEventListener::GetInstance().Pairing_StartTimer(); // 开启一个40s后弹窗自动销毁定时器
         /* -------------------------------------------------------------------------- */
 
         NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceUnBindingView);
@@ -868,6 +884,12 @@ namespace OHOS
             DeviceUnbindingRequestGroupView = nullptr;
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FreeDeviceUnbindingRequestGroupView] success");
         }
+        if (p_ShutDownImageAnimatorView != nullptr)
+        {
+            RootView::GetInstance()->Remove(ShutDownImageAnimatorGroupView);
+            delete p_ShutDownImageAnimatorView;
+            p_ShutDownImageAnimatorView;
+        }
     }
 
     /* -------------------------------------------------------------------------- */
index 6123850..3eaa191 100644 (file)
@@ -1091,7 +1091,7 @@ void ScreenAlwaysOnCtr(uint8_t turnOnFlag)
     const power_display_svr_api_t *display_api = power_display_svr_get_api();
     if(turnOnFlag)
     {
-        // display_api->set_screen_set_keepon_timeout(0);
+        display_api->set_screen_set_keepon_timeout(0);
         
         if (display_api->get_screen_state() != SCREEN_ON)
         {