优化按键监听
authorxue <2144439972@qq.com>
Thu, 4 Sep 2025 10:17:58 +0000 (18:17 +0800)
committerxue <2144439972@qq.com>
Thu, 4 Sep 2025 10:17:58 +0000 (18:17 +0800)
106 files changed:
code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoicePresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/include/AlarmPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/MainAlarmView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayMainView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/include/AssistantPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodDetectionPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodResultPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/include/BluetoothPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/include/CalendarPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhonePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/include/FlashlightPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalpresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalview.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/include/LanguageSwitchPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/record/include/RecordingPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveBatPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveElePresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveElePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveEleView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/include/SchedulePresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/SchedulePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/ScheduleView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/include/SetTimeFormatPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/include/SleepModePresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModeView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/system/include/SystemPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/include/TakephotosPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/include/ThemeStylePresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStylePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStyleView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/include/WatchQRCodePresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodeView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherView.cpp

index f351927..f8125e0 100644 (file)
@@ -45,6 +45,7 @@ namespace OHOS
 
         void OnStart() override;
         void OnStop() override;
+        void OnResume() override;
         // void Notify() override;
         void calculateChatContentItemViewHeight(std::string text, bool flag);
 
index 30908df..b64dcfb 100644 (file)
@@ -132,6 +132,11 @@ namespace OHOS
         return;
     }
 
+    void AiVoicePresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
     /*调转到返回结果界面*/
     bool AiVoicePresenter::JumpToReturnResultTextView(void)
     {
index bcf2d91..00ffa54 100644 (file)
@@ -528,7 +528,6 @@ namespace OHOS
 
         SetAiVoiceViewAllComponentsVisibilityStatus();
 
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
         return;
     }
 
index e7e0287..2dff3a6 100644 (file)
@@ -153,6 +153,7 @@ public:
     ColorType ShadowBlue(void);\r
     bool OnClick(UIView &view, const ClickEvent &event) override;\r
     bool OnDrag(UIView& view, const DragEvent& event) override;\r
+    void OnResume() override;\r
     bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件\r
     bool OnDragEnd(UIView& view, const DragEvent& event) override;\r
     void OnSwipe(UISwipeView &view) override;\r
index cfdf61b..5f18114 100644 (file)
@@ -364,6 +364,11 @@ void AlarmPresenter::ClickAlarmNext(uint16_t num)
     AlarmSetWeekView::GetInstance()->RefreshSetWeek1();\r
 }\r
 \r
+void AlarmPresenter::OnResume()\r
+{\r
+    RootView::GetInstance()->SetOnKeyActListener(this);\r
+}\r
+\r
 bool AlarmPresenter::OnDrag(UIView& view, const DragEvent& event)\r
 {\r
     if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) {\r
index 037f7c3..ff64b32 100644 (file)
@@ -486,7 +486,6 @@ void MainAlarmView::OnStart()
         AddViewToRootContainer(container[0]);
     }
     viewInitstatus_ = true;
-    RootView::GetInstance()->SetOnKeyActListener(presenter_);
 }
 
 void MainAlarmView::RefreshAlarm(void)
index 0047133..111b865 100644 (file)
@@ -71,8 +71,6 @@ void AlipayMainView::OnStart()
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::OnStart");\r
     if(Alipay_is_init()==false)\r
     return;\r
-    // 增加按键监听\r
-    RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
 \r
     alipayInterfacesId startView;\r
     bool bindFlag = AlipayModel::GetInstance()->AlipayGetBindstate();\r
index e148386..427216b 100644 (file)
@@ -106,6 +106,8 @@ void AlipayPresenter::OnStart()
 void AlipayPresenter::OnResume(void)\r
 {\r
     svr_alipay_create_task();\r
+    // 增加按键监听\r
+    RootView::GetInstance()->SetOnKeyActListener(this);\r
 }\r
 \r
 void AlipayPresenter::OnStop(void)\r
index 336e77f..a1c5384 100644 (file)
@@ -30,6 +30,7 @@ public:
   static AssistantPresenter *GetInstance();
 
 private:
+  void OnResume() override;
   // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
   bool OnClick(UIView &view, const ClickEvent &event) override;
   bool OnDrag(UIView &view, const DragEvent &event) override;
