勿扰模式视图修改,注释开机加载CLOCK_IAMGES
authorluozheng <1732036298@qq.com>
Sat, 29 Jun 2024 09:22:34 +0000 (17:22 +0800)
committerluozheng <1732036298@qq.com>
Sat, 29 Jun 2024 09:22:34 +0000 (17:22 +0800)
code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h
code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp
code/sdk/application/wearable/fd230app/nativeui/screensetting/src/ScreenModels.cpp

index 2fdaf4b..80db09b 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-10 11:58:15
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 18:46:54
+ * @LastEditTime: 2024-06-29 16:04:53
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h
  */
 #ifndef DNOTDISTURB_VIEW_H
@@ -41,9 +41,8 @@ namespace OHOS
         void ClearAll(void);
         UIScrollView *scrollView = nullptr;
         UILabelExt *showTitleLabel{nullptr}; 
-        UIImageView *background{nullptr};
         UIImageView *DnotDisturbImage{nullptr};
-        UILabel *AttentionLabel{nullptr};
+        UILabelExt *AttentionLabel{nullptr};
         UILabelButtonExt *ButtonOn;
         UILabelButtonExt *ButtonOff;
     };
index 0599c15..03ce7a7 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-10 11:58:21
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 18:51:22
+ * @LastEditTime: 2024-06-29 16:30:35
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp
  */
 #include "dnotdisturb/include/DnotDisturbView.h"
@@ -16,6 +16,7 @@
 namespace OHOS
 {
 
+    static constexpr const char *DROPDOWN_DNOTDISTURB_IMAGE = "/user/res/dropdown/DROPDOWN_DNOTDISTURB.bin";
     static DnotDisturbView *g_pDnotDisturbView{nullptr};
 
     DnotDisturbView::DnotDisturbView()
@@ -27,7 +28,6 @@ namespace OHOS
     DnotDisturbView::~DnotDisturbView()
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::~DnotDisturbView");
-        ClearAll();
         g_pDnotDisturbView = nullptr;
     }
 
@@ -48,12 +48,6 @@ namespace OHOS
                 showTitleLabel = nullptr;
             }
 
-            if (background != nullptr)
-            {
-                delete background;
-                background = nullptr;
-            }
-
             if (DnotDisturbImage != nullptr)
             {
                 delete DnotDisturbImage;
@@ -82,7 +76,7 @@ namespace OHOS
 
     void DnotDisturbView::DnotDisturbViewInit(void)
     {
-
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::DnotDisturbViewInit");
         if (scrollView == nullptr)
         {
             scrollView = new UIScrollView();
@@ -117,27 +111,22 @@ namespace OHOS
             showTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
             showTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
             /* -------------------------------------------------------------------------- */
-            background = new UIImageView();
-            if (background == nullptr)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::background new fail!!");
-                return;
-            }
-            background->SetPosition(186, 116);
-            ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, background, DROPDOWN_ICONELLIPSEPURPLE);
-            /* -------------------------------------------------------------------------- */
             DnotDisturbImage = new UIImageView();
             if (DnotDisturbImage == nullptr)
             {
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::DnotDisturbImage new fail!!");
                 return;
             }
-            DnotDisturbImage->SetPosition(186, 116, 94, 94);
+            DnotDisturbImage->SetPosition(186, 110);
+            DnotDisturbImage->Resize(94, 94);
+            DnotDisturbImage->SetStyle(STYLE_BACKGROUND_COLOR, 0xff8120e2);
+            DnotDisturbImage->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            DnotDisturbImage->SetStyle(STYLE_BORDER_RADIUS, 100);
             DnotDisturbImage->SetAutoEnable(false);
             DnotDisturbImage->SetResizeMode(UIImageView::CENTER);
-            ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, DnotDisturbImage, DROPDOWN_DNOTDISTURB);
+            DnotDisturbImage->SetSrc(DROPDOWN_DNOTDISTURB_IMAGE);
             /* -------------------------------------------------------------------------- */
-            AttentionLabel = new UILabel();
+            AttentionLabel = new UILabelExt();
             if (AttentionLabel == nullptr)
             {
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::AttentionLabel new fail!!");
@@ -146,8 +135,7 @@ namespace OHOS
             AttentionLabel->SetPosition(33, 228, 400, 70);
             AttentionLabel->SetStyle(STYLE_TEXT_FONT, 30);
             AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
-            // AttentionLabel->SetText("开启勿扰模式,手表将不会发出震动与铃声,是否开启");
-            SetLabelId(AttentionLabel, STR_DO_NOT_DISTURB_MODE);
+            AttentionLabel->SetTextId(STR_DO_NOT_DISTURB_MODE); // 开启勿扰模式,手表将不会发出震动与铃声,是否开启
             AttentionLabel->SetLineBreakMode(UILabelExt::LINE_BREAK_WRAP);
             AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
             AttentionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
@@ -233,7 +221,6 @@ namespace OHOS
     {
         View<DnotDisturbPresenter>::OnSetUpView();
         scrollView->Add(showTitleLabel);
-        scrollView->Add(background);
         scrollView->Add(DnotDisturbImage);
         scrollView->Add(AttentionLabel);
         scrollView->Add(ButtonOn);
@@ -256,6 +243,7 @@ namespace OHOS
         View<DnotDisturbPresenter>::OnStop();
         RootView::GetInstance()->RemoveAll();
         RootView::GetInstance()->ClearOnKeyActListener();
+        ClearAll();
         return;
     }
 }
\ No newline at end of file
index 6b26e38..5887f6d 100644 (file)
@@ -73,7 +73,7 @@ bool ScreenModels::LoadAppImages(std::string file, UIImageView *view, uint32_t r
 void ScreenModels::PreLoadAppimages(void)
 {
     LoadAppMultiImages(PLAYER_IAMGES, PLAYER_BACKGROUND, PLAYER_PLAYING);
-    LoadAppMultiImages(CLOCK_IAMGES, CLOCK_CLOCK0, CLOCK_SECOND);
+    //LoadAppMultiImages(CLOCK_IAMGES, CLOCK_CLOCK0, CLOCK_SECOND);
     LoadAppMultiImages(COMPASS_IAMGES, COMPASS_COMPASS0, COMPASS_COMPASS2);
     LoadAppMultiImages(DROPDOWN_IAMGES, DROPDOWN_BLUETOOTHCONNECTED, DROPDOWN_SETTING);
     LoadAppMultiImages(HEART_IAMGES, HEART_HEARTRATECOOR, HEART_HEARTRATE_TOP);