安全模式:优化repair界面配置
authorCaisking <3449750381@qq.com>
Thu, 12 Sep 2024 12:21:42 +0000 (20:21 +0800)
committerCaisking <3449750381@qq.com>
Thu, 12 Sep 2024 12:21:42 +0000 (20:21 +0800)
code/sdk/application/wearable/fd230app/nativeui/safemodemanager/include/RepairView.h
code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/RepairView.cpp
code/sdk/application/wearable/fd230app/nativeui/safemodemanager/src/SafeModeManagerModel.cpp

index 4a1aadf..24b1718 100644 (file)
@@ -25,7 +25,7 @@ public:
   void InitLabels(void);
   void InitButtons(void);
   void InitBasicdata(void);
-  void UpdateRepairView(int date);
+  void UpdateView(int date);
 
 private:
   UIScrollView *scrollView_{nullptr};
index 1f13562..2059470 100644 (file)
@@ -67,7 +67,7 @@ void RepairView::InitLabels() {
     signalLabel_->SetPosition(133, 130);
     signalLabel_->Resize(200, 60);
     signalLabel_->SetViewId("signalLabel");
-    signalLabel_->SetText("Signal: 26");
+    signalLabel_->SetText("Signal: --");
     signalLabel_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
     signalLabel_->SetAlign(TEXT_ALIGNMENT_CENTER);
     signalLabel_->SetFont(GILROY_BOLD_FONT,
@@ -84,7 +84,7 @@ void RepairView::InitLabels() {
     operationLabel_->SetPosition(83, 80);
     operationLabel_->Resize(300, 60);
     operationLabel_->SetViewId("operationLabel");
-    operationLabel_->SetText("Operation: CHN_CT");
+    operationLabel_->SetText("Operation: --");
     operationLabel_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
     operationLabel_->SetAlign(TEXT_ALIGNMENT_CENTER);
     operationLabel_->SetFont(GILROY_BOLD_FONT,
@@ -117,7 +117,7 @@ void RepairView::InitLabels() {
     versionLabel_->SetPosition(133, 180);
     versionLabel_->Resize(200, 60);
     versionLabel_->SetViewId("versionLabel");
-    versionLabel_->SetText("Version: 1.1.47");
+    versionLabel_->SetText("Version: --");
     versionLabel_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
     versionLabel_->SetAlign(TEXT_ALIGNMENT_CENTER);
     versionLabel_->SetFont(GILROY_BOLD_FONT,
@@ -196,7 +196,7 @@ UIScrollView *RepairView::RepairViewInit() {
     downLabel_->SetPosition(26, 366);
     downLabel_->Resize(200, 60);
     downLabel_->SetViewId("downLabel");
-    downLabel_->SetText("down: 10");
+    downLabel_->SetText("down: --");
     downLabel_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
     downLabel_->SetAlign(TEXT_ALIGNMENT_CENTER);
     downLabel_->SetFont(GILROY_BOLD_FONT,
@@ -212,7 +212,7 @@ UIScrollView *RepairView::RepairViewInit() {
     totalLabel_->SetPosition(230, 366);
     totalLabel_->Resize(200, 60);
     totalLabel_->SetViewId("totalLabel");
-    totalLabel_->SetText("total: 100");
+    totalLabel_->SetText("total: --");
     totalLabel_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
     totalLabel_->SetAlign(TEXT_ALIGNMENT_CENTER);
     totalLabel_->SetFont(GILROY_BOLD_FONT,
@@ -221,6 +221,9 @@ UIScrollView *RepairView::RepairViewInit() {
     totalLabel_->SetVisible(true);
   }
 
+  // 初始化基本数据
+  InitBasicdata();
+  
   return scrollView_;
 }
 
@@ -229,11 +232,14 @@ void RepairView::InitBasicdata() {
   if (versionLabel_ != nullptr) {
   }
   if (downLabel_ != nullptr) {
+    int totalcount = SafeModeManagerModel::GetInstance()->GetFilenamesCount();
+    std::string total = "total: " + std::to_string(totalcount);
+    totalLabel_->SetText(total.c_str());
   }
 }
 
 //更新信号值与下载进度
-void RepairView::UpdateRepairView(int date) {
+void RepairView::UpdateView(int date) {
   if (downingLabel_ == nullptr) {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
                   "ResourceCheckView::downingLabel_ is null");
index 2cd6d40..87d2421 100644 (file)
@@ -6,6 +6,7 @@
 #include <string>
 #include <vector>
 
+#include "safemodemanager/include/RepairView.h"
 #include "safemodemanager/include/ResourceCheckView.h"
 #include "safemodemanager/include/SafeModeManagerModel.h"
 #include "safemodemanager/include/SafeModeManagerView.h"
@@ -173,5 +174,14 @@ bool SafeModeManagerModel::RepairStart() {
   WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Repair");
   return true;
 }
-
+// 更新文件下载
+void SafeModeManagerModel::UpdateRepairView(int date) {
+  auto safeModeView = SafeModeManagerView::GetInstance();
+  if (safeModeView != nullptr) {
+    auto RepairView = ResourceCheckView::GetInstance();
+    if (safeModeView->GetSafeScrollView(VIEW_RESOURCE_CHECK) != nullptr) {
+      RepairView->UpdateView(date);
+    }
+  }
+}
 } // namespace OHOS
\ No newline at end of file