解决禅道,1630表冠问题:充电弹窗可以用表冠按下关闭
authorluozheng <1732036298@qq.com>
Thu, 8 Jan 2026 10:05:03 +0000 (18:05 +0800)
committerluozheng <1732036298@qq.com>
Thu, 8 Jan 2026 10:05:03 +0000 (18:05 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp
code/sdk/application/wearable/fd272/service/msg_center/include/notify/charge_notification.h
code/sdk/application/wearable/fd272/service/msg_center/src/notify/charge_notification.cpp

index d0345aa..600035b 100644 (file)
@@ -276,7 +276,7 @@ namespace OHOS
         BlueToothScrollView->Add(BluetoothServiceOptionsButton);\r
         BlueToothScrollView->Add(TradionalBlueToothLabel);\r
         BlueToothScrollView->Add(BluetoothServiceOptionsLabel);\r
-        BlueToothScrollView->Add(AttentionLabel);\r
+        // BlueToothScrollView->Add(AttentionLabel);\r
         BlueToothScrollView->Add(TradionalBlueToothToggleButton);\r
         AddViewToRootContainer(BlueToothScrollView);\r
     }\r
index b37d65b..43e7676 100644 (file)
@@ -42,6 +42,7 @@ namespace OHOS
     class lowppowrViewEventListener : public OHOS::UIView::OnClickListener,
                               public OHOS::UIView::OnLongPressListener,
                               public OHOS::UIView::OnTouchListener,
+                              public RootView::OnKeyActListener,
                               public OHOS::UIView::OnDragListener 
     {
 public:
@@ -75,6 +76,8 @@ public:
     {
         return true;
     }
+
+    virtual bool OnKeyAct(UIView &view, const KeyEvent &event) override;
 };
 };
 #endif /* CHARGE_NOTIFICATION_H */
\ No newline at end of file
index 8208824..b33c2d8 100644 (file)
@@ -56,6 +56,7 @@ namespace OHOS
     const ImageInfo **ChargeAnimationInfoArray{nullptr}; //充电动画图片路径数组
     ImageAnimatorInfo ChargeAnimationInfo[CHARGE_ANIMATION_VIEW_NUM_FRAMES]; //充电动画图像的信息
 
+    static OHOS::RootView::OnKeyActListener *g_onKeyActListener = nullptr;
 
    // GILROY_BOLD_FONT
     //充电中 UI 
@@ -187,6 +188,7 @@ namespace OHOS
             ChargeAnimationInfoArray = nullptr;
         }
 
+        RootView::GetInstance()->SetOnKeyActListener(g_onKeyActListener);
         //  if(UILabel_Chargeing)
         // {
         //     delete UILabel_Chargeing;
@@ -313,6 +315,9 @@ namespace OHOS
             UIViewGroup_charge->Add(chargeAnimatorView);
         }
 
+        g_onKeyActListener = RootView::GetInstance()->GetOnKeyActListener();
+        RootView::GetInstance()->SetOnKeyActListener(lowppowrViewEventListener::GetInstance());
+
         UIViewGroup_charge->Add(UILabel_time);
         UIViewGroup_charge->Add(UILabel_power);
 
@@ -656,6 +661,10 @@ namespace OHOS
        
     }
 
-
+    bool lowppowrViewEventListener::OnKeyAct(UIView &view, const KeyEvent &event)
+    {
+        NotificationManager::GetInstance()->StopNotify();
+        return true;
+    }
 
 }