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

208 lines
5.5 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2025. All rights reserved.
*
* Description: TjdUiAppSettingListItemView.h
*
* Author: luziquan@ss-tjd.com
*
* Create: 2025-03-31
*--------------------------------------------------------------------------*/
#ifndef TJD_UI_APP_SETTING_LIST_ITEM_VIEW_H
#define TJD_UI_APP_SETTING_LIST_ITEM_VIEW_H
#include "components/tjd_ui_transform_list_group.h"
namespace TJD {
struct NormalItemInfo
{
uint8_t index;
uint16_t name;
OHOS::ImageInfo *imageInfo;
};
struct NoIconItemInfo
{
uint8_t index;
uint16_t name;
};
struct LanguageItemInfo
{
uint8_t index;
std::string name;
};
struct OverTimeItemInfo
{
uint8_t index;
std::string name;
OHOS::ImageInfo *imageInfo;
};
struct PowerSavingItemInfo
{
uint8_t index;
uint16_t name;
bool isSwtich;
};
struct PasswordItemInfo
{
uint8_t index;
uint16_t name;
bool isSwtich;
};
class CommonItemView : public ItemConstructor<NormalItemInfo>
{
public:
CommonItemView(const NormalItemInfo &itemInfo);
virtual ~CommonItemView() { RemoveAll(); }
void RefreshItem(const NormalItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
private:
OHOS::UIImageView icon_;
OHOS::UILabelExt name_;
};
class LanguageItemView : public ItemConstructor<LanguageItemInfo>
{
public:
LanguageItemView(const LanguageItemInfo &itemInfo);
virtual ~LanguageItemView() { RemoveAll(); }
void RefreshItem(const LanguageItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
OHOS::UIImageView *GetSelectIcon() { return &selectIcon_; }
private:
OHOS::UILabel name_;
OHOS::UIImageView selectIcon_;
};
class MotionOverTimeItemView : public ItemConstructor<OverTimeItemInfo>
{
public:
MotionOverTimeItemView(const OverTimeItemInfo &itemInfo);
virtual ~MotionOverTimeItemView() { RemoveAll(); }
void RefreshItem(const OverTimeItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
private:
OHOS::UIImageView icon_;
OHOS::UILabel name_;
OHOS::UIImageView switch_;
OHOS::ImageInfo *selectRes_{nullptr};
OHOS::ImageInfo *unSelectRes_{nullptr};
};
class LeftKeyItemView : public ItemConstructor<NormalItemInfo>
{
public:
LeftKeyItemView(const NormalItemInfo &itemInfo);
virtual ~LeftKeyItemView() { RemoveAll(); }
void RefreshItem(const NormalItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
private:
OHOS::UIImageView icon_;
OHOS::UILabelExt name_;
OHOS::UIImageView switch_;
OHOS::ImageInfo *selectRes_{nullptr};
OHOS::ImageInfo *unSelectRes_{nullptr};
};
class AnimationItemView : public ItemConstructor<NormalItemInfo>
{
public:
AnimationItemView(const NormalItemInfo &itemInfo);
virtual ~AnimationItemView() { RemoveAll(); }
void RefreshItem(const NormalItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
private:
OHOS::UIImageView icon_;
OHOS::UILabelExt name_;
OHOS::UIImageView selectIcon_;
OHOS::ImageInfo *selectRes_{nullptr};
OHOS::ImageInfo *unSelectRes_{nullptr};
};
class WatchfaceMainItemView : public ItemConstructor<NoIconItemInfo>
{
public:
WatchfaceMainItemView(const NoIconItemInfo &itemInfo);
virtual ~WatchfaceMainItemView() { RemoveAll(); }
void RefreshItem(const NoIconItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
private:
OHOS::UILabelExt name_;
};
class WatchfaceMenuItemView : public ItemConstructor<NormalItemInfo>
{
public:
WatchfaceMenuItemView(const NormalItemInfo &itemInfo);
virtual ~WatchfaceMenuItemView() { RemoveAll(); }
void RefreshItem(const NormalItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
private:
OHOS::UIImageView icon_;
OHOS::UILabelExt name_;
OHOS::UIImageView selectIcon_;
OHOS::ImageInfo *selectRes_{nullptr};
OHOS::ImageInfo *unSelectRes_{nullptr};
};
class KeepScreenItemView : public ItemConstructor<NoIconItemInfo>
{
public:
KeepScreenItemView(const NoIconItemInfo &itemInfo);
virtual ~KeepScreenItemView() { RemoveAll(); }
void RefreshItem(const NoIconItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
private:
OHOS::UILabelExt name_;
OHOS::UIImageView selectIcon_;
OHOS::ImageInfo *selectRes_{nullptr};
OHOS::ImageInfo *unSelectRes_{nullptr};
};
class PowerSavingItemView : public ItemConstructor<PowerSavingItemInfo>
{
public:
PowerSavingItemView(const PowerSavingItemInfo &itemInfo);
virtual ~PowerSavingItemView() { RemoveAll(); }
void RefreshItem(const PowerSavingItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
private:
OHOS::UILabelExt name_;
OHOS::UIImageView switch_;
OHOS::ImageInfo *selectRes_{nullptr};
OHOS::ImageInfo *unSelectRes_{nullptr};
};
class PasswordItemView : public ItemConstructor<PasswordItemInfo>
{
public:
PasswordItemView(const PasswordItemInfo &itemInfo);
virtual ~PasswordItemView() { RemoveAll(); }
void RefreshItem(const PasswordItemInfo &itemInfo, int16_t index);
bool OnClickEvent(const OHOS::ClickEvent &event);
private:
OHOS::UILabelExt name_;
OHOS::UIImageView switch_;
OHOS::ImageInfo *selectRes_{nullptr};
OHOS::ImageInfo *unSelectRes_{nullptr};
};
} // namespace TJD
#endif