From d0340ce4b8e586e144b87a262f82cfab79003308 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 7 May 2024 20:13:03 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E7=B3=BB=E7=BB=9F=E6=9B=B4?= =?utf8?q?=E6=96=B0icon=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../language/Language_xml/input_list_en.txt | 1 + .../language/Language_xml/input_list_zh.txt | 1 + .../language/Language_xml/language_en.xml | 1 + .../language/Language_xml/language_zh.xml | 1 + .../fd230app/nativeui/language/font/en.lang | Bin 6105 -> 6120 bytes .../fd230app/nativeui/language/font/ja.lang | Bin 6519 -> 6524 bytes .../language/font/ui_resource_string.h | 17 +-- .../fd230app/nativeui/language/font/zh.lang | Bin 5532 -> 5549 bytes .../settings/include/SettingItemView.h | 7 +- .../nativeui/settings/src/SettingAdapter.cpp | 13 ++- .../nativeui/settings/src/SettingItemView.cpp | 32 +++++- .../nativeui/system/include/SystemView.h | 6 +- .../nativeui/system/src/SystemView.cpp | 30 ++++++ .../systemupdate/include/SystemUpdateView.h | 8 +- .../systemupdate/src/SystemUpdateModel.cpp | 2 +- .../systemupdate/src/SystemUpdateView.cpp | 102 ++++++++++++++++-- .../fd230/fs/user/res/font/en.lang | Bin 6105 -> 6120 bytes .../fd230/fs/user/res/font/ja.lang | Bin 6519 -> 6524 bytes .../fs/user/res/font/ui_resource_string.h | 17 +-- .../fd230/fs/user/res/font/zh.lang | Bin 5532 -> 5549 bytes 20 files changed, 204 insertions(+), 34 deletions(-) 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 63ecdb8d4..1ca2afaa7 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 @@ -312,6 +312,7 @@ STR_FIRMWARE_VERSION$Firmware Version STR_BLUETOOTH_NAME$Bluetooth Name STR_BLUETOOTH_ADDRESS$Bluetooth Address STR_LATEST_VERSION$Latest Version +STR_UPDATENOW$Update Now STR_LATER$Later STR_UP_TO_DATE$The system has been upgraded to the latest version STR_NO_UPDATE$No update 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 0285debbc..1e8f5046a 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 @@ -312,6 +312,7 @@ STR_FIRMWARE_VERSION$固件版本 STR_BLUETOOTH_NAME$蓝牙名称 STR_BLUETOOTH_ADDRESS$蓝牙地址 STR_LATEST_VERSION$最新版本 +STR_UPDATENOW$立即更新 STR_LATER$稍后再说 STR_UP_TO_DATE$当前已升级到最新版本 STR_NO_UPDATE$暂无更新 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 847090c1f..16fa0a6db 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 @@ -313,6 +313,7 @@ + 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 cc595a949..40e2fdef1 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 @@ -313,6 +313,7 @@ + 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 6626452bd585dc5a1dea51c77d679642ea53bf52..dd43c50a21f1f835f14907c9ea67fbb9a474fa02 100644 GIT binary patch delta 76 zcmcbq|3Y8X!?}J(Y90d$aNa2Tkwx;QAOpjDAXXA$V9)_#8z2q^;)2c6tPcgbLJLw7 POHvj5^2;ax7P|)khAk3$ delta 61 zcmaE%e^XzyS=%B!HID%WIBgXD$Rhegkbyy5h=D;7hz)_*3y4!U%dSetItemInfo(itemData); item->SetOnClickListener(itemClickListener); + UIImageView *view = dynamic_cast(item->GetNeedToUpdateImage()); + if (view != nullptr && index == 6) + { + item->GetNeedToUpdateImage()->SetVisible(true); + } + else + { + item->GetNeedToUpdateImage()->SetVisible(false); + } return item; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp index e37684baa..901e69490 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp @@ -2,14 +2,14 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-27 19:48:49 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-24 16:19:53 + * @LastEditTime: 2024-05-07 20:03:34 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp */ #include "wearable_log.h" #include "SettingItemView.h" #include "common/image_cache_manager.h" - +#include "systemupdate/include/SystemUpdateModel.h" namespace OHOS { static constexpr int16_t SETTING_ICON_X = 19; @@ -46,9 +46,10 @@ namespace OHOS SettingItemView::~SettingItemView() { - Remove(&settingLabelButtonExt); - Remove(&settingLabelExt); - Remove(&Icon); + // Remove(&settingLabelButtonExt); + // Remove(&settingLabelExt); + // Remove(&Icon); + RemoveAll(); } void SettingItemView::SetItemInfo(const SettingItem itemInfo) @@ -57,6 +58,11 @@ namespace OHOS Icon.SetSrc(itemInfo.icon); //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d", itemInfo.textId); settingLabelExt.SetTextId(itemInfo.textId); + + if (itemInfo.textId == STR_SYSTEM && SystemUpdateModel::GetInstance().IsLatestVersion() == false) // 如果不是最新系统版本出现小圆点 + { + NeedToUpdateImageinit(); + } } void SettingItemView::SetUpChild() @@ -91,4 +97,20 @@ namespace OHOS { return sItemInfo.index; } + + void SettingItemView::NeedToUpdateImageinit(void) + { + NeedToUpdateImage.SetPosition(280, 40, 20, 20); + NeedToUpdateImage.SetStyle(STYLE_BORDER_RADIUS, 200); + char *imagesPath = "/user/res/system/SYSTEM_UPDATE_FLAG.bin"; + NeedToUpdateImage.SetSrc(imagesPath); + NeedToUpdateImage.SetVisible(false); + + Add(&NeedToUpdateImage); + } + + UIImageView *SettingItemView::GetNeedToUpdateImage(void) + { + return &NeedToUpdateImage; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h index b00cafc60..83d809335 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 18:29:39 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-05-06 20:35:44 + * @LastEditTime: 2024-05-07 18:30:05 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h */ #ifndef SYSTEM_VIEW_H @@ -78,6 +78,7 @@ namespace OHOS void ClearAll(void); bool SetTheSystemScrollView(void); bool SetTheTitle(void); + void NeedToUpdateImageinit(void); UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &ButtonConfig_ext, UIView::OnClickListener *clickListener); SystemAboutTheWatchView *p_SystemAboutTheWatchView{nullptr}; // 关于手表 SystemupgradeView *p_SystemupgradeView{nullptr}; // 系统升级 @@ -86,6 +87,9 @@ namespace OHOS UIScrollView *SystemScrollView[10]{nullptr}; UILabelExt *Title{nullptr}; // 标题 UILabelButtonExt *SystemViewButton[5]{nullptr}; + /* -------------------------------------------------------------------------- */ + UIImageView *NeedToUpdateImage{nullptr}; //提示需要系统更新的icon图片 + /* -------------------------------------------------------------------------- */ }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp index 88384fca8..e5e1e0b17 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp @@ -5,6 +5,7 @@ #include "battery_hal.h" #include "language/font/ui_resource_string.h" extern uint8_t battery_get_voltage(float *voltage); +#include "systemupdate/include/SystemUpdateModel.h" namespace OHOS { @@ -121,6 +122,12 @@ namespace OHOS p_SystemFactoryResetView = nullptr; } + if (NeedToUpdateImage != nullptr) + { + delete NeedToUpdateImage; + NeedToUpdateImage = nullptr; + } + delete SystemScrollView[SYSTEMVIEW]; SystemScrollView[SYSTEMVIEW] = nullptr; } @@ -340,6 +347,25 @@ namespace OHOS return SystemScrollView[ViewId]; } + void SystemView::NeedToUpdateImageinit(void) + { + if (NeedToUpdateImage == nullptr) + { + NeedToUpdateImage = new UIImageView(); + if (NeedToUpdateImage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemView"); + return; + } + NeedToUpdateImage->SetPosition(323, 280, 20, 20); + NeedToUpdateImage->SetStyle(STYLE_BORDER_RADIUS, 200); + char *imagesPath = "/user/res/system/SYSTEM_UPDATE_FLAG.bin"; + NeedToUpdateImage->SetSrc(imagesPath); + + SystemScrollView[SYSTEMVIEW]->Add(NeedToUpdateImage); + } + } + void SystemView::OnStart() { View::OnStart(); @@ -364,6 +390,10 @@ namespace OHOS { SystemScrollView[SYSTEMVIEW]->Add(SystemViewButton[i]); } + if (SystemUpdateModel::GetInstance().IsLatestVersion() == false) // 如果不是最新系统版本出现小圆点 + { + NeedToUpdateImageinit(); + } RootView::GetInstance()->Add(SystemScrollView[SYSTEMVIEW]); Draw(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateView.h b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateView.h index bf1cc7d98..af5307d95 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:27 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-05-07 16:13:06 + * @LastEditTime: 2024-05-07 18:10:03 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateView.h */ @@ -51,6 +51,7 @@ namespace OHOS bool SetSystemUpdateScrollView(void); UILabelExt *InitLabel_Ext(LabelConfig &labelConfig); void SystemUpdateViewInit(void); + void NoNeedUpdateViewInit(void); void ClearAll(void); UIScrollView *SystemUpdateScrollView{nullptr}; @@ -62,6 +63,11 @@ namespace OHOS UILabelExt *TryAgainLaterLabel{nullptr}; // 稍后再试标签 UIButton *UpdateNowButtton{nullptr}; // 立即升级按钮 UIButton *TryAgainLaterButton{nullptr}; // 稍后再试按钮 + /* -------------------------------------------------------------------------- */ + UIScrollView *NoNeedUpdateScrollView{nullptr}; + UILabelExt *NoNeedUpdateTitle{nullptr}; + UILabelExt *NoNeedUpdateNote[2]{nullptr}; + /* -------------------------------------------------------------------------- */ }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateModel.cpp index 2ed512c65..17fed699e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:26:25 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-05-07 16:32:26 + * @LastEditTime: 2024-05-07 18:10:26 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateModel.cpp */ #include "systemupdate/include/SystemUpdateModel.h" diff --git a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateView.cpp b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateView.cpp index 638f51a22..8c6d24773 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-05-07 17:15:10 + * @LastEditTime: 2024-05-07 18:03:07 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateView.cpp */ @@ -69,6 +69,23 @@ namespace OHOS delete SystemUpdateScrollView; SystemUpdateScrollView = nullptr; } + + if (NoNeedUpdateScrollView != nullptr) + { + NoNeedUpdateScrollView->RemoveAll(); + + delete NoNeedUpdateTitle; + NoNeedUpdateTitle = nullptr; + + for (int i = 0; i < 2; i++) + { + delete NoNeedUpdateNote[i]; + NoNeedUpdateNote[i] = nullptr; + } + + delete NoNeedUpdateScrollView; + NoNeedUpdateScrollView = nullptr; + } } UILabelExt *SystemUpdateView::InitLabel_Ext(LabelConfig &labelConfig) @@ -189,7 +206,7 @@ namespace OHOS .height = 35, .fontSize = 30, .lineHeigh = 35, - .textId = STR_LATEST_VERSION, + .textId = STR_UPDATENOW, .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; UpdateNowLabel = InitLabel_Ext(Config); @@ -235,7 +252,7 @@ namespace OHOS TryAgainLaterButton->SetPosition(63, 427, 340, 100); TryAgainLaterButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); TryAgainLaterButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - + TryAgainLaterButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); /* ----------------------------- OnClickListener ---------------------------- */ UIView::OnClickListener *listener = static_cast(SystemUpdatePresenter::GetInstance()); if (listener == nullptr) @@ -251,20 +268,91 @@ namespace OHOS SystemUpdateScrollView->Add(KUMILOGOImage); SystemUpdateScrollView->Add(LatestVersionLabel); SystemUpdateScrollView->Add(VersionIdLabel); - SystemUpdateScrollView->Add(UpdateNowLabel); - SystemUpdateScrollView->Add(TryAgainLaterLabel); SystemUpdateScrollView->Add(UpdateNowButtton); SystemUpdateScrollView->Add(TryAgainLaterButton); + SystemUpdateScrollView->Add(UpdateNowLabel); + SystemUpdateScrollView->Add(TryAgainLaterLabel); RootView::GetInstance()->Add(SystemUpdateScrollView); } + void SystemUpdateView::NoNeedUpdateViewInit(void) + { + if (NoNeedUpdateScrollView == nullptr) + { + NoNeedUpdateScrollView = new UIScrollView(); + if (NoNeedUpdateScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::NoNeedUpdateScrollView new fail!"); + return; + } + NoNeedUpdateScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + NoNeedUpdateScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + NoNeedUpdateScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294); + NoNeedUpdateScrollView->SetScrollBlankSize(35); + NoNeedUpdateScrollView->SetReboundSize(50); + NoNeedUpdateScrollView->SetDirection(1); + UIView::OnDragListener *draglistener = static_cast(SystemUpdatePresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::draglistener can not be nullptr!"); + return; + } + NoNeedUpdateScrollView->SetOnDragListener(draglistener); + NoNeedUpdateScrollView->SetTouchable(true); + NoNeedUpdateScrollView->SetDraggable(true); + } + /* -------------------------------------------------------------------------- */ + LabelConfig Config = { + .left = 83, + .top = 52, + .width = 300, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + //.text = "系统", + .textId = STR_SYSTEM, + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + }; + NoNeedUpdateTitle = InitLabel_Ext(Config); + if (NoNeedUpdateTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::NoNeedUpdateTitle new fail!"); + return; + } + NoNeedUpdateScrollView->Add(NoNeedUpdateTitle); + /* -------------------------------------------------------------------------- */ + for (int i = 0; i < 2; i++) + { + if (NoNeedUpdateNote[i] == nullptr) + { + NoNeedUpdateNote[i] = new UILabelExt(); + if (NoNeedUpdateNote[i] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView:: NoNeedUpdateNote[%d] can not be nullptr!", i); + return; + } + uint16_t textId = i ? STR_UP_TO_DATE : STR_NO_UPDATE; + uint16_t posY = i ? 227 : 262; + NoNeedUpdateNote[i]->SetPosition(33, posY, 400, 35); + NoNeedUpdateNote[i]->SetTextId(textId); + NoNeedUpdateNote[i]->SetStyle(STYLE_TEXT_FONT, 30); + NoNeedUpdateNote[i]->SetStyle(STYLE_LINE_HEIGHT, 35); + NoNeedUpdateNote[i]->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + NoNeedUpdateNote[i]->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + NoNeedUpdateNote[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + } + NoNeedUpdateScrollView->Add(NoNeedUpdateNote[i]); + } + RootView::GetInstance()->Add(NoNeedUpdateScrollView); + } + void SystemUpdateView::OnStart() { View::OnStart(); - if (SystemUpdateModel::GetInstance().IsLatestVersion() == true) //如果是最新版本显示不需要更新界面 + if (SystemUpdateModel::GetInstance().IsLatestVersion() == true) // 如果是最新版本显示不需要更新界面 { - + NoNeedUpdateViewInit(); } else { diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang index 6626452bd585dc5a1dea51c77d679642ea53bf52..dd43c50a21f1f835f14907c9ea67fbb9a474fa02 100644 GIT binary patch delta 76 zcmcbq|3Y8X!?}J(Y90d$aNa2Tkwx;QAOpjDAXXA$V9)_#8z2q^;)2c6tPcgbLJLw7 POHvj5^2;ax7P|)khAk3$ delta 61 zcmaE%e^XzyS=%B!HID%WIBgXD$Rhegkbyy5h=D;7hz)_*3y4!U%d