From: luozheng <1732036298@qq.com>
Date: Fri, 10 May 2024 03:40:27 +0000 (+0800)
Subject: 1.优化天气显示主界面和applist已经同步显示
X-Git-Tag: release_V1.2.70_20241020_135402~1121^2~4^2~7
X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=682fb23f07263f3008c8baadac21362c940ceace;p=mirrors%2FFD230.git
1.优化天气显示主界面和applist已经同步显示
遗留问题,手机app同步天气数据时候如果当前界面再天气界面,需要先退出界面在进入才能刷新数据。
2.多国语言包更新需要重新下载资源
---
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt
index ec7fcb2a7..e56f97edf 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt
@@ -392,4 +392,30 @@ STR_INSERT_WATCH_SIM_OR_CONNECT_PHONE$Insert watch SIM or connect phone to make
STR_ENABLE_BLUETOOTH_CALL$Enable Bluetooth Call
STR_ENABLE_BLUETOOTH_CALL_NOTE$The solution:\n1. IPhone\nPlease go to the phone \"Settings\" â \"Bluetooth\" list to find\nâKUMI_XXXXâ\nClick and try again\n\n2. Android phones\nPlease go to the phone \"Settings\" â \"Bluetooth\" list to find\nâKUMI_XXXXâ\nClick the icon on the right to enter Bluetooth Settings\nEnable the call and media functions and try again
STR_SIM_CARD_ERROR$SIM Card Error
-STR_CHECK_SIM_CARD_INSERTION$Check if the watchâs SIM card is properly inserted
\ No newline at end of file
+STR_CHECK_SIM_CARD_INSERTION$Check if the watchâs SIM card is properly inserted
+STR_WEATHER_REPORT$Weather report
+STR_ULTRAVIOLET$Ultraviolet
+STR_WIND_SPEED$WindSpeed
+STR_HUMIDITY$Humidity
+STR_NEXT_7_DAYS$Next 7 Days
+STR_GET_WEATHER_ERROR$No weather information was obtained Please go to APP Update
+STR_MUSIC_SOURCE$Music source
+STR_MOBILE_MUSIC$Mobile music
+STR_WATCH_MUSIC$Watch music
+STR_MUSIC_SOURCE$Music source
+STR_MUSIC_LIST$Music list
+STR_BLUETOOTH_CONNECTION_FAILED$Bluetooth connection failed
+STR_SCANNING_BINDING$Scanning binding
+STR_DEVICE_BINDING$Device binding
+STR_DEVICE_BINDING_NOTE$XX wants to connect and bind with you
+STR_EQUIPMENT_UNTYING$Equipment untying
+STR_EQUIPMENT_UNTYING_NOTE$XX would like to unbind you
+STR_DRINK_WATER_REMINDER$Drink water reminder
+STR_DRINK_WATER_REMINDER_NOTE$Time for some water! And stay hydrated (à¹â¢Ìã
â¢Ì)
+STR_SEDENTARY_REMINDER$Sedentary reminder
+STR_SEDENTARY_REMINDER_NOTE$You haven't moved for XX hours. Get up and move.
+STR_SYSTEM_UPGRADING$System upgrading
+STR_NEWDEVICE_BIND_REMIND_NOTE$The current device is already tied to the Iphone 13 pro\n\nContinuing to connect will unbind the Iphone 13 pro and restore the watch to factory Settings (will erase the watch data)\n\nWhether to continue the operation
+STR_TABULAR_DISPLAY$Tabular display
+STR_GRID_DISPLAY$Grid display
+STR_CELLULAR_DISPLAY$Cellular display
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
index 8573f257a..c8c81c5d5 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
@@ -428,4 +428,30 @@ STR_INSERT_WATCH_SIM_OR_CONNECT_PHONE$请æå
¥æè¡¨SIMå¡æè¿æ¥ææºå¹¶ç¡®
STR_ENABLE_BLUETOOTH_CALL$å¼å¯èçéè¯
STR_ENABLE_BLUETOOTH_CALL_NOTE$è§£å³æ¹æ³ï¼\n1.è¹æææº\n请å徿æºâ设置âââèçâå表æ¾å°\nâKUMI_XXXXâ\nå¹¶ç¹å»åéè¯\n\n2.å®åææº\n请å徿æºâ设置âââèçâå表æ¾å°\nâKUMI_XXXXâ\nç¹å»å³ä¾§å¾æ è¿å
¥èç设置\nå¼å¯éè¯ååªä½åè½åéè¯
STR_SIM_CARD_ERROR$Simå¡å¼å¸¸
-STR_CHECK_SIM_CARD_INSERTION$SIM塿¨å·å¼å¸¸ï¼è¯·æ£æ¥æè¡¨SIM塿¯å¦æ£ç¡®æå
¥
\ No newline at end of file
+STR_CHECK_SIM_CARD_INSERTION$SIM塿¨å·å¼å¸¸ï¼è¯·æ£æ¥æè¡¨SIM塿¯å¦æ£ç¡®æå
¥
+STR_WEATHER_REPORT$æ°è±¡æ¥å
+STR_ULTRAVIOLET$ç´«å¤çº¿
+STR_WIND_SPEED$é£é
+STR_HUMIDITY$湿度
+STR_NEXT_7_DAYS$æªæ¥ä¸å¤©
+STR_GET_WEATHER_ERROR$æªè·åå°å¤©æ°ä¿¡æ¯è¯·åå¾APPæ´æ°
+STR_MUSIC_SOURCE$é³ä¹æ¥æº
+STR_MOBILE_MUSIC$ææºé³ä¹
+STR_WATCH_MUSIC$æè¡¨é³ä¹
+STR_MUSIC_SOURCE$é³ä¹æ¥æº
+STR_MUSIC_LIST$é³ä¹å表
+STR_BLUETOOTH_CONNECTION_FAILED$èçè¿æ¥å¤±è´¥
+STR_SCANNING_BINDING$æ«ç ç»å®
+STR_DEVICE_BINDING$设å¤ç»å®
+STR_DEVICE_BINDING_NOTE$XXæ³è¦ä¸ä½ è¿è¡è¿æ¥ç»å®
+STR_EQUIPMENT_UNTYING$设å¤è§£ç»
+STR_EQUIPMENT_UNTYING_NOTE$XX æ³è¦ä¸ä½ è¿è¡è§£ç»
+STR_DRINK_WATER_REMINDER$åæ°´æé
+STR_DRINK_WATER_REMINDER_NOTE$è¯¥åæ°´å¦ï¼è®°å¾ææ¶ä¿ææ°´åå
è¶³(à¹â¢Ìã
â¢Ì)Ùâ§
+STR_SEDENTARY_REMINDER$ä¹
åæé
+STR_SEDENTARY_REMINDER_NOTE$ä½ å·²ç»XXå°æ¶æªæ´»å¨äºï¼ç«èµ·æ¥æ´»å¨ä¸ä¸å§ã
+STR_SYSTEM_UPGRADING$ç³»ç»å级ä¸
+STR_NEWDEVICE_BIND_REMIND_NOTE$å½å设å¤å·²ç»ä¸ XX ç»å®ç»§ç»è¿æ¥æä½ä¼è§£é¤ä¸ XX çç»å®å¹¶å°æè¡¨æ¢å¤åºå设置ï¼ä¼æ¸
空æè¡¨æ°æ®ï¼æ¯å¦ç»§ç»æ¤æä½
+STR_TABULAR_DISPLAY$å表æ¾ç¤º
+STR_GRID_DISPLAY$ç½æ ¼æ¾ç¤º
+STR_CELLULAR_DISPLAY$èçªæ¾ç¤º
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml
index 61eda9752..99f7a0c49 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml
@@ -394,4 +394,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
index 2a085ceaf..b772e48c0 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
@@ -430,4 +430,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang
index ae14358fa..65675412e 100644
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang differ
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang
index 65427ed9d..f5336af95 100644
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang differ
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h b/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
index 9e192532a..47818ab70 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
@@ -397,64 +397,87 @@ enum UIResourceTextId : uint16_t {
STR_ENABLE_BLUETOOTH_CALL_NOTE = 384,
STR_SIM_CARD_ERROR = 385,
STR_CHECK_SIM_CARD_INSERTION = 386,
- STR_RANGE_MILE = 387,
- STR_CLOSE = 388,
- STR_MORE_APP = 389,
- STR_SAVENOTE = 390,
- STR_SAVEBACK = 391,
- STR_SAVEASK = 392,
- STR_BLOOD = 393,
- STR_CHECK = 394,
- STR_CHECKNEW = 395,
- STR_CHECKTIME = 396,
- STR_CHECKLONG = 397,
- STR_CHECKNO = 398,
- STR_CHECKNOTE = 399,
- STR_CHECKON = 400,
- STR_CHECKSTOP = 401,
- STR_CHECKERROR = 402,
- STR_WAERKEEP = 403,
- STR_WEARRE = 404,
- STR_WEARREADY = 405,
- STR_RECHECK = 406,
- STR_CHECKEWARN = 407,
- STR_BLOODSHORT = 408,
- STR_HEARTNOTE = 409,
- STR_KONW = 410,
- STR_EXPLAIN = 411,
- STR_HEARTREST = 412,
- STR_HEARTDATA = 413,
- STR_HEARTTITLE = 414,
- STR_HEARTMAX = 415,
- STR_HEARTMIN = 416,
- STR_TRAINGNO = 417,
- STR_TRAINGGO = 418,
- STR_MESSAGE = 419,
- STR_MESSAGENO = 420,
- STR_DIS = 421,
- STR_DUR = 422,
- STR_STANDUP = 423,
- STR_SLEEPHOUR = 424,
- STR_SLEEPMGOAL = 425,
- STR_REATTIME = 426,
- STR_SLEEPTIME = 427,
- STR_WALKTIME = 428,
- STR_DISTURB = 429,
- STR_DISTURBNOTE = 430,
- STR_MORNNING = 431,
- STR_NOW = 432,
- STR_NAP = 433,
- STR_TACK = 434,
- STR_CLICK = 435,
- STR_TACKNUM = 436,
- STR_MON = 437,
- STR_TUES = 438,
- STR_WEDNES = 439,
- STR_THURS = 440,
- STR_FRI = 441,
- STR_SATUR = 442,
- STR_SUN = 443,
- STR_MAX_ID = 444,
+ STR_WEATHER_REPORT = 387,
+ STR_ULTRAVIOLET = 388,
+ STR_WIND_SPEED = 389,
+ STR_HUMIDITY = 390,
+ STR_NEXT_7_DAYS = 391,
+ STR_GET_WEATHER_ERROR = 392,
+ STR_MUSIC_SOURCE = 393,
+ STR_MOBILE_MUSIC = 394,
+ STR_WATCH_MUSIC = 395,
+ STR_MUSIC_LIST = 396,
+ STR_BLUETOOTH_CONNECTION_FAILED = 397,
+ STR_SCANNING_BINDING = 398,
+ STR_DEVICE_BINDING = 399,
+ STR_DEVICE_BINDING_NOTE = 400,
+ STR_EQUIPMENT_UNTYING = 401,
+ STR_EQUIPMENT_UNTYING_NOTE = 402,
+ STR_DRINK_WATER_REMINDER = 403,
+ STR_DRINK_WATER_REMINDER_NOTE = 404,
+ STR_SEDENTARY_REMINDER = 405,
+ STR_SEDENTARY_REMINDER_NOTE = 406,
+ STR_SYSTEM_UPGRADING = 407,
+ STR_NEWDEVICE_BIND_REMIND_NOTE = 408,
+ STR_TABULAR_DISPLAY = 409,
+ STR_RANGE_MILE = 410,
+ STR_CLOSE = 411,
+ STR_MORE_APP = 412,
+ STR_SAVENOTE = 413,
+ STR_SAVEBACK = 414,
+ STR_SAVEASK = 415,
+ STR_BLOOD = 416,
+ STR_CHECK = 417,
+ STR_CHECKNEW = 418,
+ STR_CHECKTIME = 419,
+ STR_CHECKLONG = 420,
+ STR_CHECKNO = 421,
+ STR_CHECKNOTE = 422,
+ STR_CHECKON = 423,
+ STR_CHECKSTOP = 424,
+ STR_CHECKERROR = 425,
+ STR_WAERKEEP = 426,
+ STR_WEARRE = 427,
+ STR_WEARREADY = 428,
+ STR_RECHECK = 429,
+ STR_CHECKEWARN = 430,
+ STR_BLOODSHORT = 431,
+ STR_HEARTNOTE = 432,
+ STR_KONW = 433,
+ STR_EXPLAIN = 434,
+ STR_HEARTREST = 435,
+ STR_HEARTDATA = 436,
+ STR_HEARTTITLE = 437,
+ STR_HEARTMAX = 438,
+ STR_HEARTMIN = 439,
+ STR_TRAINGNO = 440,
+ STR_TRAINGGO = 441,
+ STR_MESSAGE = 442,
+ STR_MESSAGENO = 443,
+ STR_DIS = 444,
+ STR_DUR = 445,
+ STR_STANDUP = 446,
+ STR_SLEEPHOUR = 447,
+ STR_SLEEPMGOAL = 448,
+ STR_REATTIME = 449,
+ STR_SLEEPTIME = 450,
+ STR_WALKTIME = 451,
+ STR_DISTURB = 452,
+ STR_DISTURBNOTE = 453,
+ STR_MORNNING = 454,
+ STR_NOW = 455,
+ STR_NAP = 456,
+ STR_TACK = 457,
+ STR_CLICK = 458,
+ STR_TACKNUM = 459,
+ STR_MON = 460,
+ STR_TUES = 461,
+ STR_WEDNES = 462,
+ STR_THURS = 463,
+ STR_FRI = 464,
+ STR_SATUR = 465,
+ STR_SUN = 466,
+ STR_MAX_ID = 467,
}; // UIResourceTextId
enum FontLanguageId : uint8_t {
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang
index f7fe8d220..c5b1081d1 100644
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang differ
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/include/FutureWeatherView.h b/code/sdk/application/wearable/fd230app/nativeui/weather/include/FutureWeatherView.h
index eeeaa5011..82c9edeeb 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/include/FutureWeatherView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/include/FutureWeatherView.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-30 09:14:38
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-15 14:24:52
+ * @LastEditTime: 2024-05-10 11:36:50
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/FutureWeatherView.h
*/
#ifndef FUTURE_WEATHER_VIEW_H
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/include/GetWeatherDataErrorView.h b/code/sdk/application/wearable/fd230app/nativeui/weather/include/GetWeatherDataErrorView.h
index a45a17ab8..4f84f2d14 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/include/GetWeatherDataErrorView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/include/GetWeatherDataErrorView.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-30 09:14:38
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-12 16:22:24
+ * @LastEditTime: 2024-05-10 10:49:52
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/GetWeatherDataErrorView.h
*/
#ifndef Get_WEATHER_DATA_ERROR_VIEW_H
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherPresenter.h
index 1950dbd2b..d149d71e5 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherPresenter.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherPresenter.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-01-29 15:37:44
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-13 10:09:34
+ * @LastEditTime: 2024-05-10 10:58:31
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherPresenter.h
*/
#ifndef MAIN_WEATHER_PRESENTER_H
@@ -51,6 +51,7 @@ namespace OHOS
void OnSwipe(UISwipeView &view) override;
WeatherModel *weatherModel{nullptr};
+ bool X_DRAG_FLAG{false};
};
} // namespace OHOS
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherView.h b/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherView.h
index 04c1807f6..1e6064f9f 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherView.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-01-29 15:37:44
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-13 10:04:53
+ * @LastEditTime: 2024-05-10 11:22:41
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/MainWeatherView.h
*/
#ifndef MAIN_WEATHER_VIEW_H
@@ -38,7 +38,9 @@ namespace OHOS
AppGroupView *WeatherViewPageInit(void);
AppGroupView *WeatherReportViewPageInit(void);
AppGroupView *FutureWeatherViewPageInit(void);
+ UIScrollView *WeatherDataErrorViewPageInit(void);
WeatherView *GetWeatherView(void);
+ UIView *GetWeatherPageView(void);
WeatherReportView *GetWeatherReportView(void);
FutureWeatherView *GetFutureWeatherView(void);
@@ -53,11 +55,11 @@ namespace OHOS
WeatherReportView *weatherReportView{nullptr};
FutureWeatherView *futureWeatherView{nullptr};
GetWeatherDataErrorView *getWeatherDataErrorView{nullptr};
+
private:
int16_t maxPage = MAX_WEATHERVIEW;
UISwipeView *weatherSwipeViewList{nullptr}; // å¤©æ°æ»å¨è§å¾å表
AppGroupView *recordCard[MAX_WEATHERVIEW]{nullptr};
- bool pageStatus[MAX_WEATHERVIEW]{false};
AppGroupView *CreatePage(int32_t WeatherPageId);
};
} // namespace OHOS
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h
index b3fa3779d..c9f5a2dd3 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-08 18:40:20
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-16 09:57:34
+ * @LastEditTime: 2024-05-09 15:46:16
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h
*/
#ifndef WEATHER_MODEL_H
@@ -61,6 +61,7 @@ namespace OHOS
}
#endif /* __cplusplus */
+#define DAYS_OF_THE_WEEK 7
#define weather_src "/user/res/weather/weather65x65/"
static const char *weather65x65[] =
{
@@ -102,13 +103,16 @@ namespace OHOS
std::string GetHumidity();
std::string GetWindScale();
std::string GetUVIndex();
- static uint8_t WEATHER_DATA_VALID; // å¤©æ°æ°æ®æ¯å¦ææ
+ /* -------------------------------------------------------------------------- */
+ bool GetWeatherDataIsValid(void);
+ void SetWeatherDataIsValid(bool value);
private:
WeatherModel();
WeatherModel(const WeatherModel &) = delete;
WeatherModel &operator=(const WeatherModel &) = delete;
virtual ~WeatherModel();
- FutureWeather FutureWeatherItem[7];
+ FutureWeather FutureWeatherItem[DAYS_OF_THE_WEEK];
+ bool WEATHER_DATA_VALID{false}; // å¤©æ°æ°æ®æ¯å¦ææ
};
}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h
index 553edbf14..295fe46d2 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-30 09:14:38
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-13 18:01:59
+ * @LastEditTime: 2024-05-09 17:49:13
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h
*/
#ifndef WEATHER_REPORT_VIEW_H
@@ -31,7 +31,8 @@ namespace OHOS
int16_t height;
int16_t fontSize; // åä½å¤§å°
int16_t lineHeigh; // è¡é«
- std::string text; // ææ¬
+ std::string text; // ææ¬
+ uint16_t textId;
uint8_t lineBreakMode; // æè¡æ¨¡å¼ã
};
WeatherReportView();
@@ -49,6 +50,7 @@ namespace OHOS
const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);
void FreeImagePathsArray(const char **imagePaths, const int numImages);
UILabelExt *SetUpLabel(LabelConfig &labelconfig); // 设置æ ç¾
+ UILabelExt *SetUpLabelExt(LabelConfig &labelconfig);
bool WeatherReportViewLabelInit(void);
bool WeatherReportViewImageAnimatorViewInit(void);
UILabelExt *title{nullptr}; // æ é¢
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/FutureWeatherView.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/FutureWeatherView.cpp
index 4076d5bd8..51f24c16d 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/FutureWeatherView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/FutureWeatherView.cpp
@@ -2,13 +2,15 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-01-29 15:37:44
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-15 15:01:52
+ * @LastEditTime: 2024-05-10 11:19:59
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/FutureWeatherView.cpp
*/
#include "weather/include/FutureWeatherView.h"
#include "wearable_log.h"
#include "weather/include/WeatherModel.h"
#include "common/image_cache_manager.h"
+#include "language/font/ui_resource_string.h"
+#include "weather/include/WeatherModel.h"
namespace OHOS
{
@@ -52,8 +54,6 @@ namespace OHOS
bool FutureWeatherView::InitPage(void)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FutureWeatherView::InitPage");
- /* -------------------------------------------------------------------------- */
-
/* -------------------------------------------------------------------------- */
Title = new UILabelExt();
if (Title == nullptr)
@@ -64,10 +64,9 @@ namespace OHOS
Title->SetPosition(93, 52, 280, 47);
Title->SetStyle(STYLE_TEXT_FONT, 30);
Title->SetStyle(STYLE_LINE_HEIGHT, 35);
- Title->SetText("æªæ¥7天");
+ Title->SetTextId(STR_NEXT_7_DAYS);
Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- Title->SetRollSpeed(40);
Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
Add(Title);
/* -------------------------------------------------------------------------- */
@@ -108,6 +107,9 @@ namespace OHOS
}
SetDraggable(true);
SetTouchable(true);
+ /* -------------------------------------------------------------------------- */
+ WeatherModel::GetInstance().InitFutureWeatherItem();
+ /* -------------------------------------------------------------------------- */
return true;
}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/GetWeatherDataErrorView.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/GetWeatherDataErrorView.cpp
index 7a2087494..1e36a452d 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/GetWeatherDataErrorView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/GetWeatherDataErrorView.cpp
@@ -2,12 +2,14 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-01-29 15:37:44
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-13 19:23:06
+ * @LastEditTime: 2024-05-10 10:49:39
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/GetWeatherDataErrorView.cpp
*/
#include "weather/include/GetWeatherDataErrorView.h"
#include "wearable_log.h"
#include "weather/include/MainWeatherPresenter.h"
+#include "language/font/ui_resource_string.h"
+#include "uicomponents/UIComponents.h"
/* 天æ°è·åæ°æ®å¤±è´¥åä¼è°ç¨è¯¥è§å¾*/
namespace OHOS
@@ -46,13 +48,6 @@ namespace OHOS
scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
scrollView->SetViewId(GETWEATHERDATAERRORVIEW);
scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- UIView::OnDragListener *listener = static_cast(MainWeatherPresenter::GetInstance());
- if (listener == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listener is nullptr!!");
- return nullptr;
- }
- scrollView->SetOnDragListener(listener);
/* -------------------------------------------------------------------------- */
image = new UIImageView();
if (image == nullptr)
@@ -74,13 +69,14 @@ namespace OHOS
return nullptr;
}
label->SetPosition(33, 268, 400, 70);
- label->SetStyle(STYLE_TEXT_FONT, 26);
+ label->SetStyle(STYLE_TEXT_FONT, 30);
label->SetStyle(STYLE_LINE_HEIGHT, 35);
- label->SetText("æªè·åå°å¤©æ°ä¿¡æ¯\n请åå¾APPæ´æ°");
+ SetLabelId(label,STR_GET_WEATHER_ERROR);
label->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- label->SetRollSpeed(40);
- label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);
+ label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+
scrollView->Add(label);
}
return scrollView;
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp
index 92415d6bc..a882bd326 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp
@@ -5,6 +5,7 @@
#include "common/key_code.h"
#include
#include
+#include "UiConfig.h"
namespace OHOS
{
@@ -43,35 +44,32 @@ namespace OHOS
void MainWeatherPresenter::OnResume(void)
{
- weatherModel->InitFutureWeatherItem();
Presenter::OnResume();
}
void MainWeatherPresenter::OnStop(void)
{
-
Presenter::OnStop();
}
bool MainWeatherPresenter::OnDrag(UIView &view, const DragEvent &event)
{
UNUSED(view);
- UNUSED(event);
-
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // æå¨è¿ç¨ä¸å¤ææ¯å¦æ¯æ°´å¹³æ»å¨
+ {
+ MainWeatherPresenter::X_DRAG_FLAG = true;
+ }
return true;
}
bool MainWeatherPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " MainWeatherPresenter::OnDragEnd");
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
- {
- NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
- return true;
- }
- if (strcmp(view.GetViewId(), GETWEATHERDATAERRORVIEW) == 0 && event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
+ UNUSED(view);
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MainWeatherPresenter::X_DRAG_FLAG)
{
- NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
+ NativeAbility::GetInstance().Back();
+ X_DRAG_FLAG = false;
}
return true;
}
@@ -94,8 +92,7 @@ namespace OHOS
// 妿æ¯poweré®å°±è¿åä¸ä¸çº§
if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
{
- uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
- NativeAbility::GetInstance().ChangeSlice(preSlice);
+ NativeAbility::GetInstance().Back();
}
return true;
}
@@ -116,6 +113,7 @@ namespace OHOS
if (view.GetCurrentPage() == MAINWEATHERVIEW)
{
view.SetIntercept(false);
+ MainWeatherView::GetInstance()->GetFutureWeatherView()->GetFutureWeatherList()->RefreshList();
}
else
{
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherView.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherView.cpp
index f98918fe7..002044dba 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherView.cpp
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-01-29 15:37:44
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-15 15:06:51
+ * @LastEditTime: 2024-05-10 11:31:08
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherView.cpp
*/
#include "weather/include/MainWeatherView.h"
@@ -93,68 +93,74 @@ namespace OHOS
return weatherSwipeViewList;
}
+ // è·å天æ°é¡µé¢è§å¾
+ UIView *MainWeatherView::GetWeatherPageView()
+ {
+ if (WeatherModel::GetInstance().GetWeatherDataIsValid()) // å¦æå¤©æ°æ°æ®ææ
+ {
+ return dynamic_cast(MainWeatherViewInit());
+ }
+ else
+ {
+ return dynamic_cast(WeatherDataErrorViewPageInit());
+ }
+ return nullptr;
+ }
+
void MainWeatherView::OnStart()
{
View::OnStart();
- if (WeatherModel::WEATHER_DATA_VALID)
+ RootView::GetInstance()->Add(GetWeatherPageView());
+ if (weatherSwipeViewList != nullptr)
{
- MainWeatherViewInit();
- /* -------------------------------------------------------------------------- */
- if (weatherSwipeViewList != nullptr)
+ UIView::OnClickListener *weatherOnClickListener = (UIView::OnClickListener *)OHOS::MainWeatherPresenter::GetInstance();
+ if (weatherOnClickListener == nullptr)
{
- UIView::OnClickListener *weatherOnClickListener = (UIView::OnClickListener *)OHOS::MainWeatherPresenter::GetInstance();
- if (weatherOnClickListener == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnClickListener new fail");
- return;
- }
-
- UIView::OnDragListener *weatherOnDragListener = (UIView::OnDragListener *)OHOS::MainWeatherPresenter::GetInstance();
- if (weatherOnDragListener == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnDragListener new fail");
- return;
- }
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnClickListener new fail");
+ return;
+ }
- UISwipeView::OnSwipeListener *weatherOnSwipeListener = (UISwipeView::OnSwipeListener *)OHOS::MainWeatherPresenter::GetInstance();
- if (weatherOnSwipeListener == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnSwipeListener new fail");
- return;
- }
+ UIView::OnDragListener *weatherOnDragListener = (UIView::OnDragListener *)OHOS::MainWeatherPresenter::GetInstance();
+ if (weatherOnDragListener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnDragListener new fail");
+ return;
+ }
- weatherSwipeViewList->SetOnClickListener(weatherOnClickListener);
- weatherSwipeViewList->SetOnDragListener(weatherOnDragListener);
- weatherSwipeViewList->SetOnSwipeListener(weatherOnSwipeListener);
+ UISwipeView::OnSwipeListener *weatherOnSwipeListener = (UISwipeView::OnSwipeListener *)OHOS::MainWeatherPresenter::GetInstance();
+ if (weatherOnSwipeListener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnSwipeListener new fail");
+ return;
}
- /* -------------------------------------------------------------------------- */
- RootView::GetInstance()->Add(weatherSwipeViewList);
+ weatherSwipeViewList->SetOnClickListener(weatherOnClickListener);
+ weatherSwipeViewList->SetOnDragListener(weatherOnDragListener);
+ weatherSwipeViewList->SetOnSwipeListener(weatherOnSwipeListener);
}
else
{
- getWeatherDataErrorView = new GetWeatherDataErrorView();
- if (getWeatherDataErrorView == nullptr)
+ UIView::OnDragListener *dragListener = static_cast(MainWeatherPresenter::GetInstance());
+ if (dragListener == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "getWeatherDataErrorView new fail!!");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dragListener is nullptr!!");
return;
}
- RootView::GetInstance()->Add(getWeatherDataErrorView->GetWeatherDataErrorViewInit());
+ getWeatherDataErrorView->GetWeatherDataErrorViewInit()->SetOnDragListener(dragListener);
}
- /* -------------------------------------------------------------------------- */
+ /* --------------------------------- æ·»å æé®çå¬ --------------------------------- */
RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainWeatherPresenter::GetInstance();
RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+ /* -------------------------------------------------------------------------- */
}
void MainWeatherView::OnSetUpView()
{
View::OnSetUpView();
-
Draw();
}
void MainWeatherView::OnTearDownView()
{
-
View::OnTearDownView();
return;
}
@@ -225,6 +231,20 @@ namespace OHOS
return futureWeatherView;
}
+ /*
+ * @brief è·åå¤©æ°æ°æ®å¤±è´¥è§å¾åå§å
+ */
+ UIScrollView *MainWeatherView::WeatherDataErrorViewPageInit(void)
+ {
+ getWeatherDataErrorView = new GetWeatherDataErrorView();
+ if (getWeatherDataErrorView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "getWeatherDataErrorView new fail!!");
+ return nullptr;
+ }
+ return getWeatherDataErrorView->GetWeatherDataErrorViewInit();
+ }
+
struct MainWeatherViewMapper
{
const int16_t viewId;
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherControlView.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherControlView.cpp
index 90743448a..987ba3103 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherControlView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherControlView.cpp
@@ -21,11 +21,17 @@ namespace OHOS
RemoveAll();
if (mainWeatherView != nullptr)
{
- delete weatherOnSwipeListener;
- weatherOnSwipeListener = nullptr;
-
- delete mainWeatherView;
- mainWeatherView = nullptr;
+ if (weatherOnSwipeListener != nullptr)
+ {
+ delete weatherOnSwipeListener;
+ weatherOnSwipeListener = nullptr;
+ }
+
+ if (mainWeatherView != nullptr)
+ {
+ delete mainWeatherView;
+ mainWeatherView = nullptr;
+ }
}
}
}
@@ -39,20 +45,28 @@ namespace OHOS
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WeatherView::new mainweatherView fail!");
return false;
}
- UISwipeView *weatherSwipView = mainWeatherView->MainWeatherViewInit();
- if (weatherSwipView == nullptr)
+
+ if (WeatherModel::GetInstance().GetWeatherDataIsValid())
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "mainWeatherView->MainWeatherViewInit() == nullptr!!");
- return false;
+ UISwipeView *weatherSwipView = dynamic_cast(mainWeatherView->GetWeatherPageView());
+ if (weatherSwipView == nullptr)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "mainWeatherView->MainWeatherViewInit() == nullptr!!");
+ return false;
+ }
+ weatherOnSwipeListener = static_cast(new WeatherControlViewOnSwipeListener());
+ if (weatherOnSwipeListener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnSwipeListener new fail");
+ return false;
+ }
+ weatherSwipView->SetOnSwipeListener(weatherOnSwipeListener);
+ Add(weatherSwipView);
}
- weatherOnSwipeListener = static_cast(new WeatherControlViewOnSwipeListener());
- if (weatherOnSwipeListener == nullptr)
+ else
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnSwipeListener new fail");
- return false;
+ Add(mainWeatherView->GetWeatherPageView());
}
- weatherSwipView->SetOnSwipeListener(weatherOnSwipeListener);
- Add(weatherSwipView);
return true;
}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp
index 72bd30d33..39cfd0b14 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-08 18:40:09
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-18 18:42:24
+ * @LastEditTime: 2024-05-10 11:27:16
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp
*/
#include "weather/include/WeatherModel.h"
@@ -38,7 +38,7 @@ namespace OHOS
Weather_data_t_now.temp = temp;
Weather_data_t_now.iconNight = iconNight;
- WeatherModel::WEATHER_DATA_VALID = 1;
+ WeatherModel::GetInstance().SetWeatherDataIsValid(true);
}
/*
@@ -78,29 +78,13 @@ namespace OHOS
}
}
- void jsonCheck_weather(uint8_t *buf);
#if __cplusplus
}
#endif /* __cplusplus */
- static constexpr const char json_data[] =
- "{\"now\": {\"humidity\":89,\"windScale\":\"2\",\"textNight\":\"å¤äº\",\"uvIndex\":3,\"temp\":24,\"iconNight\":4},"
- "\"address\": {\"lat\":225737664,\"atm\":\"1010\",\"city\":\"æ·±å³\",\"subLocality\":\"å®å®\",\"lon\":1138535138},"
- "\"daily\": [{\"tempMin\":22,\"iconDay\":6,\"fxDate\":1712505600,\"textDay\":\"éµé¨\",\"tempMax\":29},"
- "{\"tempMax\":27,\"textDay\":\"å¤äº\",\"iconDay\":3,\"fxDate\":1712592000,\"tempMin\":22},"
- "{\"tempMax\":29,\"fxDate\":1712678400,\"textDay\":\"å¤äº\",\"iconDay\":3,\"tempMin\":22},"
- "{\"tempMin\":23,\"textDay\":\"å¤äº\",\"fxDate\":1712764800,\"tempMax\":30,\"iconDay\":3},"
- "{\"fxDate\":1712851200,\"textDay\":\"å¤äº\",\"iconDay\":3,\"tempMax\":31,\"tempMin\":24},"
- "{\"fxDate\":1712937600,\"iconDay\":3,\"tempMax\":31,\"tempMin\":24,\"textDay\":\"å¤äº\"},"
- "{\"fxDate\":1713024000,\"textDay\":\"å¤äº\",\"iconDay\":3,\"tempMax\":29,\"tempMin\":25}],"
- "\"code\":1}";
- //static constexpr const char json_data[] = "{\"now\":{\"humidity\":89,\"windScale\":\"2\",\"textNight\":\"å¤äº\",\"uvIndex\":3,\"temp\":24,\"iconNight\":4},\"address\":{\"lat\":225737664,\"atm\":\"1010\",\"city\":\"æ·±å³\",\"subLocality\":\"å®å®\",\"lon\":1138535138},\"daily\":[{\"tempMin\":22,\"iconDay\":6,\"fxDate\":1712505600,\"textDay\":\"éµé¨\",\"tempMax\":29},{\"tempMax\":27,\"textDay\":\"å¤äº\",\"iconDay\":3,\"fxDate\":1712592000,\"tempMin\":22},{\"tempMax\":29,\"fxDate\":1712678400,\"textDay\":\"å¤äº\",\"iconDay\":3,\"tempMin\":22},{\"tempMin\":23,\"textDay\":\"å¤äº\",\"fxDate\":1712764800,\"tempMax\":30,\"iconDay\":3},{\"fxDate\":1712851200,\"textDay\":\"å¤äº\",\"iconDay\":3,\"tempMax\":31,\"tempMin\":24},{\"fxDate\":1712937600,\"iconDay\":3,\"tempMax\":31,\"tempMin\":24,\"textDay\":\"å¤äº\"},{\"fxDate\":1713024000,\"textDay\":\"å¤äº\",\"iconDay\":3,\"tempMax\":29,\"tempMin\":25}],\"code\":1}";
- /* -------------------------------------------------------------------------- */
- uint8_t WeatherModel::WEATHER_DATA_VALID = 0;
WeatherModel::WeatherModel()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WeatherModel::WeatherModel");
- // jsonCheck_weather((uint8_t *)json_data);
}
WeatherModel::~WeatherModel()
@@ -117,20 +101,23 @@ namespace OHOS
void WeatherModel::InitFutureWeatherItem()
{
MainWeatherView *p_MainWeatherView = MainWeatherView::GetInstance();
- for (uint8_t i = 0; i < 7; i++)
+ if (p_MainWeatherView == nullptr)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainWeatherView::GetInstance fail!!");
+ return;
+ }
+ for (uint8_t i = 0; i < DAYS_OF_THE_WEEK; i++)
{
FutureWeatherItem[i].iconDay = GetWeather_data_seven_data_iconDay(i);
FutureWeatherItem[i].fxDate = GetWeather_data_seven_data_fxDate(i);
FutureWeatherItem[i].tempMinAndMax = GetWeather_data_seven_data_tempMinAndtempMax(i);
- // FutureWeatherItem[i].tempMin = GetWeather_data_seven_data_tempMin(i);
- // FutureWeatherItem[i].tempMax = GetWeather_data_seven_data_tempMax(i);
p_MainWeatherView->GetFutureWeatherView()->AddFutureWeatherItemToList(FutureWeatherItem[i]);
}
}
void WeatherModel::TimestampToMonthDayString(time_t timestamp, char *buffer)
{
- // å°æ¶é´æ³è½¬æ¢ætmç»æ
+ // å°æ¶é´æ³è½¬æ¢ætmç»æ
struct tm timeinfo;
localtime_r(×tamp, &timeinfo);
@@ -235,9 +222,9 @@ namespace OHOS
/*è·å湿度*/
std::string WeatherModel::GetHumidity()
{
- int humidity = Weather_data_t_now.humidity;
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "humidity:%d", humidity);
- return std::to_string(humidity);
+ std::string humidity = std::to_string(Weather_data_t_now.humidity) + "%";
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "humidity:%s", humidity.c_str());
+ return humidity;
}
/*è·åé£é*/
@@ -251,8 +238,20 @@ namespace OHOS
/*è·åç´«å¤çº¿ææ°*/
std::string WeatherModel::GetUVIndex()
{
- std::string uvIndex = std::to_string(Weather_data_t_now.uvIndex) + "%";
+ std::string uvIndex = std::to_string(Weather_data_t_now.uvIndex);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uvIndex:%s", uvIndex.c_str());
return uvIndex;
}
+
+ // è®¾ç½®å¤©æ°æ°æ®æ¯å¦ææ
+ void WeatherModel::SetWeatherDataIsValid(bool value)
+ {
+ WEATHER_DATA_VALID = value;
+ }
+
+ // è·åå¤©æ°æ°æ®æ¯å¦ææ
+ bool WeatherModel::GetWeatherDataIsValid()
+ {
+ return WEATHER_DATA_VALID;
+ }
}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp
index 58cf2a37f..a69740923 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp
@@ -103,9 +103,25 @@ namespace OHOS
label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); // ä½ç½®å¤§å°
label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize); // åä½å¤§å°
label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh); // åä½è¡é«
- label->SetText(labelconfig.text.c_str()); // å
容
+ label->SetText(labelconfig.text.c_str()); // å
容
+ label->SetLineBreakMode(labelconfig.lineBreakMode); // æè¡æ¨¡å¼ã
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);
+ return label;
+ }
+
+ UILabelExt *WeatherReportView::SetUpLabelExt(LabelConfig &labelconfig)
+ {
+ UILabelExt *label = new UILabelExt();
+ if (label == nullptr)
+ {
+ return nullptr;
+ }
+ label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); // ä½ç½®å¤§å°
+ label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize); // åä½å¤§å°
+ label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh); // åä½è¡é«
+ label->SetTextId(labelconfig.textId); // å
容
label->SetLineBreakMode(labelconfig.lineBreakMode); // æè¡æ¨¡å¼ã
- label->SetRollSpeed(40);
label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);
return label;
@@ -114,16 +130,17 @@ namespace OHOS
bool WeatherReportView::WeatherReportViewLabelInit(void)
{
LabelConfig labelconfig = {
- .left = 93,
+ .left = 83,
.top = 52,
- .width = 280,
- .height = 47,
+ .width = 300,
+ .height = 35,
.fontSize = 30,
.lineHeigh = 35,
- .text = "æ°è±¡æ¥å",
+ //.text = "æ°è±¡æ¥å",
+ .textId = STR_WEATHER_REPORT,
.lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
};
- title = SetUpLabel(labelconfig);
+ title = SetUpLabelExt(labelconfig);
if (title == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WeatherReportView::title new fail!");
@@ -138,7 +155,7 @@ namespace OHOS
.height = 50,
.fontSize = 40,
.lineHeigh = 50,
- .text = p_WeatherModel->GetHumidity().c_str(),
+ .text = p_WeatherModel->GetUVIndex(), //ç´«å¤çº¿å¼ºåº¦
.lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS,
};
UV_Number = SetUpLabel(labelconfig);
@@ -149,7 +166,7 @@ namespace OHOS
}
labelconfig.left = 173;
- labelconfig.text = p_WeatherModel->GetWindScale();
+ labelconfig.text = p_WeatherModel->GetWindScale();//é£é
WindSpeed_Number = SetUpLabel(labelconfig);
if (WindSpeed_Number == nullptr)
{
@@ -158,7 +175,7 @@ namespace OHOS
}
labelconfig.left = 323;
- labelconfig.text = p_WeatherModel->GetUVIndex();
+ labelconfig.text = p_WeatherModel->GetHumidity().c_str(); //湿度
Humidity_Number = SetUpLabel(labelconfig);
if (Humidity_Number == nullptr)
{
@@ -174,10 +191,11 @@ namespace OHOS
.height = 35,
.fontSize = 26,
.lineHeigh = 35,
- .text = "ç´«å¤çº¿",
+ //.text = "ç´«å¤çº¿",
+ .textId = STR_ULTRAVIOLET,
.lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
};
- UV = SetUpLabel(labelconfig);
+ UV = SetUpLabelExt(labelconfig);
if (UV == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WeatherReportView::UV new fail!");
@@ -186,8 +204,9 @@ namespace OHOS
UV->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
labelconfig.left = 173;
- labelconfig.text = "é£é";
- WindSpeed = SetUpLabel(labelconfig);
+ //labelconfig.text = "é£é";
+ labelconfig.textId = STR_WIND_SPEED;
+ WindSpeed = SetUpLabelExt(labelconfig);
if (WindSpeed == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WeatherReportView::WindSpeed new fail!");
@@ -196,8 +215,9 @@ namespace OHOS
WindSpeed->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
labelconfig.left = 323;
- labelconfig.text = "湿度";
- Humidity = SetUpLabel(labelconfig);
+ //labelconfig.text = "湿度";
+ labelconfig.textId = STR_HUMIDITY;
+ Humidity = SetUpLabelExt(labelconfig);
if (Humidity == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WeatherReportView::Humidity new fail!");
diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherView.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherView.cpp
index 837f6314c..243837eb6 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherView.cpp
@@ -166,7 +166,6 @@ namespace OHOS
label->SetText(text);
label->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- label->SetRollSpeed(40);
label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, textfont);
return label;
}