index 8fa3b66..1f0339f 100644 (file)
@@ -71,6 +71,11 @@ bool AssistantPresenter::OnDrag(UIView &view, const DragEvent &event) {
   return true;
 }
 
+void AssistantPresenter::OnResume()
+{
+    RootView::GetInstance()->SetOnKeyActListener(this);
+}
+
 bool AssistantPresenter::OnClick(UIView &view, const ClickEvent &event) {
 
   WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AssistantPresenter::OnClick %s",
index ae7bbd7..06a3647 100644 (file)
@@ -241,7 +241,6 @@ void AssistantView::OnStart() {
 
   InitView();
 
-  RootView::GetInstance()->SetOnKeyActListener(presenter_);
   AddViewToRootContainer(AssistantScrollView[ASSISTANT_MAIN_VIEW]);
 }
 
index 821b2d9..12d93b8 100644 (file)
@@ -34,7 +34,7 @@ namespace OHOS
         BloodDetectionPresenter();
         ~BloodDetectionPresenter() override;
         static BloodDetectionPresenter *GetInstance(void);
-
+        void OnResume() override;
   
         void OnTickEvent() override;
         void Notify() override {}
index ca5bc38..6af0492 100644 (file)
@@ -27,8 +27,7 @@ namespace OHOS
         virtual ~BloodResultPresenter();
         static BloodResultPresenter *GetInstance(void);
 
-
-
+        void OnResume() override;
         bool OnDrag(UIView &view, const DragEvent &event) override;
         bool OnDragEnd(UIView &view, const DragEvent &event) override;
         bool OnClick(UIView &view, const ClickEvent &event) override;
index f4ea386..ee0910a 100644 (file)
@@ -62,6 +62,10 @@ namespace OHOS
         NativeAbility::GetInstance().Back();
     }
    
+    void BloodDetectionPresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
     bool BloodDetectionPresenter::OnDrag(UIView &view, const DragEvent &event)
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodDetectionPresenter::OnDrag");
index d27e9ca..7bf9ac5 100644 (file)
@@ -109,6 +109,11 @@ namespace OHOS
         return g_pBloodResultPresenter;
     }
 
+    void BloodResultPresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
     bool BloodResultPresenter::OnDrag(UIView &view, const DragEvent &event)
     {
         return true;
@@ -162,4 +167,6 @@ namespace OHOS
         return true;
     }
 
+
+
 }
\ No newline at end of file
index 20453ad..adc053a 100644 (file)
@@ -45,6 +45,7 @@ public:
     BluetoothPresenter();\r
     ~BluetoothPresenter();\r
     bool OnClick(UIView &view, const ClickEvent &event) override;\r
+    void OnResume() override;\r
     static BluetoothPresenter *GetInstance();\r
     bool OnDrag(UIView& view, const DragEvent& event) override;\r
     bool OnDragEnd(UIView& view, const DragEvent& event) override;\r
index aa6bc5f..8e56890 100644 (file)
@@ -45,6 +45,11 @@ void BluetoothPresenter::OnStop(void)
     }\r
 }\r
 \r
+void BluetoothPresenter::OnResume()\r
+{\r
+    RootView::GetInstance()->SetOnKeyActListener(this);\r
+}\r
+\r
 BluetoothPresenter *BluetoothPresenter::GetInstance()\r
 {\r
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothPresenter GetInstance");\r
index 1d2a1ce..2844ae4 100644 (file)
@@ -76,7 +76,6 @@ void MainBluetoothView::OnStart()
     } else {\r
         ChangeView(unusedValue, BLUETOOTHEARPHONEVIEW);//若一个都没有连接过就进行搜索\r
     }\r
-    RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
     return;\r
 }\r
 \r
