From: Caisking <3449750381@qq.com> Date: Thu, 9 May 2024 10:26:15 +0000 (+0800) Subject: 主界面Presenter增加内存函数接口 X-Git-Tag: release_V1.2.70_20241020_135402~1025^2~8^2^2~6 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=40f4516c6a3da02082ab29e21e7e70c6469d02c7;p=mirrors%2FFD230.git 主界面Presenter增加内存函数接口 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h index b02956da6..2192994df 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h @@ -43,20 +43,18 @@ namespace OHOS static constexpr const char *DROPDOWN_CLICK_FINDMYPHONE = "dropdownclickfindmyphone"; // 找手机 static constexpr const char *CONNECTEDSTATUSBACKGROUNDBUTTON = "connectedstatusbackgroundbutton"; // 连接状态按钮 - static constexpr const char *CONNECTEDSTATUSVIEWCLOSEBUTTON = "connectedstatusviewclosebutton"; // 连接状态视图的关闭按钮 - + static constexpr const char *CONNECTEDSTATUSVIEWCLOSEBUTTON = "connectedstatusviewclosebutton"; // 连接状态视图的关闭按钮 constexpr uint16_t VERTICAL_STATUS = 1; constexpr uint16_t HORIZONTAL_STATUS = 0; -class MainViewSample; -class MainPresenterSample : public Presenter, public ModelListenerSample, - public UIView::OnClickListener, public UIView::OnDragListener, public UISwipeView::OnSwipeListener, - public UIView::OnLongPressListener, public UISwipeView, public CompassPresenter { -public: - MainPresenterSample(); - virtual ~MainPresenterSample(); - static MainPresenterSample *GetInstance(void); + class MainViewSample; + class MainPresenterSample : public Presenter, public ModelListenerSample, public UIView::OnClickListener, public UIView::OnDragListener, public UISwipeView::OnSwipeListener, public UIView::OnLongPressListener, public UISwipeView, public CompassPresenter + { + public: + MainPresenterSample(); + virtual ~MainPresenterSample(); + static MainPresenterSample *GetInstance(void); void OnStart() override; void OnPause() override; @@ -64,7 +62,7 @@ public: void OnStop() override; virtual void Notify() override; bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnDrag(UIView &view, const DragEvent &event) override; bool OnLongPress(UIView &view, const LongPressEvent &event) override; virtual void OnSwipe(UISwipeView &view) override; void SetPage(int8_t id); @@ -74,29 +72,31 @@ public: callback_ = callback; } - void InitCardSettings(void); - uint8_t GetCardSettingCount(void); - CardId *GetCardSettings(void); - void InitDialSettings(void); - DialSetting& GetDialSetting(); - void UpdataTime(); - void UpdataBaseData(); - void PullUpDown_StartTimer(uint32_t interval); - void PullUpDown_StopTimer(void); - static uint8_t g_PullUpDownTimes; + void InitCardSettings(void); + uint8_t GetCardSettingCount(void); + CardId *GetCardSettings(void); + void InitDialSettings(void); + DialSetting &GetDialSetting(); + void UpdataTime(); + void UpdataBaseData(); + void PullUpDown_StartTimer(uint32_t interval); + void PullUpDown_StopTimer(void); + static uint8_t g_PullUpDownTimes; + + void get_memcheck(); -private: - void ProcessDataNotify(void); - void SetCircleProgress(void); - void SetCompassRotate(void); - KeyInputListener *keyActListener_{nullptr}; - ZoomEffect* callback_{nullptr}; - uint8_t state_ = UICheckBox::UICheckBoxState::MAX_STATUS_NUM; - int64_t playerCurrentTime_{0}; - int64_t playerMusicDuration_{0}; - int64_t playerProgressValue_{0}; - bool isCompassSensorOpened_{false}; -}; + private: + void ProcessDataNotify(void); + void SetCircleProgress(void); + void SetCompassRotate(void); + KeyInputListener *keyActListener_{nullptr}; + ZoomEffect *callback_{nullptr}; + uint8_t state_ = UICheckBox::UICheckBoxState::MAX_STATUS_NUM; + int64_t playerCurrentTime_{0}; + int64_t playerMusicDuration_{0}; + int64_t playerProgressValue_{0}; + bool isCompassSensorOpened_{false}; + }; } #endif // MAIN_PRESENTER_H diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp index ffef8d019..881aba230 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp @@ -37,11 +37,11 @@ namespace OHOS { map g_jumpView = { - {DROPDOWN_CLICK_SETTING, VIEW_SETTING}, // 设置 - {DROPDOWN_CLICK_LIGHTING, VIEW_CLASSIC_BLUETOOTH},// 蓝牙 - {DROPDOWN_CLICK_DNOTDISTURB, VIEW_DNOTDISTURB}, // 勿扰 - {DROPDOWN_CLICK_SAVEELE, VIEW_SAVEELE}, // 省电模式 - {DROPDOWN_CLICK_FINDMYPHONE, VIEW_FIND_PHONE}, // 查找手机 + {DROPDOWN_CLICK_SETTING, VIEW_SETTING}, // 设置 + {DROPDOWN_CLICK_LIGHTING, VIEW_CLASSIC_BLUETOOTH}, // 蓝牙 + {DROPDOWN_CLICK_DNOTDISTURB, VIEW_DNOTDISTURB}, // 勿扰 + {DROPDOWN_CLICK_SAVEELE, VIEW_SAVEELE}, // 省电模式 + {DROPDOWN_CLICK_FINDMYPHONE, VIEW_FIND_PHONE}, // 查找手机 }; static MainPresenterSample *g_pMainPresenterSample = nullptr; @@ -140,14 +140,14 @@ namespace OHOS #endif } - if(curViewId == CONNECTEDSTATUSBACKGROUNDBUTTON) + if (curViewId == CONNECTEDSTATUSBACKGROUNDBUTTON) { - PullUpDownView::GetInstance()->ChangeView(DROPDOWNVIEW,CONNECTEDSTATUSVIEW); + PullUpDownView::GetInstance()->ChangeView(DROPDOWNVIEW, CONNECTEDSTATUSVIEW); return true; } - else if(curViewId == CONNECTEDSTATUSVIEWCLOSEBUTTON) + else if (curViewId == CONNECTEDSTATUSVIEWCLOSEBUTTON) { - PullUpDownView::GetInstance()->ChangeView(CONNECTEDSTATUSVIEW,DROPDOWNVIEW); + PullUpDownView::GetInstance()->ChangeView(CONNECTEDSTATUSVIEW, DROPDOWNVIEW); return true; } // if(&view == PullUpDownView::GetInstance()->GetConnectedStatusView()->GetCloseButton()) @@ -166,7 +166,7 @@ namespace OHOS if (g_jumpView.count(curViewId) != 0) { - //NativeAbility::GetInstance().ChangeSlice(g_jumpView[curViewId]); + // NativeAbility::GetInstance().ChangeSlice(g_jumpView[curViewId]); NativeAbility::GetInstance().EnterSlice(g_jumpView[curViewId]); } return true; @@ -471,7 +471,10 @@ namespace OHOS PRINT("ALLData are refresh!\n"); } - + void MainPresenterSample::get_memcheck() + { + MemCheck::GetInstance()->DumpMemInfo(); + } /* -------------------------------------------------------------------------- */ // 声明定时器变量 static osTimerId_t g_timer = NULL; @@ -490,12 +493,12 @@ namespace OHOS MainPresenterSample::GetInstance()->UpdataTime(); PullUpDownView::GetInstance()->UpdateSignalStrengthStatusAndBatteryPosition(); } - + if (uapi_get_screen_state() == 1) // 息屏停止更新数据 { GraphicService::GetInstance()->PostGraphicEvent(std::bind(&MainPresenterSample::PullUpDown_StopTimer, MainPresenterSample::GetInstance())); } - + return; }