* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-03-30 09:14:38\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-13 16:18:25\r
+ * @LastEditTime: 2024-04-13 19:10:22\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/FutureWeatherView.h\r
*/\r
#ifndef FUTURE_WEATHER_VIEW_H\r
\r
namespace OHOS\r
{\r
-#define weather_src "/user/res/weather/weather65x65/"\r
- static const char *weather65x65[] =\r
- {\r
- weather_src "weather_sunny.bin", // 晴天\r
- weather_src "weather_clear-cloudy.bin", // 多云\r
- weather_src "weather_rain.bin", // 阵雨\r
- weather_src "weather_thundershower.bin",\r
- weather_src "weather_foggy.bin",\r
- weather_src "weather_unknown.bin",\r
- weather_src "weather_overcast.bin",\r
- weather_src "weather_clear-sunny.bin",\r
- weather_src "weather_duststorm.bin",\r
- weather_src "weather_haze.bin",\r
- weather_src "weather_snow.bin",\r
- weather_src "weather_sunny-cloudy.bin",\r
- };\r
class FutureWeatherView : public AppGroupView\r
{\r
\r
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-08 18:40:20
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-13 18:23:57
+ * @LastEditTime: 2024-04-13 19:12:15
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h
*/
#ifndef WEATHER_MODEL_H
}
#endif /* __cplusplus */
- static constexpr const char *weather130x130[] =
+ #define weather_src "/user/res/weather/weather65x65/"
+ static const char *weather65x65[] =
{
- "/user/res/weather/weather130x130/WEATHER_CLEAR-CLOUDY.bin",
- "/user/res/weather/weather130x130/WEATHER_CLEAR-SUNNY.bin", // 晴
- "/user/res/weather/weather130x130/WEATHER_DUSTSTORM.bin",
- "/user/res/weather/weather130x130/WEATHER_FOGGY.bin",
- "/user/res/weather/weather130x130/WEATHER_HAZE.bin",
- "/user/res/weather/weather130x130/WEATHER_OVERCAST.bin",
- "/user/res/weather/weather130x130/WEATHER_RAIN.bin",
- "/user/res/weather/weather130x130/WEATHER_SNOW.bin",
- "/user/res/weather/weather130x130/WEATHER_SUNNY.bin",
- "/user/res/weather/weather130x130/WEATHER_SUNNY-CLOUNDY.bin",
- "/user/res/weather/weather130x130/WEATHER_THUNDERSHOWER.bin",
- "/user/res/weather/weather130x130/WEATHER_UNKNOWN.bin",
+ weather_src "weather_sunny.bin", // 晴天
+ weather_src "weather_clear-cloudy.bin", // 多云
+ weather_src "weather_rain.bin", // 阵雨
+ weather_src "weather_thundershower.bin",
+ weather_src "weather_foggy.bin",
+ weather_src "weather_unknown.bin",
+ weather_src "weather_overcast.bin",
+ weather_src "weather_clear-sunny.bin",
+ weather_src "weather_duststorm.bin",
+ weather_src "weather_haze.bin",
+ weather_src "weather_snow.bin",
+ weather_src "weather_sunny-cloudy.bin",
};
/* -------------------------------------------------------------------------- */
class WeatherModel
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-01-29 15:37:44\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-12 20:00:56\r
+ * @LastEditTime: 2024-04-13 19:23:06\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/GetWeatherDataErrorView.cpp\r
*/\r
#include "weather/include/GetWeatherDataErrorView.h"\r
return nullptr;\r
}\r
image->SetPosition(168, 127, 130, 130);\r
- const char * ImgSr = "/user/res/weather/weather130x130/WEATHER_UNKNOWN.bin"; //天气数据获取失败\r
+ const char *ImgSr = "/user/res/weather/weather65x65/weather_unknown.bin"; // 天气数据获取失败\r
+ image->SetAutoEnable(false);\r
+ image->SetResizeMode(UIImageView::CONTAIN);\r
image->SetSrc(ImgSr);\r
scrollView->Add(image);\r
/* -------------------------------------------------------------------------- */\r
NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
return true;\r
}\r
- if (strcmp(view.GetViewId(), GETWEATHERDATAERRORVIEW) == 0)\r
+ if (strcmp(view.GetViewId(), GETWEATHERDATAERRORVIEW) == 0 && event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)\r
{\r
NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
}\r
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-01-29 15:37:44\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-13 17:51:01\r
+ * @LastEditTime: 2024-04-13 19:27:19\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherView.cpp\r
*/\r
#include "weather/include/MainWeatherView.h"\r
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-08 18:40:09
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-13 18:00:02
+ * @LastEditTime: 2024-04-13 19:07:14
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp
*/
#include "weather/include/WeatherModel.h"
{
int size = Weather_data_t_now.iconNight;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "iconNight:%d", size);
- return weather130x130[size];
+ return weather65x65[size];
}
// 获取温度
namespace OHOS
{
- /*主天气背景图片*/
+ /*主天气背景图片*/
static constexpr int16_t WEATHER_BACKGROUND_IMAGE_X = 0;
static constexpr int16_t WEATHER_BACKGROUND_IMAGE_Y = 0;
static constexpr int16_t WEATHER_BACKGROUND_IMAGE_W = 466;
/*天气图片*/
static constexpr int16_t WEATHER_IMAGE_X = 77;
static constexpr int16_t WEATHER_IMAGE_Y = 124;
- static constexpr int16_t WEATHER_IMAGE_W = 100;
- static constexpr int16_t WEATHER_IMAGE_H = 100;
+ static constexpr int16_t WEATHER_IMAGE_W = 130;
+ static constexpr int16_t WEATHER_IMAGE_H = 130;
/*当前时间标签*/
static constexpr int16_t CURRENT_TIME_LABEL_X = 133;
return false;
}
showWeatherImage->SetPosition(WEATHER_IMAGE_X, WEATHER_IMAGE_Y, WEATHER_IMAGE_W, WEATHER_IMAGE_W);
+ showWeatherImage->SetAutoEnable(false);
+ showWeatherImage->SetResizeMode(UIImageView::CONTAIN);
showWeatherImage->SetSrc(ImageCacheManager::GetInstance().LoadSingleRes(WeatherImag));
/* -------------------------------------------------------------------------- */
showCurrentTimeLabel = InitLabelExt(CURRENT_TIME_LABEL_X, CURRENT_TIME_LABEL_Y, CURRENT_TIME_LABEL_W, CURRENT_TIME_LABEL_H, "",