/*---------------------------------------------------------------------------- * Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved. * * Description: * * Author: wuchangxin * * Create: 2024-6-27 *--------------------------------------------------------------------------*/ #ifndef TJDUI_APP_STRESS_PRESENTER_H #define TJDUI_APP_STRESS_PRESENTER_H #include "Presenter.h" #include "TjdUiScreenDrag.h" #include "components/root_view.h" #include "components/ui_view.h" #include "dock/input_device.h" #include "graphic_timer.h" #include "ui_swipe_view.h" struct stressPercentage_t { uint8_t highValue; uint8_t middleValue; uint8_t normalValue; uint8_t relaxValue; float valid; }; namespace TJD { class TjdUiAppStressView; class TjdUiAppStressModel; class TjdUiAppStressPresenter : public OHOS::Presenter, public TjdUiScreenDragListener, public OHOS::UISwipeView::OnSwipeListener, public OHOS::UIView::OnClickListener, public OHOS::RootView::OnKeyActListener { public: TjdUiAppStressPresenter(); virtual ~TjdUiAppStressPresenter(); static TjdUiAppStressPresenter *GetInstance(void); void OnStart() override; void OnStop() override; void OnPause() override; void OnResume() override; void OnSwipe(OHOS::UISwipeView &view) override; bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override; bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event); void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) override { ExitStressView();} OHOS::Point *GetStressPointArray(void); void StressDataUpdate(uint32_t index, uint8_t stressValue); stressPercentage_t GetStressPercentage(void); void StressProgressUpdate(stressPercentage_t ProgressPercentage); uint32_t GetCurTimeIndex(void); void ExitStressView(void); void StressPointArrayInit(void); private: bool isExit_{false}; int16_t dragStartX_{0}; int16_t dragCurrentX_{0}; int32_t dragDistance_{0}; }; } // namespace TJD #endif