index 7dce69e..7f679ca 100644 (file)
@@ -47,7 +47,7 @@ namespace OHOS
 
     void BrightnessLevelPresenter::OnResume(void)
     {
-        Presenter<BrightnessLevelView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void BrightnessLevelPresenter::OnStop(void)
index bc91dd7..ee4dd8b 100644 (file)
@@ -75,7 +75,6 @@ namespace OHOS
         // 增加按键监听
         // RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::BrightnessLevelPresenter::GetInstance();
         //RootView::GetInstance()->SetOnKeyActListener(keyactListener);
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
 
 
         AddViewToRootContainer(scorllView);
index 96dd611..fed6b04 100644 (file)
@@ -29,6 +29,7 @@ public:
     ~CalendarPresenter() override;
 
     void OnStart() override;
+    void OnResume() override;
     static CalendarPresenter *GetInstance(void);
     bool OnClick(UIView &view, const ClickEvent &event) override;
     bool OnKeyAct(UIView &view, const KeyEvent &event) override;
index 0ba0738..4376606 100644 (file)
@@ -44,6 +44,11 @@ namespace OHOS
     {
     }
 
+    void CalendarPresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
     bool CalendarPresenter::OnClick(UIView &view, const ClickEvent &event)
     {
         UNUSED(event);
index c9adc98..8a922b3 100644 (file)
@@ -394,6 +394,5 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::UIViewGroup::new group error");
             return;
         }
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 }
\ No newline at end of file
index 2d5e67d..1d29b3e 100644 (file)
@@ -42,7 +42,6 @@ void CallerLogPresenter::OnStart()
 void CallerLogPresenter::OnResume(void)\r
 {\r
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnResume()");\r
-    Presenter<CallerLogView>::OnResume();\r
 \r
     return;\r
 }\r
index ac64214..7834e77 100644 (file)
@@ -47,8 +47,7 @@ namespace OHOS
 
     void BluetoothServiceOptionsPresenter::OnResume(void)
     {
-
-        Presenter<BluetoothServiceOptionsView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void BluetoothServiceOptionsPresenter::OnStop(void)
index 5589340..fb4daba 100644 (file)
@@ -433,7 +433,6 @@ namespace OHOS
         BlueToothScrollView->Add(connectingScrollView);
         AddViewToRootContainer(BlueToothScrollView);
 
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 
     void BluetoothServiceOptionsView::show_connecting_view(bool data)
index ba0db4b..d4015b7 100644 (file)
@@ -52,7 +52,7 @@ namespace OHOS
 \r
     void ClassicBlueToothPresenter::OnResume(void)\r
     {\r
-        Presenter<ClassicBlueToothView>::OnResume();\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
     }\r
 \r
     void ClassicBlueToothPresenter::OnStop(void)\r
index d6d2160..0ecb248 100644 (file)
@@ -308,6 +308,5 @@ namespace OHOS
         BlueToothScrollView->Add(AttentionLabel);\r
         BlueToothScrollView->Add(TradionalBlueToothToggleButton);\r
         AddViewToRootContainer(BlueToothScrollView);\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
     }\r
 }\r
index 7f8a917..ba3ceb2 100644 (file)
@@ -50,7 +50,7 @@ namespace OHOS
     void MainCountDownPresenter::OnResume(void)\r
     {\r
 \r
-        Presenter<MainCountDownView>::OnResume();\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
     }\r
 \r
     void MainCountDownPresenter::OnStop(void)\r
index c34600f..42617ac 100644 (file)
@@ -430,7 +430,6 @@ namespace OHOS
         {\r
             ChangeView(COUNTDOWN_MAX, MAIN_COUNTDOWN); // 如果倒计时的timer已经结束,则跳转到主界面\r
         }\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
         /* -------------------------------------------------------------------------- */\r
     }\r
 }
\ No newline at end of file
index 4cc98f7..0512882 100644 (file)
@@ -47,7 +47,7 @@ namespace OHOS
 
     void DnotDisturbPresenter::OnResume(void)
     {
-        Presenter<DnotDisturbView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void DnotDisturbPresenter::OnStop(void)
index 39118c5..bf74133 100644 (file)
@@ -252,6 +252,5 @@ namespace OHOS
         {
             AddViewToRootContainer(scrollView);
         }
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 }
\ No newline at end of file
index 865b8dd..471122e 100644 (file)
@@ -71,7 +71,7 @@ namespace OHOS
 
     void FindPhonePresenter::OnResume(void)
     {
-        Presenter<FindPhoneView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void FindPhonePresenter::OnStop(void)
index 2dce361..7266a0e 100644 (file)
@@ -285,7 +285,6 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phone is not connected");
             FindPhoneViewInit_BlueToothDisConnected();
         }
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
         return;
     }
 }
\ No newline at end of file
index e8ee476..27e4c9f 100644 (file)
@@ -65,6 +65,7 @@ namespace OHOS
         static FlashlightPresenter * GetInstance();
 
         void OnStart() override;
