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

67 lines
2.3 KiB
C++

#ifndef TJD_UI_APP_STOPWATCH_PRESENTER_H
#define TJD_UI_APP_STOPWATCH_PRESENTER_H
#include "NativeAbility.h"
#include "Presenter.h"
#include "TjdUiAppIds.h"
#include "TjdUiTaskListener.h"
#include "TjdUiScreenDrag.h"
#include "components/root_view.h"
#include "components/ui_slider.h"
#include "components/ui_view.h"
#include "dock/input_device.h"
#include "graphic_service.h"
#include "graphic_timer.h"
#include <string>
namespace TJD {
#define STOPWATCH_START_ID "StopwatchStartId_"
#define STOPWATCH_PAUSE_ID_1 "StopwatchPauseId1_"
#define STOPWATCH_PAUSE_ID_2 "StopwatchPauseId2_"
#define STOPWATCH_RESUME_ID "StopwatchResumeId_"
#define STOPWATCH_CLEAR_ID "StopwatchClearId_"
#define STOPWATCH_LIST_ID "StopwatchListId_"
#define STOPWATCH_LIST_AIGIN_ID "StopwatchListAiginId_"
#define STOPWATCH_PICKER_ID "StopwatchPikcerId_"
class TjdUiAppStopwatchView;
class TjdUiAppStopwatchPresenter : public OHOS::Presenter<TjdUiAppStopwatchView>,
public TjdUiTaskListener,
public OHOS::RootView::OnKeyActListener,
public OHOS::UIView::OnClickListener,
public TjdUiScreenDragListener
{
public:
TjdUiAppStopwatchPresenter();
virtual ~TjdUiAppStopwatchPresenter();
static TjdUiAppStopwatchPresenter *GetInstance(void);
virtual void Notify() override;
void OnStart() override;
void OnPause() override;
void OnResume() override;
void OnStop() override;
bool OnDragEnd(OHOS::UIView &view, const OHOS::DragEvent &event);
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override;
void ViewExitEvent();
void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) override { ViewExitEvent(); }
bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override;
void StowatchStartClickEvent();
void StowatchPause1ClickEvent();
void StowatchPause2ClickEvent();
void StowatchListClickEvent();
void StowatchResumeClickEvent();
private:
bool boolFlag1{false};
bool backFlag2{false};
bool backFlag3{false};
uint8_t theNum{0};
uint8_t listNum{0};
bool isExit_{false};
int16_t dragStartX_{0};
int16_t dragCurrentX_{0};
int32_t dragDistance_{0};
};
} // namespace TJD
#endif