mcu_hi3321_watch/tjd/ui/app/main/TjdUiAppMainPageShortCut.h
2025-05-31 10:45:15 +08:00

111 lines
4.3 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
*
* Description:
*
* Author: huangshuyi
*
* Create: 2024-4
*--------------------------------------------------------------------------*/
#ifndef TJD_UI_MAIN_SHORTCUT_H
#define TJD_UI_MAIN_SHORTCUT_H
#include "View.h"
#include "components/ui_label.h"
#include "components/root_view.h"
#include "components/ui_view_group.h"
#include "components/ui_image_view.h"
#include "components/ui_scroll_view.h"
#include "graphic_timer.h"
#include "components/ui_card_page.h"
#include <list>
namespace TJD {
enum ShortcutView {
SHORTCUT_NORMAL = 0, //当前处于下拉快捷栏界面
SHORTCUT_EDIT, //当前处于快捷栏编辑界面
SHORTCUT_MAX,
};
class TjdUiAppMainPageShortcut : public OHOS::UICardPage {
public:
static constexpr uint8_t SHORTCUT_EDIT_INDEX = 0;
static constexpr uint8_t SHORTCUT_BRIGHT_SCREEN_INDEX = 1;
static constexpr uint8_t SHORTCUT_BUSINESS_CARD_INDEX = 2;
static constexpr uint8_t SHORTCUT_LOCK_SCREEN_INDEX = 3;
static constexpr uint8_t SHORTCUT_ALIPAY_INDEX = 4;
static constexpr uint8_t SHORTCUT_NOT_DISTURB_INDEX = 5;
static constexpr uint8_t SHORTCUT_POWER_SAVE_INDEX = 6;
static constexpr uint8_t SHORTCUT_CARD_PACKET_INDEX = 7;
static constexpr uint8_t SHORTCUT_FIND_PHONE_INDEX = 8;
static constexpr uint8_t SHORTCUT_SCREEN_SET_INDEX = 9;
static constexpr uint8_t SHORTCUT_WATER_INDEX = 10;
static constexpr uint8_t SHORTCUT_MENU_STYLE_INDEX = 11;
static constexpr uint8_t SHORTCUT_CLOCK_INDEX = 12;
static constexpr uint8_t SHORTCUT_SYSTEM_SET_INDEX = 13;
static constexpr uint8_t SHORTCUT_BLUETOOTH_INDEX = 14;
static constexpr uint8_t SHORTCUT_BRIGHTNESS_SET_INDEX = 15;
static constexpr uint8_t SHORTCUT_FLASHLIGHT_INDEX = 16;
static constexpr uint8_t SHORTCUT_CONFIRM_INDEX = 17;
struct ShortcutItem{
//const TjdUiTextId Textid;
// const char* textId;
const uint16_t textId;
const uint8_t index;
const int iconOpenId;
const int iconCloseId;
};
TjdUiAppMainPageShortcut();
virtual ~TjdUiAppMainPageShortcut();
static TjdUiAppMainPageShortcut *GetInstance(void);
static std::list<uint8_t>& GetShortcutList(void);
static ShortcutItem* GetShortcutItems(void);
static uint8_t GetShortcutItemsCnt(void);
static std::list<uint8_t> & GetShortcutAddList() { return shortcutAddList_; }
bool InitView(void);
void UpdateView(void);
void PreLoad(void) override;
void UnLoad(void) override;
void ScrollBegin(bool isActive) override;
void ScrollEnd(bool isActive) override;
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event);
void DisplayScreenTips(uint8_t status, uint8_t min);
void ResetKeepScreenIcon(void);
void DeleteContainer(void);
void SetEditShortcutViewVisible(bool isVisible);
void ReturnToTop(void);
OHOS::UIScrollView *GetScrollView(void) { return scrollCont; }
static const uint8_t minShortcutNum = 6;
OHOS::UIViewGroup *screenTipViewGroup_{nullptr};
OHOS::GraphicTimer* timerToReturn_{nullptr};
static ShortcutView currentViewIndex_;
void ClearFocus() override;
private:
void CreateShortcutItemView(UIViewGroup *viewGroup, uint8_t index, int16_t itemX, int16_t itemY, UIView::OnClickListener *clickListener);
bool viewiInitStatus{false};
UIViewGroup *container=nullptr;
static std::list<uint8_t>shortcutList;
static std::list<uint8_t>shortcutAddList_;
static ShortcutItem shortcutItems[];
uint8_t FindArrayIndex(uint8_t index);
OHOS::UIImageView *img_bat_level{nullptr};
OHOS::UILabel *label_bat_dig{nullptr};
OHOS::UIImageView *img_ble_status{nullptr};
OHOS::UILabel *label_week{nullptr};
OHOS::UILabel *label_date{nullptr};
OHOS::UIImageView *imgBt_{nullptr};
OHOS::UIImageView *imgBedClock_{nullptr};
OHOS::UIImageView *imgBrightScreen_{nullptr};
OHOS::UIImageView *imgNotDisturb_{nullptr};
OHOS::UIImageView *imgScreenSet_{nullptr};
OHOS::UIScrollView *scrollCont{nullptr};
OHOS::UIViewGroup *viewGroup{nullptr};
OHOS::UIViewGroup *viewGroup1{nullptr};
OHOS::UIViewGroup *viewGroup2{nullptr};
};
} // namespace OHOS
#endif // MAIN_CLOCK_VIEW_H