+        void OnResume() override;
         uint8_t GetColorIndex(void);
         int64_t GetColorValue(void);
         uint8_t GetFlashingLevel(void);
index bb21fc8..5761f3d 100644 (file)
@@ -59,6 +59,11 @@ namespace OHOS
         ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON);
     }
 
+    void FlashlightPresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }   
+
     bool FlashlightPresenter::OnDrag(UIView &view, const DragEvent &event)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FlashlightPresenter::OnDrag");
index 30aa9d4..10c19ea 100644 (file)
@@ -61,7 +61,6 @@ namespace OHOS
             AddViewToRootContainer(group);
         }
         InitSwipeData();
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 
     void FlashlightView::DeinitSwipeData()
index 1980b83..a3de49e 100644 (file)
@@ -58,7 +58,7 @@ namespace OHOS
 
     void MaingoalPresenter::OnResume(void)
     {
-        Presenter<MaingoalrView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void MaingoalPresenter::OnStop(void)
index 54e370b..9e52ac7 100644 (file)
@@ -135,7 +135,6 @@ namespace OHOS
         /* --------------------------------- 添加按键监听 --------------------------------- */
         // RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MaingoalPresenter::GetInstance();
         //RootView::GetInstance()->SetOnKeyActListener(keyactListener);
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
         /* -------------------------------------------------------------------------- */
     }
 
index b403e78..11b1a03 100644 (file)
@@ -62,6 +62,7 @@ namespace OHOS
     }
     void HeartDetectionPresenter::OnResume(void)
     {
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void HeartDetectionPresenter::OnStop(void)
index a43d6f6..d712849 100644 (file)
@@ -140,7 +140,6 @@ namespace OHOS
         GetRootContainer()->SetDraggable(true);
         GetRootContainer()->SetTouchable(true);
         GetRootContainer()->SetOnDragListener(presenter_);     
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
 
         if (imageAnimator != nullptr)
         {
index 839e0e4..99dcae5 100644 (file)
@@ -108,7 +108,9 @@ namespace OHOS
     }
     void HeartResultPresenter::OnPause(void) {}
 
-    void HeartResultPresenter::OnResume(void) {}
+    void HeartResultPresenter::OnResume(void) {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
 
     void HeartResultPresenter::OnStop(void) {}
 
index 736feb6..29e654e 100644 (file)
@@ -197,7 +197,6 @@ namespace OHOS
         GetRootContainer()->SetDraggable(true);
         GetRootContainer()->SetTouchable(true);
         GetRootContainer()->SetOnDragListener(presenter_);     
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
     
 }
index 786a2fd..222481c 100644 (file)
@@ -30,7 +30,7 @@ namespace OHOS
         virtual ~LanguageSwitchPresenter();
 
         void OnStart() override;
-
+        void OnResume() override;
         static LanguageSwitchPresenter *GetInstance();
         void SetLabelExt(UILabelExt *label);
     private:
index 25f2a38..0a716dd 100644 (file)
@@ -61,6 +61,11 @@ namespace OHOS
         view_->RefreshLanguageList();
     }
 
+    void LanguageSwitchPresenter::OnResume(void)
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
     bool LanguageSwitchPresenter::OnDrag(UIView &view, const DragEvent &event)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RespiratoryTrainingPresenter::OnDrag");
index 808ec39..2621ea5 100644 (file)
@@ -322,7 +322,6 @@ namespace OHOS
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::OnStart");
         LanguageSwitchViewInit();
         InithintView();
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
         return;
     }
 }
\ No newline at end of file
index dce979e..0755556 100644 (file)
@@ -53,7 +53,7 @@ namespace OHOS
 
     void MessageShowPresenter::OnResume(void)
     {
-        Presenter<MessageShowView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void MessageShowPresenter::OnStop(void)
index 29be8ad..f103b59 100644 (file)
@@ -275,7 +275,6 @@ namespace OHOS
         UpdateShowConfig();
 
         AddViewToRootContainer(scrollView_);
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
 
     }
    
