59 lines
2.2 KiB
C++
59 lines
2.2 KiB
C++
#ifndef TJDUIAPP_WEATHER_PRESENTER_H
|
|
#define TJDUIAPP_WEATHER_PRESENTER_H
|
|
|
|
#include "Presenter.h"
|
|
#include "TjdUiAppWeatherModel.h"
|
|
#include "TjdUiScreenDrag.h"
|
|
#include "components/root_view.h"
|
|
#include "ui_swipe_view.h"
|
|
|
|
namespace TJD {
|
|
|
|
class TjdUiAppWeatherView;
|
|
class TjdUiAppWeatherPresenter : public OHOS::Presenter<TjdUiAppWeatherView>,
|
|
public TjdUiScreenDragListener,
|
|
public OHOS::UISwipeView::OnSwipeListener,
|
|
public OHOS::RootView::OnKeyActListener
|
|
{
|
|
public:
|
|
TjdUiAppWeatherPresenter();
|
|
virtual ~TjdUiAppWeatherPresenter();
|
|
static TjdUiAppWeatherPresenter *GetInstance(void);
|
|
void OnStart() override;
|
|
void OnResume() override;
|
|
void OnPause() override;
|
|
void OnStop() override;
|
|
void OnSwipe(OHOS::UISwipeView &view) override;
|
|
bool OnDragStart(OHOS::UIView &view, const OHOS::DragEvent &event) override;
|
|
bool OnDrag(OHOS::UIView &view, const OHOS::DragEvent &event) override;
|
|
bool OnDragEnd(OHOS::UIView &view, const OHOS::DragEvent &event) override;
|
|
bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override;
|
|
void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) override { ExitWeatherView(); }
|
|
|
|
void UpdateViewInfo(void);
|
|
TjdUiAppWeatherModel *GetWeatherModel(void) { return model; }
|
|
uint32_t GetCurTimeIndex(void);
|
|
OHOS::Point GetPointOnSemicircle(int16_t index, int16_t center_x = 233, int16_t center_y = 305,
|
|
int16_t radius = 185);
|
|
void SetCurWeather(WeatherType type) { curWeather = type; }
|
|
WeatherType GetCurWeather(void) { return curWeather; }
|
|
uint8_t GetCurSwipePage(void) { return curSwipePage_; }
|
|
|
|
uint8_t validWeatherLen = 0;
|
|
PreWeekWeather preWeekWeather[7];
|
|
|
|
private:
|
|
void ExitWeatherView(void);
|
|
|
|
TjdUiAppWeatherModel *model{nullptr};
|
|
bool isExit_{false};
|
|
int16_t dragStartX_{0};
|
|
int16_t dragCurrentX_{0};
|
|
int32_t dragDistance_{0};
|
|
WeatherType curWeather = UNKNOW_WEATHER;
|
|
uint8_t curSwipePage_ = 0;
|
|
};
|
|
|
|
} // namespace TJD
|
|
|
|
#endif |