mcu_hi3321_watch/tjd/ui/app/breathing/TjdUiAppBreathingPresenter.h
2025-05-26 20:15:20 +08:00

86 lines
2.6 KiB
C++

#ifndef TJD_UI_APP_BREATHING_PRESENTER_H
#define TJD_UI_APP_BREATHING_PRESENTER_H
#include "Presenter.h"
#include "TjdUiTaskListener.h"
#include "components/ui_view.h"
#include "components/ui_view.h"
#include "graphic_timer.h"
#include <string>
#include "TjdUiAppIds.h"
#include "NativeAbility.h"
#include "components/root_view.h"
#include "graphic_service.h"
#include "dock/input_device.h"
#include "common/key_code.h"
#include "TjdUiScreenDrag.h"
namespace TJD {
enum BreathingView
{
BREATHINGSWIPE_VIEW = 0,
BREATHINGREMIND_VIEW,
BREATHINGUNWEAR_VIEW,
BREATHINGMAX_VIEW
};
enum class BreathingHeartRate {
Start,
Stop,
GetVaule,
};
#define TIMEBREATHING_ID "Timebreathing_"
#define MODELBREATHING_ID "Modelbreathing_"
#define STARTBREATHING_ID "Startbreathing_"
#define STARTBACKGROUND_ID "Startbackground_"
#define TIME_VIEW_ID "Timeview_"
#define MODEL_VIEW_ID "Modelview_"
#define TIME_LABEL1_ID "Timelabel1_"
#define TIME_LABEL2_ID "Timelabel2_"
#define TIME_LABEL3_ID "Timelabel3_"
#define MODEL_LABEL1_ID "Modellabel1_"
#define MODEL_LABEL2_ID "Modellabel2_"
#define MODEL_LABEL3_ID "Modellabel3_"
#define FINISHED_ID "Finishid_"
#define STARTVIEW_ID "Startviewid_"
class TjdUiAppBreathingView;
class TjdUiAppBreathingPresenter : public OHOS::Presenter<TjdUiAppBreathingView>,
public TjdUiTaskListener,
public OHOS::RootView::OnKeyActListener,
public OHOS::UIView::OnClickListener,
public TjdUiScreenDragListener
{
public:
TjdUiAppBreathingPresenter();
virtual ~TjdUiAppBreathingPresenter();
static TjdUiAppBreathingPresenter *GetInstance(void);
virtual void Notify() override;
void OnStart() override;
void OnPause() override;
void OnResume() override;
void OnStop() override;
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override;
bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event)override;
void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) { ViewExitEvent(view, event); }
uint8_t BreathingHeartRateHandler(BreathingHeartRate action, void *param, int8_t mins);
void ViewExitEvent(OHOS::UIView &view, const OHOS::DragEvent &event);
private:
int16_t num1{0};
int16_t num2{0};
int16_t num3{0};
int16_t num4{0};
int16_t min{1};
int8_t hrnum{0};
bool changeFlag1{false};
bool backFlag{false};
bool model1{false};
bool model2{true};
bool model3{false};
bool numFlag{false};
uint8_t refreshCount{0};
OHOS::GraphicTimer *exitTimer_{nullptr};
};
}
#endif