index 393a035..233bdc9 100644 (file)
@@ -58,7 +58,7 @@ namespace OHOS
     void MotionRecognitionPresenter::OnResume(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnResume");
-        Presenter<MotionRecognitionView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void MotionRecognitionPresenter::OnStop(void)
index 5494d9f..255d73a 100644 (file)
@@ -187,7 +187,6 @@ namespace OHOS
         scrollView->Add(MotionRecognitionToggleButton);
         scrollView->Add(note);
         AddViewToRootContainer(scrollView);
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 
 
index a0bb5ed..fb7eabc 100644 (file)
@@ -52,7 +52,7 @@ namespace OHOS
     void MusicPlayerPresenter::OnResume(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnResume");
-        Presenter<MusicPlayerView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
         if (view_ == nullptr)
         {
             return;
index 646f4d1..90c4716 100644 (file)
@@ -71,7 +71,6 @@ namespace OHOS
         }
 
         playersView->SetOnDragListener(presenter_);
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
         return;
     }
 
index 4f7fbf4..216c31f 100644 (file)
@@ -59,7 +59,7 @@ namespace OHOS
 
     void NetworkAndCallPresenter::OnResume(void)
     {
-        Presenter<NetworkAndCallView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void NetworkAndCallPresenter::OnStop(void)
index 79ecdb3..f9efdb9 100644 (file)
@@ -237,7 +237,6 @@ namespace OHOS
         NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(MobileData_toggleButton);
         NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(note);
         AddViewToRootContainer(NetworkAndCallScrollView[NETWORKANDCALLVIEW]);
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 
 
index d41d378..a6b37cd 100644 (file)
@@ -61,7 +61,7 @@ namespace OHOS
     void RebootAndShutdownPresenter::OnResume(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::OnResume");
-        Presenter<RebootAndShutdownView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
         if (view_ == nullptr)
         {
             return;
index 289720e..570df8b 100644 (file)
@@ -135,7 +135,7 @@ namespace OHOS
         virtual ~RecordingPresenter();\r
 \r
         void OnStart() override;\r
-\r
+        void OnResume() override;\r
         static RecordingPresenter *GetInstance();\r
         int convertNumericDateTime(const char *numericDateTime, char *formattedDateTime);\r
         void UpdateRecordProcess();\r
index 76a3481..16aee20 100644 (file)
@@ -58,6 +58,10 @@ namespace OHOS
         p_RecordingModel->SendCheckRecordingSpaceOutCmd(); //进入录音视图后发送指令查看录音空间是否已满\r
         // ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON);\r
     }\r
+    void RecordingPresenter::OnResume(void)\r
+    {\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
+    }\r
 \r
     bool RecordingPresenter::OnDrag(UIView &view, const DragEvent &event)\r
     {\r
index f0a0a89..6e21815 100644 (file)
@@ -455,7 +455,6 @@ namespace OHOS
     void RecordingView::OnStart()\r
     {\r
         RecordingViewInit();\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
         return;\r
     }\r
 }
\ No newline at end of file
index 21cfbe2..47123a5 100644 (file)
@@ -61,7 +61,7 @@ namespace OHOS
 
     void RespiratoryTrainingPresenter::OnResume(void)
     {
-        Presenter<RespiratoryTrainingView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void RespiratoryTrainingPresenter::OnStop(void)
index b0f8ef0..2fa25fc 100644 (file)
@@ -586,7 +586,5 @@ namespace OHOS
         RespiratoryTrainingViewInit();
         RootView::GetInstance()->SetDraggable(true);
         RootView::GetInstance()->SetTouchable(true);
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
- 
     }
 }
\ No newline at end of file
index 6fb4896..8eb7330 100644 (file)
@@ -33,6 +33,7 @@ namespace OHOS
         virtual ~SaveBatPresenter();\r
 \r
         void OnStart() override;\r
+        void OnResume() override;\r
 \r
         static SaveBatPresenter *GetInstance();\r
 \r
index de77a1e..2964cbf 100644 (file)
@@ -64,6 +64,9 @@ void SaveBatPresenter::OnStart() {
 }\r
 \r
 \r
+void SaveBatPresenter::OnResume() {\r
+  RootView::GetInstance()->SetOnKeyActListener(this);\r
+}\r
 \r
 bool SaveBatPresenter::OnPress(UIView &view, const PressEvent &event) {\r
   if (strcmp(view.GetViewId(), "button_exit") == 0) {\r
index 2253a12..07dc378 100644 (file)
@@ -856,7 +856,6 @@ namespace OHOS
         InitShowBackView();\r
 \r
         AddViewToRootContainer(group_);\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
     }\r
 \r
 }
\ No newline at end of file
index 5064998..cede84e 100644 (file)
@@ -41,6 +41,10 @@ SaveElePresenter *SaveElePresenter::GetInstance() {
 void SaveElePresenter::OnStart() { Presenter<SaveEleView>::OnStart(); }\r
 \r
 \r
+void SaveElePresenter::OnResume() {\r
+  RootView::GetInstance()->SetOnKeyActListener(this);\r
+}\r
+\r
 bool SaveElePresenter::OnDrag(UIView &view, const DragEvent &event) {\r
 \r
   if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
index d1560ea..8aa33cf 100644 (file)
@@ -132,7 +132,6 @@ void SaveEleView::OnStart() {
 \r
   AddViewToRootContainer(scrollview_);\r
   InitView();\r
-  RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
 }\r
 \r
 } // namespace OHOS\r
index 66be206..8781963 100644 (file)
@@ -25,6 +25,7 @@ namespace OHOS
         static SchedulePresenter * GetInstance();\r
 \r
         void OnStart() override;\r
+        void OnResume() override;\r
 \r
     private:\r
         bool OnClick(UIView &view, const ClickEvent &event) override;\r
index 0334330..1cbb072 100644 (file)
@@ -43,6 +43,11 @@ namespace OHOS
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SchedulePresenter::OnStart");\r
     }\r
 \r
+    void SchedulePresenter::OnResume()\r
+    {\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
+    }\r
+\r
     bool SchedulePresenter::OnClick(UIView &view, const ClickEvent &event)\r
     {\r
         UNUSED(event);\r
index e0e7c07..96053dd 100644 (file)
@@ -46,7 +46,6 @@ namespace OHOS
         }\r
 \r
         DisplayDataOrNoScreen();\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
     }\r
 \r
     void ScheduleView::DisplaySelectScreen(uint8_t ScreenIndex)\r
index 0066e65..9eff795 100644 (file)
@@ -49,7 +49,7 @@ namespace OHOS
     void SetAodDialPresenter::OnResume(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetAodDialView::OnResume");
-        Presenter<SetAodDialView>::OnResume();
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void SetAodDialPresenter::OnStop(void)
index af6a6a5..c16152f 100644 (file)
@@ -177,6 +177,5 @@ namespace OHOS
         scrollView->Add(SetAodDialToggleButton);
         scrollView->Add(note);
         AddViewToRootContainer(scrollView);
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 }
\ No newline at end of file
index 551a0d8..c15694e 100644 (file)
@@ -47,6 +47,7 @@ namespace OHOS
 
     void SetDialPresenter::OnResume(void)
     {
+        RootView::GetInstance()->SetOnKeyActListener(this);
     }
 
     void SetDialPresenter::OnStop(void)
index 9f1e776..170210b 100644 (file)
@@ -38,7 +38,6 @@ namespace OHOS
             SetUpRollerView();
         }
 
