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

59 lines
1.5 KiB
C++

#ifndef TJD_UI_APP_SETTING_ADAPTER_H
#define TJD_UI_APP_SETTING_ADAPTER_H
#include "TjdUiAppSettingPresenter.h"
#include "TjdUiComponentList.h"
#include "components/abstract_adapter.h"
#include "components/tjd_ui_transform_list_group.h"
#include "components/ui_label.h"
#include "components/ui_transform_group.h"
#include "gfx_utils/list.h"
#include "image_info.h"
#include "string"
#include "ui_checkbox.h"
#include <stdio.h>
namespace TJD {
#define IMAGE_BIN_PATH TJD_IMAGE_PATH "img_setting.bin"
class SettingListItemView : public ItemConstructor<SettingCaseInfo>
{
public:
SettingListItemView(const SettingCaseInfo &info);
virtual ~SettingListItemView();
bool OnClickEvent(const OHOS::ClickEvent &event);
bool IsSwitchSelected()
{
if ((switch_.GetImageInfo()->resId) == openRes_->resId)
return true;
return false;
}
void ToggleSwitch()
{
if (switch_.GetImageInfo()->resId == openRes_->resId)
switch_.SetSrc(closeRes_);
else
switch_.SetSrc(openRes_);
switch_.Invalidate();
}
void SetSwitchSelected(bool selected)
{
if (selected)
switch_.SetSrc(openRes_);
else
switch_.SetSrc(closeRes_);
}
void RefreshItem(const SettingCaseInfo &info, int16_t index);
private:
OHOS::ImageInfo *openRes_{nullptr};
OHOS::ImageInfo *closeRes_{nullptr};
OHOS::UIImageView icon_;
OHOS::UILabelExt name_;
OHOS::UIImageView switch_;
};
} // namespace TJD
#endif