/*---------------------------------------------------------------------------- * Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved. * * Description: * * Author: wuchangxin * * Create: 2024-7-3 *--------------------------------------------------------------------------*/ #ifndef TJDUI_APP_LUCKY_CLOVER_VIEW_H #define TJDUI_APP_LUCKY_CLOVER_VIEW_H #include "TjdUiAppLuckyCloverPresenter.h" #include "View.h" #include "components/ui_image_view.h" #include "components/ui_label.h" #include "components/ui_list.h" #include "components/ui_scroll_view.h" #include "components/ui_scroll_view_nested.h" #include "components/ui_slider.h" #include "graphic_timer.h" #include "ui_circle_progress.h" #include "ui_label_ext.h" #include "ui_swipe_view.h" #include "ui_view.h" #include "ui_view_group.h" #include #define STEP_PROGRESS_NUM 18 namespace TJD { enum LuckyCloverFgIndex { IMG_STAND_FG_INDEX = 0, IMG_KCAL_FG_INDEX, IMG_STRENGTH_FG_INDEX, IMG_STEP_FG_INDEX, }; class TjdUiAppLuckyCloverPresenter; class StandProgress : public OHOS::UIViewGroup { public: StandProgress(OHOS::ImageInfo *image); virtual ~StandProgress() { RemoveAll(); } void SetSrcImage(OHOS::ImageInfo *foregroundImage, OHOS::ImageInfo *backgroundImage); void SetProgress(uint32_t currentValue, uint32_t totalValue); private: OHOS::UIImageView image_[STEP_PROGRESS_NUM]; OHOS::ImageInfo *foregroundImage_{nullptr}; OHOS::ImageInfo *backgroundImage_{nullptr}; }; class LuckyCloverUIScrollView : public OHOS::UIScrollViewNested { public: LuckyCloverUIScrollView() {} ~LuckyCloverUIScrollView() {} bool OnDragStartEvent(const OHOS::DragEvent &event) override; bool OnDragEvent(const OHOS::DragEvent &event) override; bool OnDragEndEvent(const OHOS::DragEvent &event) override; private: bool isOnStart_{false}; }; class TjdUiAppLuckyCloverView : public OHOS::View, public OHOS::UIViewGroup { public: TjdUiAppLuckyCloverView(); ~TjdUiAppLuckyCloverView(); static TjdUiAppLuckyCloverView *GetInstance(void); void InitLuckyCloverList(); void OnStart() override; void OnStop() override; OHOS::UIImageView *imageStandBackgroud_ = nullptr; OHOS::UIImageView *imageKcalBackgroud_ = nullptr; OHOS::UIImageView *imageStrengthBackgroud_ = nullptr; OHOS::UIImageView *imageStepBackgroud_ = nullptr; OHOS::UILabelExt *GetDataSynchronizationLabel() { return label1_; }; OHOS::UIImageView *GetImageRefresh() { return image_refresh; }; void DataRefresh(lucky_clover_t lucky_clover_info); OHOS::UIScrollView *allContainer_{nullptr}; OHOS::UIScrollView *dataPage_ = nullptr; OHOS::UIScrollView *mainPage_ = nullptr; private: void LabelRefresh(OHOS::UILabel *label, const char *temp_str); void ForeGroundRefresh(OHOS::UIView *view, uint32_t currentValue, uint32_t totalValue, LuckyCloverFgIndex luckyCloverFgIndex); OHOS::UIViewGroup *BtNoConnectedViewInit(void); OHOS::UIScrollView *MainPageInit(void); OHOS::UIScrollView *DataPageInit(void); OHOS::UISwipeView *swipeContainer_ = nullptr; OHOS::UISwipeView::OnSwipeListener *onSwipeListener_{nullptr}; OHOS::UIView::OnDragListener *OnDragListener_{nullptr}; // BtNoConnectedView_ OHOS::UIViewGroup *BtNoConnectedView_{nullptr}; OHOS::UIImageView *imgNoConnected_{nullptr}; OHOS::UILabelExt *labelNoConnected__{nullptr}; // MainPageInit OHOS::UILabelExt *label1_ = nullptr; OHOS::UILabelExt *label2_ = nullptr; OHOS::UIImageView *image_bg = nullptr; OHOS::UIImageView *imageStandForegroud_ = nullptr; OHOS::UIImageView *imageKcalForegroud_ = nullptr; OHOS::UIImageView *imageStrengthForegroud_ = nullptr; OHOS::UIImageView *imageStepForegroud_ = nullptr; OHOS::UIImageView *image_refresh = nullptr; OHOS::UIImageView *image_stand = nullptr; OHOS::UIImageView *image_kcal = nullptr; OHOS::UIImageView *image_strength = nullptr; OHOS::UIImageView *image_step = nullptr; // DataPageInit StandProgress *standProgress_ = nullptr; OHOS::UIImageView *imageStandCal_ = nullptr; OHOS::UILabelExt *labelActivityStand_ = nullptr; OHOS::UILabel *labelGoalsStand_ = nullptr; OHOS::UILabel *labelCurStand_ = nullptr; OHOS::UIImageView *imageCalCal_ = nullptr; OHOS::UILabelExt *labelActivityCal_ = nullptr; OHOS::UILabelExt *labelGoalsCal = nullptr; OHOS::UIImageView *imageCalProgress_ = nullptr; OHOS::UILabel *labelCurCal_ = nullptr; OHOS::UIImageView *imageStrengthCal_ = nullptr; OHOS::UILabelExt *labelActivityStrength_ = nullptr; OHOS::UILabelExt *labelGoalsStrength_ = nullptr; OHOS::UICircleProgress *ProgressStrength_ = nullptr; OHOS::UILabel *labelCurStrgength_ = nullptr; OHOS::UIImageView *imageStep_ = nullptr; OHOS::UILabelExt *labelActivityStep_ = nullptr; OHOS::UILabelExt *labelGoalsStep_ = nullptr; OHOS::UISlider *sliderStep_ = nullptr; OHOS::UIImageView *imageSliderBg_ = nullptr; OHOS::UILabel *labelCurStep_ = nullptr; OHOS::UIImageView *imageWater_ = nullptr; OHOS::UILabelExt *labelActivityWater_ = nullptr; OHOS::UILabelExt *labelGoalsWater_ = nullptr; OHOS::UIImageView *leftWater_ = nullptr; OHOS::UIImageView *rightWater_ = nullptr; OHOS::UISlider *sliderWater_ = nullptr; OHOS::UILabel *labelCurWater_ = nullptr; OHOS::UIImageView *sleepEarlyIcon_ = nullptr; OHOS::UICircleProgress *ProgressSleepEarly_ = nullptr; OHOS::UILabelExt *labelActivitySleepEarly_ = nullptr; OHOS::UILabelExt *labelGoalsSleepEarly_ = nullptr; OHOS::UIImageView *sleepIcon_ = nullptr; OHOS::UICircleProgress *ProgressSleep_ = nullptr; OHOS::UILabelExt *labelActivitySleep_ = nullptr; OHOS::UILabel *labelSleepGoalsTime_ = nullptr; OHOS::UILabel *labelCurSleepTime_ = nullptr; OHOS::UICircleProgress *progressCustom_ = nullptr; OHOS::UIImageView *customIcon_ = nullptr; OHOS::UILabelExt *labelActivityCustom_ = nullptr; OHOS::UILabelExt *labelGoalsCustom_ = nullptr; OHOS::UILabelExt *labelTips_ = nullptr; }; enum LuckyCloverPopupWindowIndex { POPUP_WINDOW_ENERGETIC_CLOVER = 0, POPUP_WINDOW_PERFECT_CLOVER, POPUP_WINDOW_MAX }; class LuckyCloverPopupWindowListener : public OHOS::UIView::OnClickListener, public OHOS::RootView::OnKeyActListener { public: LuckyCloverPopupWindowListener(){}; ~LuckyCloverPopupWindowListener(){}; bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event); bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event); private: int16_t dragStartX_{0}; int16_t dragCurrentX_{0}; int32_t dragDistance_{0}; }; class LuckyCloverPopupWindow : public OHOS::UIScrollView { public: LuckyCloverPopupWindow(LuckyCloverPopupWindowIndex type); ~LuckyCloverPopupWindow(); private: OHOS::UIImageView imgEnergeticClover_; OHOS::UIImageView imgPerfectClover_; OHOS::UILabel labelEnergeticClover_; OHOS::UILabel labelPerfectClover_; LuckyCloverPopupWindowListener luckyCloverOnclickListener_; }; class LuckyCloverRemindWindow : public OHOS::UIScrollView { public: LuckyCloverRemindWindow(uint16_t curProcess, uint16_t goalProcess, char *goal); ~LuckyCloverRemindWindow(); private: OHOS::UIImageView imgIcon_; OHOS::UILabel labelTarget_; OHOS::UILabel labelProgress_; LuckyCloverPopupWindowListener luckyCloverOnclickListener_; }; class GSensor_RemindWindow : public OHOS::UIScrollView { public: GSensor_RemindWindow(lucky_clover_t lucky_clover_info); ~GSensor_RemindWindow(); private: OHOS::UIImageView imgIcon_; OHOS::UILabel labelTaskProcess_; OHOS::UIImageView imgStand_; OHOS::UILabel labelStand_; OHOS::UILabel labelStandProcess_; OHOS::UIImageView imgCalories_; OHOS::UILabel labelCalories_; OHOS::UILabel labelCaloriesProcess_; OHOS::UIImageView imgStrength_; OHOS::UILabel labelStrength_; OHOS::UILabel labelStrengthProcess_; OHOS::UIImageView imgStep_; OHOS::UILabel labelStep_; OHOS::UILabel labelStepProcess_; StandProgress *standProgress_ = nullptr; //記得釋放內存 OHOS::UIImageView imageStandCal_; OHOS::UILabel labelActivityStand_; OHOS::UILabel labelGoalsStand_; OHOS::UILabel labelCurStand_; OHOS::UIImageView imageCalCal_; OHOS::UILabel labelActivityCal_; OHOS::UILabel labelGoalsCal; OHOS::UIImageView imageCalProgress_; OHOS::UILabel labelCurCal_; OHOS::UIImageView imageStrengthCal_; OHOS::UILabel labelActivityStrength_; OHOS::UILabel labelGoalsStrength_; OHOS::UICircleProgress ProgressStrength_; OHOS::UILabel labelCurStrgength_; OHOS::UIImageView imageStep_; OHOS::UILabel labelActivityStep_; OHOS::UILabel labelGoalsStep_; OHOS::UISlider sliderStep_; OHOS::UIImageView imageSliderBg_; OHOS::UILabel labelCurStep_; }; } // namespace TJD #endif