-       RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 
     void SetDialView::SetUpCoverflowView(void)
index 086b191..956dab4 100644 (file)
@@ -24,6 +24,7 @@ namespace OHOS
         ~SetTimeFormatPresenter();
         SetTimeFormatPresenter(const SetTimeFormatPresenter &) = delete;
         SetTimeFormatPresenter &operator=(const SetTimeFormatPresenter &) = delete;
+        void OnResume() override;
         bool OnClick(UIView &view, const ClickEvent &event) override;
         bool OnDrag(UIView &view, const DragEvent &event) override;
         bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
index c2d7f15..80ea2a7 100644 (file)
@@ -24,6 +24,10 @@ SetTimeFormatPresenter::~SetTimeFormatPresenter() {
 
 }
 
+void SetTimeFormatPresenter::OnResume() {
+  RootView::GetInstance()->SetOnKeyActListener(this);
+}
+
 bool SetTimeFormatPresenter::OnClick(UIView &view, const ClickEvent &event) {
   WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetTimeFormatPresenter::OnClick");
   view_->OnClick(view);
index 7487cdb..16f094d 100644 (file)
@@ -31,7 +31,6 @@ void SetTimeFormatView::OnStart() {
   GetRootContainer()->SetOnDragListener(presenter_);
 
   GetRootContainer()->SetTouchable(true);
-  RootView::GetInstance()->SetOnKeyActListener(presenter_);
 }
 
 bool SetTimeFormatView::SetTimeFormatInit() {
index f116f6d..f579d64 100644 (file)
@@ -22,6 +22,7 @@ namespace OHOS
         virtual ~SleepModePresenter();
 
         void OnStart() override;
+        void OnResume() override;
        
 
         static SleepModePresenter *GetInstance();
index 54eddb7..968a907 100644 (file)
@@ -34,6 +34,11 @@ namespace OHOS
         Presenter<SleepModeView>::OnStart();
     }
 
+    void SleepModePresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
     bool SleepModePresenter::OnDrag(UIView &view, const DragEvent &event)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SleepModePresenter::OnDrag");
index 752bf91..d330488 100644 (file)
@@ -55,7 +55,7 @@ namespace OHOS
     void CallVolumePresenter::OnResume(void)\r
     {\r
 \r
-        Presenter<CallVolumeView>::OnResume();\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
     }\r
 \r
     void CallVolumePresenter::OnStop(void)\r
index 7db2953..cf6910a 100644 (file)
@@ -80,7 +80,6 @@ namespace OHOS
         }\r
         UpdateCallVolumeSliderValue();\r
         AddViewToRootContainer(CallVolumeScrollView);\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
 \r
         return;\r
     }\r
