From: xue <2144439972@qq.com> Date: Tue, 14 Oct 2025 04:08:53 +0000 (+0800) Subject: 优化屏保下载 X-Git-Tag: V1.0.9_20251128_194606_LN~259 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=0555323f834a29b10f3debdfcaff6b6299089319;p=mirrors%2FFD230.git 优化屏保下载 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/include/OtaModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/include/OtaModel.h index 3d8b0efd2..fe2e0c785 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/include/OtaModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/include/OtaModel.h @@ -49,6 +49,7 @@ namespace OHOS int GetBatteryLevel(); bool IsBatteryCharging(); int GetSignalStrength(); + int GetOtaPb(); // OTA操作 int StartOtaUpdate(); @@ -75,6 +76,8 @@ namespace OHOS virtual ~OtaModel(); OtaModel(const OtaModel &) = delete; OtaModel &operator=(const OtaModel &) = delete; + + int Ota_pb; // 屏保下载成功标志 int m_otaStatus; // OTA状态 int m_otaProgress; // OTA进度 diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaDownloadView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaDownloadView.cpp index fa549fec9..2ab1584a5 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaDownloadView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaDownloadView.cpp @@ -48,9 +48,9 @@ namespace OHOS TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); TextLabel->SetPosition(90, 108, 180, 82); - TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); - TextLabel->SetStyle(STYLE_TEXT_COLOR, 0xffffffff); TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + TextLabel->SetStyle(STYLE_TEXT_COLOR, 0xffffffff); + TextLabel->SetText("正在下载\n\n请勿关闭设备"); TextLabel->SetVisible(true); group->Add(TextLabel); } @@ -83,6 +83,18 @@ namespace OHOS group->Add(ProgressLabel); } + RemindLabel = new UILabelExt(); + if (RemindLabel) { + RemindLabel->SetPosition(160, 243, 200, 28); + RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 18); + RemindLabel->SetStyle(STYLE_TEXT_COLOR, 0xffffffff); + + RemindLabel->SetText("预计需要18分钟"); + RemindLabel->SetVisible(true); + group->Add(RemindLabel); + } + return group; } @@ -98,6 +110,7 @@ namespace OHOS if (TextLabel) { delete TextLabel; TextLabel = nullptr; } if (ProgressLabel) { delete ProgressLabel; ProgressLabel = nullptr; } if (ProgressBar) { delete ProgressBar; ProgressBar = nullptr; } + if (RemindLabel) { delete RemindLabel; RemindLabel = nullptr; } } void OtaDownloadView::UpdateDownloadProgress(int progress) @@ -138,13 +151,16 @@ namespace OHOS if (TextLabel) { switch (type) { case 0: // 屏保下载 - TextLabel->SetText("下载屏保中\n请勿关闭设备"); + TextLabel->SetText("下载屏保中\n\n请勿关闭设备"); + ProgressBar->SetVisible(false);//不显示进度条 + RemindLabel->SetVisible(false); + ProgressLabel->SetVisible(false); break; case 1: // 表情下载 - TextLabel->SetText("下载表情中\n请勿关闭设备"); + TextLabel->SetText("下载表情中\n\n请勿关闭设备"); break; default: - TextLabel->SetText("正在下载\n请勿关闭设备"); + TextLabel->SetText("正在下载\n\n请勿关闭设备"); break; } TextLabel->Invalidate(); diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaFailedView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaFailedView.cpp index 4f509ca41..0a15cbed4 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaFailedView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaFailedView.cpp @@ -48,9 +48,9 @@ namespace OHOS // 创建文本标签 TextLabel = new UILabelExt(); if (TextLabel) { - TextLabel->SetPosition(127, 122, 150, 42); + TextLabel->SetPosition(127, 124, 150, 42); TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 24); + TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); TextLabel->SetStyle(STYLE_TEXT_COLOR, 0xffffffff); TextLabel->SetText("更新未完成"); TextLabel->SetVisible(true); diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaModel.cpp index 128f0e644..f0e0e9a91 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaModel.cpp @@ -19,12 +19,12 @@ namespace OHOS { static OtaModel *g_pOtaModel = nullptr; - + OtaModel::OtaModel() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OtaModel::OtaModel"); g_pOtaModel = this; - + Ota_pb = 0; m_otaStatus = 0; m_otaProgress = 0; m_countdownActive = false; @@ -411,14 +411,7 @@ namespace OHOS if(OtaDownloadView::GetInstance()) { OtaView::GetInstance()->ChangeView(OtaView::OTA_VIEW_DOWNLOAD, OtaView::OTA_VIEW_UPDATE_SUCCESS); - if(type == 0) //表情切换 - { - OtaSuccessView::GetInstance()->UpdateDownloadSuccess("屏保下载成功"); - } - else if(type == 1) //屏保切换 - { - OtaSuccessView::GetInstance()->UpdateDownloadSuccess("表情下载成功"); - } + OtaSuccessView::GetInstance()->UpdateDownloadSuccess("下载成功"); } } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaSuccessView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaSuccessView.cpp index 72616976e..00d04305e 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaSuccessView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaSuccessView.cpp @@ -51,9 +51,9 @@ namespace OHOS // 创建文本标签 TextLabel = new UILabelExt(); if (TextLabel) { - TextLabel->SetPosition(127, 122, 164, 42); - TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 24); + TextLabel->SetPosition(140, 125, 164, 42); + TextLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_LEFT); + TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); TextLabel->SetStyle(STYLE_TEXT_COLOR, 0xffffffff); TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); TextLabel->SetText("更新成功"); @@ -63,7 +63,7 @@ namespace OHOS LittleTextLabel = new UILabelExt(); if (LittleTextLabel) { - LittleTextLabel->SetPosition(80, 184, 220, 28); + LittleTextLabel->SetPosition(80, 184, 220, 60); LittleTextLabel->SetText("你的设备已是最新版本"); LittleTextLabel->SetVisible(true); group->Add(LittleTextLabel); @@ -84,7 +84,7 @@ namespace OHOS if (RemindIcon) { RemindIcon->SetAutoEnable(false); - RemindIcon->SetPosition(160, 277, 22, 22); + RemindIcon->SetPosition(159, 276, 22, 22); RemindIcon->SetResizeMode(UIImageView::CONTAIN); RemindIcon->SetSrc("/user/res/volume_up.bin"); RemindIcon->SetVisible(true); @@ -121,9 +121,24 @@ namespace OHOS void OtaSuccessView::UpdateDownloadSuccess(std::string content) { + if(content == "下载失败") + { + RemindIcon1->SetSrc("/user/res/warning.bin"); + RemindIcon->SetVisible(false); + RemindLabel->SetVisible(false); + TextLabel->SetText(content.c_str()); + LittleTextLabel->SetText("请在小程序重新下载\n继续下载失败的文件"); + LittleTextLabel->SetX(98); + TextLabel->Invalidate(); + LittleTextLabel->Invalidate(); + RemindLabel->Invalidate(); + RemindIcon1->Invalidate(); + RemindIcon->Invalidate(); + return; + } TextLabel->SetText(content.c_str()); LittleTextLabel->SetVisible(false); TextLabel->Invalidate(); - + } }