54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#ifndef TJDUIAPP_WEATHER_ADAPTER_H
|
|
#define TJDUIAPP_WEATHER_ADAPTER_H
|
|
|
|
#include <list>
|
|
#include "ui_label.h"
|
|
#include "ui_view_group.h"
|
|
#include "ui_image_view.h"
|
|
#include "abstract_adapter.h"
|
|
#include "TjdUiAppWeatherModel.h"
|
|
|
|
namespace TJD {
|
|
|
|
const char *select_week(Week weekday);
|
|
|
|
class TjdWeatherItemView : public OHOS::UIViewGroup {
|
|
public:
|
|
explicit TjdWeatherItemView();
|
|
virtual ~TjdWeatherItemView();
|
|
void SetItemInfo(const WeatherItem &itemInfo);
|
|
|
|
void SetUpChild();
|
|
|
|
private:
|
|
TjdWeatherItemView(const TjdWeatherItemView &);
|
|
|
|
OHOS::UIImageView icon_;
|
|
OHOS::UILabel label1_;
|
|
OHOS::UILabel label2_;
|
|
OHOS::UILabel weekLabel_;
|
|
OHOS::UILabel lowTempLabel_;
|
|
OHOS::UILabel highTempLabel_;
|
|
WeatherItem itemInfo_ = { Week::UNKNOW_WEEK, nullptr, 0, 0};
|
|
};
|
|
|
|
|
|
class TjdWeatherAdapter : public OHOS::AbstractAdapter {
|
|
public:
|
|
TjdWeatherAdapter();
|
|
~TjdWeatherAdapter();
|
|
|
|
uint16_t GetCount(void) override;
|
|
OHOS::UIView *GetView(OHOS::UIView *inView, int16_t index) override;
|
|
|
|
void AddListItem(const WeatherItem &item);
|
|
|
|
void ClearItem(void);
|
|
|
|
private:
|
|
std::list<WeatherItem> listData_;
|
|
};
|
|
|
|
}
|
|
|
|
#endif |