index 8a00b12..783e52b 100644 (file)
@@ -54,11 +54,11 @@ namespace OHOS
 \r
     void SoundAndVibrationPresenter::OnResume(void)\r
     {\r
-        Presenter<SoundAndVibrationView>::OnResume();\r
         if (view_ == nullptr)\r
         {\r
             return;\r
         }\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
     }\r
 \r
     void SoundAndVibrationPresenter::OnStop(void)\r
index e6b678f..9ab595b 100644 (file)
@@ -341,7 +341,6 @@ namespace OHOS
         GetRootContainer()->SetTouchable(true);\r
         GetRootContainer()->SetDraggable(true);\r
         GetRootContainer()->SetOnDragListener(presenter_);\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
 \r
         if (!initViewStatus)\r
         {\r
index dbceca1..a182452 100644 (file)
@@ -58,7 +58,7 @@ namespace OHOS
     void SystemVolumePresenter::OnResume(void)\r
     {\r
 \r
-        Presenter<SystemVolumeView>::OnResume();\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
     }\r
 \r
     void SystemVolumePresenter::OnStop(void)\r
index 5efcec4..541b566 100644 (file)
@@ -83,7 +83,6 @@ namespace OHOS
         GetRootContainer()->SetTouchable(true);\r
         GetRootContainer()->SetDraggable(true);\r
         GetRootContainer()->SetOnDragListener(presenter_);\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
 \r
         if (!initViewStatus)\r
         {\r
index c3a5513..dc6e8ec 100644 (file)
@@ -53,7 +53,7 @@ namespace OHOS
     void MainStopWatchPresenter::OnResume(void)\r
     {\r
 \r
-        Presenter<MainStopWatchView>::OnResume();\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
     }\r
 \r
     void MainStopWatchPresenter::OnStop(void)\r
index f1e63c0..915c7b4 100644 (file)
@@ -414,6 +414,5 @@ namespace OHOS
         scrollView[MAIN_STOPWATCH]->Add(ResetOrMarkbutton);\r
         group->Add(scrollView[MAIN_STOPWATCH]);\r
         AddViewToRootContainer(group);\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
     }\r
 }
\ No newline at end of file
index 9df11ba..4c60866 100644 (file)
@@ -38,7 +38,7 @@ namespace OHOS
         virtual ~SystemPresenter();\r
 \r
         void OnStart() override;\r
-\r
+        void OnResume() override;\r
         static SystemPresenter *GetInstance();\r
 \r
     private:\r
index 2676073..18a9769 100644 (file)
@@ -49,6 +49,11 @@ namespace OHOS
 \r
     void SystemPresenter::OnStart(){}\r
 \r
+    void SystemPresenter::OnResume()\r
+    {\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
+    }\r
+\r
     static uint32_t time = 0;\r
     static uint32_t OnClick_num = 0;\r
 \r
index 8eb7cf3..983a75c 100644 (file)
@@ -339,7 +339,6 @@ namespace OHOS
             CreateSystemView();\r
         }\r
 \r
