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

57 lines
1.7 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
*
* Description: TjdUiAppPowerSavingDialPresenter.h
*
* Author: luziquan@ss-tjd.com
*
* Create: 2024-11-18
*--------------------------------------------------------------------------*/
#ifndef TJD_UI_APP_BATTERY_SAVER_PRESENTER_H
#define TJD_UI_APP_BATTERY_SAVER_PRESENTER_H
#include "Presenter.h"
#include "TjdUiTaskListener.h"
#include "cmsis_os2.h"
#include "components/root_view.h"
#include "components/ui_view.h"
namespace TJD {
enum BatterySaverViewIndex
{
BATTERY_SAVER_MAIN = 0,
BATTERY_SAVER_LONG_PRESS,
BATTERY_SAVER_UNKNOWN
};
class TjdUiAppBatterySaverView;
class TjdUiAppBatterySaverPresenter : public OHOS::Presenter<TjdUiAppBatterySaverView>,
public OHOS::RootView::OnKeyActListener,
public OHOS::UIView::OnTouchListener,
public TjdUiTaskListener
{
public:
TjdUiAppBatterySaverPresenter();
virtual ~TjdUiAppBatterySaverPresenter();
static TjdUiAppBatterySaverPresenter *GetInstance(void);
void OnStart() override;
void OnStop() override;
bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override;
void Notify(void) override;
void StartAnimatorTimer(void);
void StopAnimatorTimer(void);
void AnimatorTimerCallback(void);
private:
void StartAnimatorSucessEventTimer(void);
osTimerId_t animatorTimerId_{nullptr};
osTimerId_t jumpTimerId_{nullptr};
uint8_t animatorCount_{1};
bool isAnimatorRunning_{false};
};
} // namespace TJD
#endif