89 lines
3.6 KiB
C++
89 lines
3.6 KiB
C++
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
|
|
*
|
|
* Description:
|
|
*
|
|
* Author: wuchangxin
|
|
*
|
|
* Create: 2024-7-3
|
|
*--------------------------------------------------------------------------*/
|
|
#ifndef TJDUI_APP_LUCKY_CLOVER_PRESENTER_H
|
|
#define TJDUI_APP_LUCKY_CLOVER_PRESENTER_H
|
|
|
|
#include "Presenter.h"
|
|
#include "TjdUiScreenDrag.h"
|
|
#include "components/root_view.h"
|
|
#include "components/ui_label.h"
|
|
#include "components/ui_view.h"
|
|
#include "graphic_timer.h"
|
|
#include "sql_fit.h"
|
|
#include "ui_swipe_view.h"
|
|
namespace TJD {
|
|
|
|
// 四叶草数据结构体
|
|
typedef struct LuckyCloverData
|
|
{
|
|
uint8_t goalTaskNum; // 目标任务数
|
|
uint8_t currentTaskNum; // 当前任务数
|
|
uint8_t goalStandNum; // 目标站立次数
|
|
uint8_t currentStandNum; // 当前站立次数
|
|
uint16_t goalCalorieNum; // 目标卡路里消耗: kcal
|
|
uint16_t currentCalorieNum; // 当前卡路里消耗: kcal
|
|
uint8_t goalStrengthTime; // 目标强度训练时长: min
|
|
uint8_t currentStrengthTime; // 当前强度训练时长: min
|
|
uint32_t goalStepNum; // 目标步数: step
|
|
uint32_t currentStepNum; // 当前步数: step
|
|
uint16_t goalDrinkNum; // 目标喝水毫升数
|
|
uint16_t currentDrinkNum; // 当前喝水毫升数
|
|
uint8_t goalMedicineNum; // 目标吃药次数
|
|
uint8_t currentMedicineNum; // 当前吃药次数
|
|
uint8_t curBloodPressureMeasurTime; // 当前血压测量次数
|
|
uint8_t goalBloodPressureMeasurTime; // 目标血压测量次数
|
|
uint16_t currentSleepTime; // 当前睡眠时长: min
|
|
uint16_t goalSleepTime; // 目标睡眠时长: min
|
|
bool sleepEarly; // 是否早睡
|
|
bool custom123; // 自定义123开关
|
|
bool prayToBuddha; // 是否礼佛
|
|
bool religious; // 是否礼拜
|
|
bool pray; // 是否祈祷
|
|
} lucky_clover_t;
|
|
|
|
class TjdUiAppLuckyCloverView;
|
|
class TjdUiAppLuckyCloverModel;
|
|
class TjdUiAppLuckyCloverPresenter : public OHOS::Presenter<TjdUiAppLuckyCloverView>,
|
|
public TjdUiScreenDragListener,
|
|
public OHOS::UISwipeView::OnSwipeListener,
|
|
public OHOS::UIView::OnClickListener,
|
|
public OHOS::RootView::OnKeyActListener
|
|
|
|
{
|
|
public:
|
|
TjdUiAppLuckyCloverPresenter();
|
|
virtual ~TjdUiAppLuckyCloverPresenter();
|
|
static TjdUiAppLuckyCloverPresenter *GetInstance(void);
|
|
void OnStart() override;
|
|
void OnPause() override;
|
|
void OnResume() override;
|
|
void OnStop() override;
|
|
bool OnDrag(OHOS::UIView &view, const OHOS::DragEvent &event);
|
|
void ViewExitEvent(OHOS::UIView &view);
|
|
void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) override { ViewExitEvent(view); }
|
|
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 StartJumpTimer(void);
|
|
osTimerId_t jumpTimerId_{nullptr};
|
|
|
|
private:
|
|
void LabelRefresh(OHOS::UILabel *label, const char *temp_str);
|
|
void ExitLuckyCloverView(void);
|
|
void OnkeyEventViewExit(bool isSwipe);
|
|
bool isExit_{false};
|
|
int16_t dragStartX_{0};
|
|
int16_t dragCurrentX_{0};
|
|
int32_t dragDistance_{0};
|
|
};
|
|
|
|
} // namespace TJD
|
|
|
|
#endif |