-       RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
 \r
         if (SystemScrollView[SYSTEMVIEW] == nullptr)\r
         {\r
index bf22bf5..46376bc 100644 (file)
@@ -20,6 +20,7 @@ namespace OHOS
         virtual ~TakephotosPresenter();
 
         void OnStart() override;
+        void OnResume() override;
         static TakephotosPresenter *GetInstance();
 
     private:
index 6494666..c36791e 100644 (file)
@@ -61,6 +61,11 @@ namespace OHOS
     {
     }
 
+    void TakephotosPresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
     bool TakephotosPresenter::OnDrag(UIView &view, const DragEvent &event)
     {
         if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
index e46f0d4..79c439b 100644 (file)
@@ -342,7 +342,6 @@ namespace OHOS
     PreLoad();
 
     AddViewToRootContainer(scrollview_);
-    RootView::GetInstance()->SetOnKeyActListener(presenter_);
 
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TakephotosView OnStart is ok");
   }
index 10545e3..ff087d5 100644 (file)
@@ -29,6 +29,7 @@ namespace OHOS
         ThemeStyle GetSelectThemeStyleId(void);
 
         void OnStart() override;
+        void OnResume() override;
 
     private:
         bool OnClick(UIView &view, const ClickEvent &event) override;
index 51e30f2..d398e03 100644 (file)
@@ -40,6 +40,11 @@ namespace OHOS
 
     void ThemeStylePresenter::OnStart(){}
 
+    void ThemeStylePresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
     bool ThemeStylePresenter::OnClick(UIView &view, const ClickEvent &event)
     {
         UNUSED(event);
index 27bc5dc..4269506 100644 (file)
@@ -331,7 +331,7 @@ namespace OHOS
         {
             ThemeStyleViewInit();
         }
-       RootView::GetInstance()->SetOnKeyActListener(presenter_);
+       
     }
 
 
index 9dad127..b9115cb 100644 (file)
@@ -84,6 +84,7 @@ void TraingCardPresenter::OnPause(void) {
 void TraingCardPresenter::OnResume(void) {\r
 \r
   Presenter<TraingCardView>::OnResume();\r
+  RootView::GetInstance()->SetOnKeyActListener(this);\r
 }\r
 \r
 void TraingCardPresenter::OnStop(void) {\r
index 12f56af..30a9397 100644 (file)
@@ -615,7 +615,7 @@ void TraingCardView ::InitView() {
   swipe_->SetHorCurrentPage(Control_Card::DATA); // 设置进入索引 [数据]\r
 \r
 \r
-  RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
+\r
   WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TraingCardView::InitPage over");\r
 }\r
 \r
index 8dec03d..27553a8 100644 (file)
@@ -23,7 +23,7 @@ namespace OHOS
         std::string WatchQRCodeGetQRCodeStr();
 
         void OnStart() override;
-
+        void OnResume() override;
         bool OnClick(UIView &view, const ClickEvent &event) override;
         bool OnDrag(UIView &view, const DragEvent &event) override;
         bool OnDragEnd(UIView &view, const DragEvent &event) override;
index d01ced5..163806d 100644 (file)
@@ -40,6 +40,11 @@ namespace OHOS
 
     void WatchQRCodePresenter::OnStart(){}
 
+    void WatchQRCodePresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
     static uint32_t time = 0;
     static uint32_t OnClick_num = 0;
     bool WatchQRCodePresenter::OnClick(UIView &view, const ClickEvent &event)
index 4185b3e..237cc54 100644 (file)
@@ -174,10 +174,6 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::OnStart");
         start_refresh_timer();
         WatchQRCodeViewInit();
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
-        /* --------------------------------- 添加按键监听 --------------------------------- */
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);
-        /* -------------------------------------------------------------------------- */
         return;
     }
 
index f4b0941..ac037c0 100644 (file)
@@ -53,7 +53,7 @@ namespace OHOS
 \r
     void MainWeatherPresenter::OnResume(void)\r
     {\r
-        Presenter<MainWeatherView>::OnResume();\r
+        RootView::GetInstance()->SetOnKeyActListener(this);\r
     }\r
 \r
     void MainWeatherPresenter::OnStop(void)\r
index 16b80cf..591a505 100644 (file)
@@ -152,7 +152,6 @@ namespace OHOS
             weatherSwipeViewList->SetOnSwipeListener(presenter_);\r
         }\r
         UpdateMainWeatherViewVisibility();\r
-        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
     }\r
 \r
     WeatherView *MainWeatherView::GetWeatherView(void)\r