勿扰模式同步主界面显示
authorCaisking <3449750381@qq.com>
Sat, 27 Apr 2024 11:45:12 +0000 (19:45 +0800)
committerCaisking <3449750381@qq.com>
Sat, 27 Apr 2024 11:45:12 +0000 (19:45 +0800)
code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h
code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp
code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.cpp
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/message/disturbicon.bin [new file with mode: 0644]

index 6548cd8..fb86752 100644 (file)
@@ -29,6 +29,7 @@
 #include "components/ui_card_page.h"
 #include "PullUpDownView.h"
 #include "components/ui_cross_view.h"
+#include "uicomponents/UIComponents.h"
 
 #include "SetCardModel.h"
 #include "heart_blood/include/BloodCardView.h"
@@ -64,6 +65,7 @@ namespace OHOS
         void AnimatorStop(void);
         CardId GetHorCurrentCard() const;
         PullUpDownView *GetPullUpView();
+        void SetDisturbState(bool state); /*控制勿扰状态图标*/
         // UICrossView::VPage GetVerCurrentCard() const;
 
         UIView *GetMainViewGroup(void) const
@@ -104,6 +106,7 @@ namespace OHOS
         Training_CardView *traingView{nullptr};
         ApplistCardView *applistCardView{nullptr};
         UIButton *changebut{nullptr};
+        UIImageView *disturbIcon{nullptr}; // 勿扰图标
         /* -------------------------------------------------------------------------- */
         UICardPage *recordCard[MAX_CARD]{nullptr};
         bool pageStatus[MAX_CARD]{false};
index 1d503e3..b2735f5 100644 (file)
@@ -8,9 +8,11 @@
 #include "MainViewSample.h"
 #include "graphic_service.h"
 #include "dialupdate/include/DialUpdateModel.h"
+#include "uicomponents/UIComponents.h"
 extern DialInfo_1 dialInfo_1[MAX_DIALNUM_1];
 namespace OHOS
 {
+    static constexpr const char *DISTURBICON = "user/res/message/disturbicon.bin";
 
     static MainViewSample *g_pMainView = nullptr;
     static constexpr uint16_t MESLABLE_X_TMP = 177;
@@ -100,6 +102,11 @@ namespace OHOS
             delete MessageLable;
             MessageLable = nullptr;
         }
+        if (disturbIcon != nullptr)
+        {
+            delete disturbIcon;
+            disturbIcon = nullptr;
+        }
         if (compassControlView != nullptr)
         {
             compassControlView->RemoveAll();
@@ -244,7 +251,7 @@ namespace OHOS
 
     void MainViewSample::VerticalViewInit(void)
     {
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::VerticalViewInit");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::VerticalViewInit");
 #ifdef FD230
         dropDownView = new PullUpDownView();
         if (dropDownView == nullptr)
@@ -274,7 +281,6 @@ namespace OHOS
         messageView->SetIntercept(true);
         messageView->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
 #endif
-
     }
 
     PullUpDownView *MainViewSample::GetPullUpView()
@@ -353,6 +359,13 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView new fail");
             return nullptr;
         }
+        /*增加勿扰图标*/
+        InitImageView(disturbIcon, 213, 0, 40, 40, "disturbIcon", DISTURBICON);
+        /*获取勿扰状态*/
+        bool state = ConfigModel::GetInstance()->get_configData_bool(ConfigModel::CONFIGMODEL_ITEM_DNOTDISTURB);
+        PRINT("disturb:state[%d]\r\n", state);
+        disturbIcon->SetVisible(state);
+        mainClockView->Add(disturbIcon);
         return mainClockView;
     }
     // 指南针卡片
index 125e786..7f817d4 100644 (file)
@@ -195,7 +195,7 @@ namespace OHOS
         // imageView->Resize(width, height);
         imageView->SetViewId(viewId);
         imageView->SetSrc(imagePath);
-        imageView->SetVisible(true);
+        // imageView->SetVisible(true);
         // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitImageView is succeed");
         return true;
     }
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/message/disturbicon.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/message/disturbicon.bin
new file mode 100644 (file)
index 0000000..09c8a7f
--- /dev/null
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:52af627cc6aecf638d5f6fd301ce6cfd551f0696fa831ccf79eb055cbd7742a6
+size 1144