/*---------------------------------------------------------------------------- * Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved. * * Description: TjdUiAppBatterySaverView.h * * Author: luziquan@ss-tjd.com * * Create: 2024-11-18 *--------------------------------------------------------------------------*/ #ifndef TJD_UI_APP_BATTERY_SAVER_VIEW_H #define TJD_UI_APP_BATTERY_SAVER_VIEW_H #include "TjdUiAppBatterySaverPresenter.h" #include "TjdUiMultiLanguageExt.h" #include "View.h" #include "components/ui_canvas_ext.h" #include "components/ui_image_view.h" #include "components/ui_view_group.h" namespace TJD { class BatterySaverViewBase : public OHOS::UIViewGroup { public: BatterySaverViewBase() {} virtual ~BatterySaverViewBase() {} virtual void ShowView() { SetVisible(true); }; virtual void HideView() { SetVisible(false); }; }; class BatterySaverMainView : public BatterySaverViewBase { public: BatterySaverMainView(); ~BatterySaverMainView(); void SetTime(int hour, int minute); void SetDate(int month, int day); void SetWeek(int week); void SetStep(int step); private: OHOS::UILabel time_; OHOS::UILabel date_; OHOS::UILabel week_; OHOS::UILabel step_; OHOS::UIImageView stepIcon_; }; class BatterySaverLongPressView : public BatterySaverViewBase { public: BatterySaverLongPressView(); ~BatterySaverLongPressView(); void DragPowerValue(uint16_t value); void DragPowerState(const char *state); private: OHOS::UICanvasExt canvas_; OHOS::UILabel state_; OHOS::UIImageView batIcon_; OHOS::UIImageView exitIcon_; }; class TjdUiAppBatterySaverView : public OHOS::View { public: TjdUiAppBatterySaverView(); ~TjdUiAppBatterySaverView(); static TjdUiAppBatterySaverView *GetInstance(void); void OnStart() override; void OnStop() override; void ShowView(BatterySaverViewIndex showIndex); void SetData(int month, int day, int hour, int minute, int week, int step); void SetPowerValue(uint16_t value); void SetPowerState(const char *state); static BatterySaverViewIndex currentViewIndex_; private: void InitTargetView(BatterySaverViewIndex index); OHOS::UIViewGroup *mainView_{nullptr}; BatterySaverViewBase *viewManager_[BATTERY_SAVER_UNKNOWN]{nullptr}; int lastMonth_{-1}; int lastDay_{-1}; int lastHour_{-1}; int lastMinute_{-1}; int lastWeek_{-1}; int lastStep_{-1}; }; } // namespace TJD #endif