From e1f7dc1ef3e80cbc72ea50df27f360ce935ce974 Mon Sep 17 00:00:00 2001 From: aliyun3243248791 Date: Fri, 5 Sep 2025 03:10:09 +0000 Subject: [PATCH] Merge #2205 into sdk650pathc0423 from refs/changes/2205/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from aliyun3243248791 * refs/changes/2205/head: (2 commits squashed) - 优化按键监听 - Merge branch 'sdk650pathc0423' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk650pathc0423 Signed-off-by: 薛文强 Merged-by: Caisking <3449750381@qq.com> CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/2205 --- .../nativeapp/nativeui/aivoice/include/AiVoicePresenter.h | 1 + .../nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp | 5 +++++ .../fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp | 1 - .../nativeapp/nativeui/alarm/include/AlarmPresenter.h | 1 + .../fd230/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp | 5 +++++ .../fd230/nativeapp/nativeui/alarm/src/MainAlarmView.cpp | 1 - .../fd230/nativeapp/nativeui/alipay/src/AlipayMainView.cpp | 2 -- .../nativeapp/nativeui/alipay/src/AlipayPresenter.cpp | 2 ++ .../nativeui/assistant/include/AssistantPresenter.h | 1 + .../nativeui/assistant/src/AssistantPresenter.cpp | 5 +++++ .../nativeapp/nativeui/assistant/src/AssistantView.cpp | 1 - .../nativeui/bloodoxygen/include/BloodDetectionPresenter.h | 2 +- .../nativeui/bloodoxygen/include/BloodResultPresenter.h | 3 +-- .../nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp | 4 ++++ .../nativeui/bloodoxygen/src/BloodDetectionView.cpp | 1 - .../nativeui/bloodoxygen/src/BloodResultPresenter.cpp | 7 +++++++ .../nativeapp/nativeui/bloodoxygen/src/BloodResultView.cpp | 1 - .../nativeui/bluetooth/include/BluetoothPresenter.h | 1 + .../nativeui/bluetooth/src/BluetoothPresenter.cpp | 5 +++++ .../nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp | 1 - .../brightnesslevel/src/BrightnessLevelPresenter.cpp | 2 +- .../nativeui/brightnesslevel/src/BrightnessLevelView.cpp | 1 - .../nativeui/calendar/include/CalendarPresenter.h | 1 + .../nativeapp/nativeui/calendar/src/CalendarPresenter.cpp | 5 +++++ .../fd230/nativeapp/nativeui/calendar/src/CalendarView.cpp | 1 - .../nativeui/callerlog/src/CallerLogPresenter.cpp | 1 - .../src/BluetoothServiceOptionsPresenter.cpp | 3 +-- .../classicbluetooth/src/BluetoothServiceOptionsView.cpp | 1 - .../classicbluetooth/src/ClassicBlueToothPresenter.cpp | 2 +- .../nativeui/classicbluetooth/src/ClassicBlueToothView.cpp | 1 - .../nativeui/countdown/src/MainCountDownPresenter.cpp | 2 +- .../nativeapp/nativeui/countdown/src/MainCountDownView.cpp | 1 - .../nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp | 2 +- .../nativeapp/nativeui/dnotdisturb/src/DnotDisturbView.cpp | 1 - .../nativeui/findphone/src/FindPhonePresenter.cpp | 2 +- .../nativeapp/nativeui/findphone/src/FindPhoneView.cpp | 1 - .../nativeui/flashlight/include/FlashlightPresenter.h | 1 + .../nativeui/flashlight/src/FlashlightPresenter.cpp | 5 +++++ .../nativeapp/nativeui/flashlight/src/FlashlightView.cpp | 1 - .../nativeapp/nativeui/goal/src/Maingoalpresenter.cpp | 2 +- .../fd230/nativeapp/nativeui/goal/src/Maingoalview.cpp | 1 - .../nativeui/heartrate/src/HeartDetectionPresenter.cpp | 1 + .../nativeui/heartrate/src/HeartDetectionView.cpp | 1 - .../nativeui/heartrate/src/HeartResultPresenter.cpp | 4 +++- .../nativeapp/nativeui/heartrate/src/HeartResultView.cpp | 1 - .../languagecode/include/LanguageSwitchPresenter.h | 2 +- .../nativeui/languagecode/src/LanguageSwitchPresenter.cpp | 5 +++++ .../nativeui/languagecode/src/LanguageSwitchView.cpp | 1 - .../nativeui/message/src/MessageShowPresenter.cpp | 2 +- .../nativeapp/nativeui/message/src/MessageShowView.cpp | 1 - .../motionrecognition/src/MotionRecognitionPresenter.cpp | 2 +- .../motionrecognition/src/MotionRecognitionView.cpp | 1 - .../nativeui/musicplayer/src/MusicPlayerPresenter.cpp | 2 +- .../nativeapp/nativeui/musicplayer/src/MusicPlayerView.cpp | 1 - .../networkandcall/src/NetworkAndCallPresenter.cpp | 2 +- .../nativeui/networkandcall/src/NetworkAndCallView.cpp | 1 - .../rebootandshutdown/src/RebootAndShutdownPresenter.cpp | 2 +- .../rebootandshutdown/src/RebootAndShutdownView.cpp | 1 - .../nativeapp/nativeui/record/include/RecordingPresenter.h | 2 +- .../nativeapp/nativeui/record/src/RecordingPresenter.cpp | 4 ++++ .../fd230/nativeapp/nativeui/record/src/RecordingView.cpp | 1 - .../src/RespiratoryTrainingPresenter.cpp | 2 +- .../respiratorytraining/src/RespiratoryTrainingView.cpp | 2 -- .../nativeapp/nativeui/saveele/include/SaveBatPresenter.h | 1 + .../nativeapp/nativeui/saveele/include/SaveElePresenter.h | 2 +- .../nativeapp/nativeui/saveele/src/SaveBatPresenter.cpp | 3 +++ .../fd230/nativeapp/nativeui/saveele/src/SaveBatView.cpp | 1 - .../nativeapp/nativeui/saveele/src/SaveElePresenter.cpp | 4 ++++ .../fd230/nativeapp/nativeui/saveele/src/SaveEleView.cpp | 1 - .../nativeui/schedule/include/SchedulePresenter.h | 1 + .../nativeapp/nativeui/schedule/src/SchedulePresenter.cpp | 5 +++++ .../fd230/nativeapp/nativeui/schedule/src/ScheduleView.cpp | 1 - .../nativeapp/nativeui/set_aod/src/SetAodDialPresenter.cpp | 2 +- .../nativeapp/nativeui/set_aod/src/SetAodDialView.cpp | 1 - .../nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp | 1 + .../fd230/nativeapp/nativeui/set_dial/src/SetDialView.cpp | 1 - .../set_time_format/include/SetTimeFormatPresenter.h | 1 + .../set_time_format/src/SetTimeFormatPresenter.cpp | 4 ++++ .../nativeui/set_time_format/src/SetTimeFormatView.cpp | 1 - .../nativeui/sleepmode/include/SleepModePresenter.h | 1 + .../nativeui/sleepmode/src/SleepModePresenter.cpp | 5 +++++ .../nativeapp/nativeui/sleepmode/src/SleepModeView.cpp | 1 - .../nativeui/soundandvibration/src/CallVolumePresenter.cpp | 2 +- .../nativeui/soundandvibration/src/CallVolumeView.cpp | 1 - .../soundandvibration/src/SoundAndVibrationPresenter.cpp | 2 +- .../soundandvibration/src/SoundAndVibrationView.cpp | 1 - .../soundandvibration/src/SystemVolumePresenter.cpp | 2 +- .../nativeui/soundandvibration/src/SystemVolumeView.cpp | 1 - .../nativeui/stopwatch/src/MainStopWatchPresenter.cpp | 2 +- .../nativeapp/nativeui/stopwatch/src/MainStopWatchView.cpp | 1 - .../nativeapp/nativeui/system/include/SystemPresenter.h | 2 +- .../nativeapp/nativeui/system/src/SystemPresenter.cpp | 5 +++++ .../fd230/nativeapp/nativeui/system/src/SystemView.cpp | 1 - .../nativeui/takephotos/include/TakephotosPresenter.h | 1 + .../nativeui/takephotos/src/TakephotosPresenter.cpp | 5 +++++ .../nativeapp/nativeui/takephotos/src/TakephotosView.cpp | 1 - .../nativeui/themestyle/include/ThemeStylePresenter.h | 1 + .../nativeui/themestyle/src/ThemeStylePresenter.cpp | 5 +++++ .../nativeapp/nativeui/themestyle/src/ThemeStyleView.cpp | 2 +- .../traing/training_card/src/TraingCardPresenter.cpp | 1 + .../nativeui/traing/training_card/src/TraingCardView.cpp | 2 +- .../nativeui/watchQRcode/include/WatchQRCodePresenter.h | 2 +- .../nativeui/watchQRcode/src/WatchQRCodePresenter.cpp | 5 +++++ .../nativeapp/nativeui/watchQRcode/src/WatchQRCodeView.cpp | 4 ---- .../nativeui/weather/src/MainWeatherPresenter.cpp | 2 +- .../nativeapp/nativeui/weather/src/MainWeatherView.cpp | 1 - 106 files changed, 139 insertions(+), 78 deletions(-) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoicePresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoicePresenter.h index f35192776..f8125e03e 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoicePresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoicePresenter.h @@ -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); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp index 30908df96..b64dcfbd4 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -132,6 +132,11 @@ namespace OHOS return; } + void AiVoicePresenter::OnResume() + { + RootView::GetInstance()->SetOnKeyActListener(this); + } + /*调转到返回结果界面*/ bool AiVoicePresenter::JumpToReturnResultTextView(void) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp index bcf2d91ec..00ffa54dc 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp @@ -528,7 +528,6 @@ namespace OHOS SetAiVoiceViewAllComponentsVisibilityStatus(); - RootView::GetInstance()->SetOnKeyActListener(presenter_); return; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/include/AlarmPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/include/AlarmPresenter.h index e7e028746..2dff3a6d7 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/include/AlarmPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/include/AlarmPresenter.h @@ -153,6 +153,7 @@ public: ColorType ShadowBlue(void); bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView& view, const DragEvent& event) override; + void OnResume() override; bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 bool OnDragEnd(UIView& view, const DragEvent& event) override; void OnSwipe(UISwipeView &view) override; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp index cfdf61b9a..5f1811420 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp @@ -364,6 +364,11 @@ void AlarmPresenter::ClickAlarmNext(uint16_t num) AlarmSetWeekView::GetInstance()->RefreshSetWeek1(); } +void AlarmPresenter::OnResume() +{ + RootView::GetInstance()->SetOnKeyActListener(this); +} + bool AlarmPresenter::OnDrag(UIView& view, const DragEvent& event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/MainAlarmView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/MainAlarmView.cpp index 037f7c344..ff64b327e 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/MainAlarmView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarm/src/MainAlarmView.cpp @@ -486,7 +486,6 @@ void MainAlarmView::OnStart() AddViewToRootContainer(container[0]); } viewInitstatus_ = true; - RootView::GetInstance()->SetOnKeyActListener(presenter_); } void MainAlarmView::RefreshAlarm(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayMainView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayMainView.cpp index 0047133db..111b865b8 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayMainView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayMainView.cpp @@ -71,8 +71,6 @@ void AlipayMainView::OnStart() WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::OnStart"); if(Alipay_is_init()==false) return; - // 增加按键监听 - RootView::GetInstance()->SetOnKeyActListener(presenter_); alipayInterfacesId startView; bool bindFlag = AlipayModel::GetInstance()->AlipayGetBindstate(); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp index e1483869b..427216b97 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp @@ -106,6 +106,8 @@ void AlipayPresenter::OnStart() void AlipayPresenter::OnResume(void) { svr_alipay_create_task(); + // 增加按键监听 + RootView::GetInstance()->SetOnKeyActListener(this); } void AlipayPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/include/AssistantPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/include/AssistantPresenter.h index 336e77fa1..a1c5384be 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/include/AssistantPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/include/AssistantPresenter.h @@ -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; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantPresenter.cpp index 8fa3b6678..1f0339ff7 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantPresenter.cpp @@ -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", diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantView.cpp index ae7bbd7e8..06a364715 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantView.cpp @@ -241,7 +241,6 @@ void AssistantView::OnStart() { InitView(); - RootView::GetInstance()->SetOnKeyActListener(presenter_); AddViewToRootContainer(AssistantScrollView[ASSISTANT_MAIN_VIEW]); } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodDetectionPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodDetectionPresenter.h index 821b2d9bd..12d93b824 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodDetectionPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodDetectionPresenter.h @@ -34,7 +34,7 @@ namespace OHOS BloodDetectionPresenter(); ~BloodDetectionPresenter() override; static BloodDetectionPresenter *GetInstance(void); - + void OnResume() override; void OnTickEvent() override; void Notify() override {} diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodResultPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodResultPresenter.h index ca5bc3830..6af049228 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodResultPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/include/BloodResultPresenter.h @@ -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; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp index f4ea38677..ee0910adb 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp @@ -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"); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionView.cpp index 2e9b91437..93c20081f 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodDetectionView.cpp @@ -294,7 +294,6 @@ void BloodDetectionView::OnStart() { } AddViewToRootContainer(scrollView_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultPresenter.cpp index d27e9ca5d..7bf9ac56e 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultPresenter.cpp @@ -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 diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultView.cpp index 3e743c679..e5d11d003 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodoxygen/src/BloodResultView.cpp @@ -201,7 +201,6 @@ void BloodResultView::OnStart() { } AddViewToRootContainer(scrollView_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/include/BluetoothPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/include/BluetoothPresenter.h index 20453ad64..adc053af0 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/include/BluetoothPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/include/BluetoothPresenter.h @@ -45,6 +45,7 @@ public: BluetoothPresenter(); ~BluetoothPresenter(); bool OnClick(UIView &view, const ClickEvent &event) override; + void OnResume() override; static BluetoothPresenter *GetInstance(); bool OnDrag(UIView& view, const DragEvent& event) override; bool OnDragEnd(UIView& view, const DragEvent& event) override; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp index aa6bc5fca..8e568908a 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp @@ -45,6 +45,11 @@ void BluetoothPresenter::OnStop(void) } } +void BluetoothPresenter::OnResume() +{ + RootView::GetInstance()->SetOnKeyActListener(this); +} + BluetoothPresenter *BluetoothPresenter::GetInstance() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothPresenter GetInstance"); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp index 1d2a1ce66..2844ae4d2 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp @@ -76,7 +76,6 @@ void MainBluetoothView::OnStart() } else { ChangeView(unusedValue, BLUETOOTHEARPHONEVIEW);//若一个都没有连接过就进行搜索 } - RootView::GetInstance()->SetOnKeyActListener(presenter_); return; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelPresenter.cpp index 7dce69ea9..7f679ca22 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelPresenter.cpp @@ -47,7 +47,7 @@ namespace OHOS void BrightnessLevelPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void BrightnessLevelPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelView.cpp index bc91dd71f..ee4dd8bc1 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/brightnesslevel/src/BrightnessLevelView.cpp @@ -75,7 +75,6 @@ namespace OHOS // 增加按键监听 // RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::BrightnessLevelPresenter::GetInstance(); //RootView::GetInstance()->SetOnKeyActListener(keyactListener); - RootView::GetInstance()->SetOnKeyActListener(presenter_); AddViewToRootContainer(scorllView); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/include/CalendarPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/include/CalendarPresenter.h index 96dd61122..fed6b0461 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/include/CalendarPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/include/CalendarPresenter.h @@ -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; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp index 0ba073834..43766067e 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp @@ -44,6 +44,11 @@ namespace OHOS { } + void CalendarPresenter::OnResume() + { + RootView::GetInstance()->SetOnKeyActListener(this); + } + bool CalendarPresenter::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarView.cpp index c9adc983e..8a922b3b7 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/calendar/src/CalendarView.cpp @@ -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 diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp index 2d5e67daf..1d29b3ecb 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp @@ -42,7 +42,6 @@ void CallerLogPresenter::OnStart() void CallerLogPresenter::OnResume(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnResume()"); - Presenter::OnResume(); return; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp index ac6421486..7834e770e 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp @@ -47,8 +47,7 @@ namespace OHOS void BluetoothServiceOptionsPresenter::OnResume(void) { - - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void BluetoothServiceOptionsPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp index 5589340db..fb4daba65 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp @@ -433,7 +433,6 @@ namespace OHOS BlueToothScrollView->Add(connectingScrollView); AddViewToRootContainer(BlueToothScrollView); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } void BluetoothServiceOptionsView::show_connecting_view(bool data) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp index ba0db4bcf..d4015b7a5 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp @@ -52,7 +52,7 @@ namespace OHOS void ClassicBlueToothPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void ClassicBlueToothPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp index d6d21609c..0ecb24876 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp @@ -308,6 +308,5 @@ namespace OHOS BlueToothScrollView->Add(AttentionLabel); BlueToothScrollView->Add(TradionalBlueToothToggleButton); AddViewToRootContainer(BlueToothScrollView); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownPresenter.cpp index 7f8a917e9..ba3ceb2f9 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownPresenter.cpp @@ -50,7 +50,7 @@ namespace OHOS void MainCountDownPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void MainCountDownPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownView.cpp index c34600fb8..42617ac30 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/countdown/src/MainCountDownView.cpp @@ -430,7 +430,6 @@ namespace OHOS { ChangeView(COUNTDOWN_MAX, MAIN_COUNTDOWN); // 如果倒计时的timer已经结束,则跳转到主界面 } - RootView::GetInstance()->SetOnKeyActListener(presenter_); /* -------------------------------------------------------------------------- */ } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp index 4cc98f7a3..0512882f2 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp @@ -47,7 +47,7 @@ namespace OHOS void DnotDisturbPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void DnotDisturbPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbView.cpp index 39118c53e..bf7413376 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbView.cpp @@ -252,6 +252,5 @@ namespace OHOS { AddViewToRootContainer(scrollView); } - RootView::GetInstance()->SetOnKeyActListener(presenter_); } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhonePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhonePresenter.cpp index 865b8dd70..471122e5f 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhonePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhonePresenter.cpp @@ -71,7 +71,7 @@ namespace OHOS void FindPhonePresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void FindPhonePresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneView.cpp index 2dce3611a..7266a0e8b 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneView.cpp @@ -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 diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/include/FlashlightPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/include/FlashlightPresenter.h index e8ee476d9..27e4c9f85 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/include/FlashlightPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/include/FlashlightPresenter.h @@ -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); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightPresenter.cpp index bb21fc84f..5761f3de2 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightPresenter.cpp @@ -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"); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightView.cpp index 30aa9d456..10c19eae4 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightView.cpp @@ -61,7 +61,6 @@ namespace OHOS AddViewToRootContainer(group); } InitSwipeData(); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } void FlashlightView::DeinitSwipeData() diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalpresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalpresenter.cpp index 1980b83b7..a3de49e39 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalpresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalpresenter.cpp @@ -58,7 +58,7 @@ namespace OHOS void MaingoalPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void MaingoalPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalview.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalview.cpp index 54e370baf..9e52ac710 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalview.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/Maingoalview.cpp @@ -135,7 +135,6 @@ namespace OHOS /* --------------------------------- 添加按键监听 --------------------------------- */ // RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MaingoalPresenter::GetInstance(); //RootView::GetInstance()->SetOnKeyActListener(keyactListener); - RootView::GetInstance()->SetOnKeyActListener(presenter_); /* -------------------------------------------------------------------------- */ } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionPresenter.cpp index b403e7820..11b1a0337 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionPresenter.cpp @@ -62,6 +62,7 @@ namespace OHOS } void HeartDetectionPresenter::OnResume(void) { + RootView::GetInstance()->SetOnKeyActListener(this); } void HeartDetectionPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionView.cpp index a43d6f608..d71284969 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartDetectionView.cpp @@ -140,7 +140,6 @@ namespace OHOS GetRootContainer()->SetDraggable(true); GetRootContainer()->SetTouchable(true); GetRootContainer()->SetOnDragListener(presenter_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); if (imageAnimator != nullptr) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultPresenter.cpp index 839e0e4f4..99dcae58d 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultPresenter.cpp @@ -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) {} diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultView.cpp index 736feb6c5..29e654e48 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/heartrate/src/HeartResultView.cpp @@ -197,7 +197,6 @@ namespace OHOS GetRootContainer()->SetDraggable(true); GetRootContainer()->SetTouchable(true); GetRootContainer()->SetOnDragListener(presenter_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/include/LanguageSwitchPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/include/LanguageSwitchPresenter.h index 786a2fd0d..222481cef 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/include/LanguageSwitchPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/include/LanguageSwitchPresenter.h @@ -30,7 +30,7 @@ namespace OHOS virtual ~LanguageSwitchPresenter(); void OnStart() override; - + void OnResume() override; static LanguageSwitchPresenter *GetInstance(); void SetLabelExt(UILabelExt *label); private: diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchPresenter.cpp index 25f2a38bf..0a716dde5 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchPresenter.cpp @@ -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"); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchView.cpp index 808ec3904..2621ea52b 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/languagecode/src/LanguageSwitchView.cpp @@ -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 diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowPresenter.cpp index dce979e0e..0755556bd 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowPresenter.cpp @@ -53,7 +53,7 @@ namespace OHOS void MessageShowPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void MessageShowPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowView.cpp index 29be8add0..f103b59cb 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/message/src/MessageShowView.cpp @@ -275,7 +275,6 @@ namespace OHOS UpdateShowConfig(); AddViewToRootContainer(scrollView_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp index 393a035e2..233bdc9de 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp @@ -58,7 +58,7 @@ namespace OHOS void MotionRecognitionPresenter::OnResume(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnResume"); - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void MotionRecognitionPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionView.cpp index 5494d9f0d..255d73aad 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/motionrecognition/src/MotionRecognitionView.cpp @@ -187,7 +187,6 @@ namespace OHOS scrollView->Add(MotionRecognitionToggleButton); scrollView->Add(note); AddViewToRootContainer(scrollView); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerPresenter.cpp index a0bb5ed9d..fb7eabc3c 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerPresenter.cpp @@ -52,7 +52,7 @@ namespace OHOS void MusicPlayerPresenter::OnResume(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnResume"); - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); if (view_ == nullptr) { return; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerView.cpp index 646f4d10b..90c471699 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/musicplayer/src/MusicPlayerView.cpp @@ -71,7 +71,6 @@ namespace OHOS } playersView->SetOnDragListener(presenter_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); return; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp index 4f7fbf484..216c31f4e 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp @@ -59,7 +59,7 @@ namespace OHOS void NetworkAndCallPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void NetworkAndCallPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallView.cpp index 79ecdb3a8..f9efdb922 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallView.cpp @@ -237,7 +237,6 @@ namespace OHOS NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(MobileData_toggleButton); NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(note); AddViewToRootContainer(NetworkAndCallScrollView[NETWORKANDCALLVIEW]); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp index d41d378b1..a6b37cd2d 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp @@ -61,7 +61,7 @@ namespace OHOS void RebootAndShutdownPresenter::OnResume(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::OnResume"); - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); if (view_ == nullptr) { return; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp index 78b0b7765..6202d5223 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp @@ -385,7 +385,6 @@ namespace OHOS viewInitStatus = true; } - RootView::GetInstance()->SetOnKeyActListener(presenter_); return; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/include/RecordingPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/include/RecordingPresenter.h index 289720e63..570df8bb4 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/include/RecordingPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/include/RecordingPresenter.h @@ -135,7 +135,7 @@ namespace OHOS virtual ~RecordingPresenter(); void OnStart() override; - + void OnResume() override; static RecordingPresenter *GetInstance(); int convertNumericDateTime(const char *numericDateTime, char *formattedDateTime); void UpdateRecordProcess(); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingPresenter.cpp index 76a34812d..16aee20ac 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingPresenter.cpp @@ -58,6 +58,10 @@ namespace OHOS p_RecordingModel->SendCheckRecordingSpaceOutCmd(); //进入录音视图后发送指令查看录音空间是否已满 // ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } + void RecordingPresenter::OnResume(void) + { + RootView::GetInstance()->SetOnKeyActListener(this); + } bool RecordingPresenter::OnDrag(UIView &view, const DragEvent &event) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingView.cpp index f0a0a89ad..6e218152a 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/record/src/RecordingView.cpp @@ -455,7 +455,6 @@ namespace OHOS void RecordingView::OnStart() { RecordingViewInit(); - RootView::GetInstance()->SetOnKeyActListener(presenter_); return; } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp index 21cfbe253..47123a52d 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp @@ -61,7 +61,7 @@ namespace OHOS void RespiratoryTrainingPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void RespiratoryTrainingPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp index b0f8ef04a..2fa25fc7b 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp @@ -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 diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveBatPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveBatPresenter.h index 6fb489686..8eb73303a 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveBatPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveBatPresenter.h @@ -33,6 +33,7 @@ namespace OHOS virtual ~SaveBatPresenter(); void OnStart() override; + void OnResume() override; static SaveBatPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveElePresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveElePresenter.h index 533a351fd..692579291 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveElePresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/include/SaveElePresenter.h @@ -27,7 +27,7 @@ public: virtual ~SaveElePresenter(); void OnStart() override; - + void OnResume() override; static SaveElePresenter *GetInstance(); private: diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatPresenter.cpp index de77a1ed3..2964cbf66 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatPresenter.cpp @@ -64,6 +64,9 @@ void SaveBatPresenter::OnStart() { } +void SaveBatPresenter::OnResume() { + RootView::GetInstance()->SetOnKeyActListener(this); +} bool SaveBatPresenter::OnPress(UIView &view, const PressEvent &event) { if (strcmp(view.GetViewId(), "button_exit") == 0) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatView.cpp index 2253a1242..07dc378e5 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveBatView.cpp @@ -856,7 +856,6 @@ namespace OHOS InitShowBackView(); AddViewToRootContainer(group_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveElePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveElePresenter.cpp index 5064998ef..cede84e5f 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveElePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveElePresenter.cpp @@ -41,6 +41,10 @@ SaveElePresenter *SaveElePresenter::GetInstance() { void SaveElePresenter::OnStart() { Presenter::OnStart(); } +void SaveElePresenter::OnResume() { + RootView::GetInstance()->SetOnKeyActListener(this); +} + bool SaveElePresenter::OnDrag(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveEleView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveEleView.cpp index d1560ead8..8aa33cfcd 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveEleView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/saveele/src/SaveEleView.cpp @@ -132,7 +132,6 @@ void SaveEleView::OnStart() { AddViewToRootContainer(scrollview_); InitView(); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/include/SchedulePresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/include/SchedulePresenter.h index 66be206cb..8781963cf 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/include/SchedulePresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/include/SchedulePresenter.h @@ -25,6 +25,7 @@ namespace OHOS static SchedulePresenter * GetInstance(); void OnStart() override; + void OnResume() override; private: bool OnClick(UIView &view, const ClickEvent &event) override; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/SchedulePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/SchedulePresenter.cpp index 0334330df..1cbb07261 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/SchedulePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/SchedulePresenter.cpp @@ -43,6 +43,11 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SchedulePresenter::OnStart"); } + void SchedulePresenter::OnResume() + { + RootView::GetInstance()->SetOnKeyActListener(this); + } + bool SchedulePresenter::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/ScheduleView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/ScheduleView.cpp index e0e7c0747..96053ddd1 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/ScheduleView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/schedule/src/ScheduleView.cpp @@ -46,7 +46,6 @@ namespace OHOS } DisplayDataOrNoScreen(); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } void ScheduleView::DisplaySelectScreen(uint8_t ScreenIndex) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialPresenter.cpp index 0066e65bc..9eff7956c 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialPresenter.cpp @@ -49,7 +49,7 @@ namespace OHOS void SetAodDialPresenter::OnResume(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetAodDialView::OnResume"); - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void SetAodDialPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialView.cpp index af6a6a58e..c16152f96 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_aod/src/SetAodDialView.cpp @@ -177,6 +177,5 @@ namespace OHOS scrollView->Add(SetAodDialToggleButton); scrollView->Add(note); AddViewToRootContainer(scrollView); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp index 551a0d8f7..c15694e87 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp @@ -47,6 +47,7 @@ namespace OHOS void SetDialPresenter::OnResume(void) { + RootView::GetInstance()->SetOnKeyActListener(this); } void SetDialPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialView.cpp index 9f1e776a9..170210bcd 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialView.cpp @@ -38,7 +38,6 @@ namespace OHOS SetUpRollerView(); } - RootView::GetInstance()->SetOnKeyActListener(presenter_); } void SetDialView::SetUpCoverflowView(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/include/SetTimeFormatPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/include/SetTimeFormatPresenter.h index 086b1918d..956dab4bb 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/include/SetTimeFormatPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/include/SetTimeFormatPresenter.h @@ -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; // 增加按键事件 diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatPresenter.cpp index c2d7f1537..80ea2a70b 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatPresenter.cpp @@ -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); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp index 7487cdb9e..16f094dd9 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp @@ -31,7 +31,6 @@ void SetTimeFormatView::OnStart() { GetRootContainer()->SetOnDragListener(presenter_); GetRootContainer()->SetTouchable(true); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } bool SetTimeFormatView::SetTimeFormatInit() { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/include/SleepModePresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/include/SleepModePresenter.h index f116f6d82..f579d6484 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/include/SleepModePresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/include/SleepModePresenter.h @@ -22,6 +22,7 @@ namespace OHOS virtual ~SleepModePresenter(); void OnStart() override; + void OnResume() override; static SleepModePresenter *GetInstance(); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModePresenter.cpp index 54eddb7ac..968a9075e 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModePresenter.cpp @@ -34,6 +34,11 @@ namespace OHOS Presenter::OnStart(); } + void SleepModePresenter::OnResume() + { + RootView::GetInstance()->SetOnKeyActListener(this); + } + bool SleepModePresenter::OnDrag(UIView &view, const DragEvent &event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SleepModePresenter::OnDrag"); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModeView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModeView.cpp index fd53606e2..29a9d0e13 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModeView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/sleepmode/src/SleepModeView.cpp @@ -41,7 +41,6 @@ namespace OHOS AddViewToRootContainer(ScrollView_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumePresenter.cpp index 752bf9108..d330488ff 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumePresenter.cpp @@ -55,7 +55,7 @@ namespace OHOS void CallVolumePresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void CallVolumePresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp index 7db2953c2..cf6910abd 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp @@ -80,7 +80,6 @@ namespace OHOS } UpdateCallVolumeSliderValue(); AddViewToRootContainer(CallVolumeScrollView); - RootView::GetInstance()->SetOnKeyActListener(presenter_); return; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp index 8a00b12fc..783e52b5c 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp @@ -54,11 +54,11 @@ namespace OHOS void SoundAndVibrationPresenter::OnResume(void) { - Presenter::OnResume(); if (view_ == nullptr) { return; } + RootView::GetInstance()->SetOnKeyActListener(this); } void SoundAndVibrationPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp index e6b678f45..9ab595b11 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp @@ -341,7 +341,6 @@ namespace OHOS GetRootContainer()->SetTouchable(true); GetRootContainer()->SetDraggable(true); GetRootContainer()->SetOnDragListener(presenter_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); if (!initViewStatus) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumePresenter.cpp index dbceca14c..a18245263 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumePresenter.cpp @@ -58,7 +58,7 @@ namespace OHOS void SystemVolumePresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void SystemVolumePresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp index 5efcec417..541b56616 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp @@ -83,7 +83,6 @@ namespace OHOS GetRootContainer()->SetTouchable(true); GetRootContainer()->SetDraggable(true); GetRootContainer()->SetOnDragListener(presenter_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); if (!initViewStatus) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchPresenter.cpp index c3a5513ee..dc6e8ecaf 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchPresenter.cpp @@ -53,7 +53,7 @@ namespace OHOS void MainStopWatchPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void MainStopWatchPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchView.cpp index f1e63c0fd..915c7b40c 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/stopwatch/src/MainStopWatchView.cpp @@ -414,6 +414,5 @@ namespace OHOS scrollView[MAIN_STOPWATCH]->Add(ResetOrMarkbutton); group->Add(scrollView[MAIN_STOPWATCH]); AddViewToRootContainer(group); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/include/SystemPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/include/SystemPresenter.h index 9df11ba95..4c6086683 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/include/SystemPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/include/SystemPresenter.h @@ -38,7 +38,7 @@ namespace OHOS virtual ~SystemPresenter(); void OnStart() override; - + void OnResume() override; static SystemPresenter *GetInstance(); private: diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemPresenter.cpp index 267607356..18a97698f 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemPresenter.cpp @@ -49,6 +49,11 @@ namespace OHOS void SystemPresenter::OnStart(){} + void SystemPresenter::OnResume() + { + RootView::GetInstance()->SetOnKeyActListener(this); + } + static uint32_t time = 0; static uint32_t OnClick_num = 0; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemView.cpp index 8eb7cf332..983a75c60 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/system/src/SystemView.cpp @@ -339,7 +339,6 @@ namespace OHOS CreateSystemView(); } - RootView::GetInstance()->SetOnKeyActListener(presenter_); if (SystemScrollView[SYSTEMVIEW] == nullptr) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/include/TakephotosPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/include/TakephotosPresenter.h index bf22bf5ed..46376bc9a 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/include/TakephotosPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/include/TakephotosPresenter.h @@ -20,6 +20,7 @@ namespace OHOS virtual ~TakephotosPresenter(); void OnStart() override; + void OnResume() override; static TakephotosPresenter *GetInstance(); private: diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosPresenter.cpp index 6494666db..c36791e26 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosPresenter.cpp @@ -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 && diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosView.cpp index e46f0d4c2..79c439bbd 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/takephotos/src/TakephotosView.cpp @@ -342,7 +342,6 @@ namespace OHOS PreLoad(); AddViewToRootContainer(scrollview_); - RootView::GetInstance()->SetOnKeyActListener(presenter_); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TakephotosView OnStart is ok"); } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/include/ThemeStylePresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/include/ThemeStylePresenter.h index 10545e30a..ff087d54f 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/include/ThemeStylePresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/include/ThemeStylePresenter.h @@ -29,6 +29,7 @@ namespace OHOS ThemeStyle GetSelectThemeStyleId(void); void OnStart() override; + void OnResume() override; private: bool OnClick(UIView &view, const ClickEvent &event) override; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStylePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStylePresenter.cpp index 51e30f24d..d398e03b8 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStylePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStylePresenter.cpp @@ -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); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStyleView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStyleView.cpp index 27bc5dc8b..42695067f 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStyleView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStyleView.cpp @@ -331,7 +331,7 @@ namespace OHOS { ThemeStyleViewInit(); } - RootView::GetInstance()->SetOnKeyActListener(presenter_); + } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp index 9dad127e9..b9115cb00 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -84,6 +84,7 @@ void TraingCardPresenter::OnPause(void) { void TraingCardPresenter::OnResume(void) { Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void TraingCardPresenter::OnStop(void) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardView.cpp index 12f56af39..30a9397ad 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardView.cpp @@ -615,7 +615,7 @@ void TraingCardView ::InitView() { swipe_->SetHorCurrentPage(Control_Card::DATA); // 设置进入索引 [数据] - RootView::GetInstance()->SetOnKeyActListener(presenter_); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TraingCardView::InitPage over"); } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/include/WatchQRCodePresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/include/WatchQRCodePresenter.h index 8dec03dfd..27553a8b6 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/include/WatchQRCodePresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/include/WatchQRCodePresenter.h @@ -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; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp index d01ced5aa..163806dcf 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp @@ -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) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodeView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodeView.cpp index 4185b3ee7..237cc54a2 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodeView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/watchQRcode/src/WatchQRCodeView.cpp @@ -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; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherPresenter.cpp index f4b094184..ac037c0b7 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherPresenter.cpp @@ -53,7 +53,7 @@ namespace OHOS void MainWeatherPresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void MainWeatherPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherView.cpp index 16b80cf07..591a5054b 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/weather/src/MainWeatherView.cpp @@ -152,7 +152,6 @@ namespace OHOS weatherSwipeViewList->SetOnSwipeListener(presenter_); } UpdateMainWeatherViewVisibility(); - RootView::GetInstance()->SetOnKeyActListener(presenter_); } WeatherView *MainWeatherView::GetWeatherView(void) -- 2.17.1