配置更换表盘界面,暂未实现功能
authorCaisking <3449750381@qq.com>
Tue, 27 Feb 2024 01:55:09 +0000 (09:55 +0800)
committerCaisking <3449750381@qq.com>
Tue, 27 Feb 2024 01:55:09 +0000 (09:55 +0800)
21 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h
code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h
code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdatePresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdatePresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialDataBase.h
code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelPath.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelPath.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialViewGroup.cpp
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dog.bin
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/KUMI.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/flowerbud.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/left_boutton.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maliao.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maomao.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/momo.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/right_boutton.bin [new file with mode: 0644]

index 95f3aa7..cac577e 100644 (file)
@@ -312,6 +312,9 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rotate/src/RotateView.cpp   
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rotate/src/RotatePresenter.cpp   
 
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/dialupdate/src/DialUpdateView.cpp   
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/dialupdate/src/DialUpdatePresenter.cpp   
+
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phoneservice/src/PhoneService.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phoneservice/src/PhoneAudio.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/offlinevoice/src/VocassistModel.cpp
index 06c135a..bb6c217 100644 (file)
@@ -56,10 +56,11 @@ typedef enum : uint16_t
     VIEW_FAST_TRAINING,           // 快速训练
     VIEW_FAST_TRAINING_ATTENTION, // 快速训练项目选择超出提示
     /* ---------------------------------- 测试界面 ---------------------------------- */
-    VIEW_DIAL,    // 切换表盘
-    VIEW_MESSAGE, // 信息通知
-    VIEW_BLOODO,  // 血氧监测
-    VIEW_ROTATE,  // 模拟表冠
+    VIEW_DIAL,       // 切换表盘
+    VIEW_MESSAGE,    // 信息通知
+    VIEW_BLOODO,     // 血氧监测
+    VIEW_ROTATE,     // 模拟表冠
+    VIEW_DIALUPDATE, // 更新表盘
     /* -------------------------------------------------------------------------- */
     VIEW_MAIN_TEMP,     // 体温界面(暂时不用)
     VIEW_OFFLINEVOICE,  // 语音助手界面(暂时不用)
index 9f54da6..183b4d3 100644 (file)
@@ -51,6 +51,7 @@ namespace OHOS
         void InitRotateSlice(void);
         void InitBloodSlice(void);
         void InitMainAlipaySlice(void);
+        void InitDialUpdateSlice(void);
         /* -------------------------------------------------------------------------- */
         void InitSecondaryFunction(void);
         void InitQuickAccessSlice(void);
index e1fe863..5560ee7 100644 (file)
@@ -85,6 +85,7 @@
 #include "message/include/MessageModel.h"
 #include "message/include/MessagePresenter.h"
 
+
 #include "secondaryfunction/include/SecondaryFunctionPresenter.h"
 #include "secondaryfunction/include/SecondaryFunctionView.h"
 #include "secondaryfunction/include/FastTrainingPresenter.h"
 
 #include "rotate/include/RotateView.h"
 #include "rotate/include/RotatePresenter.h"
+#include "dialupdate/include/DialUpdatePresenter.h"
+#include "dialupdate/include/DialUpdateView.h"
 
 #ifdef SUPPORT_ALIPAY_SEC
 #include "AlipayMainView.h"
@@ -156,6 +159,7 @@ namespace OHOS
 
         {VIEW_MESSAGE, &NativeLauncher::InitMessageSlice},
         {VIEW_ROTATE, &NativeLauncher::InitRotateSlice},
+        {VIEW_DIALUPDATE, &NativeLauncher::InitDialUpdateSlice},
 #ifdef SUPPORT_ALIPAY_SEC
         {VIEW_MAIN_ALIPAY, &NativeLauncher::InitMainAlipaySlice},
 #endif
@@ -601,6 +605,17 @@ namespace OHOS
         }
         NativeAbility::GetInstance().AddSliceProxy(VIEW_ROTATE, rotate);
     }
+    void NativeLauncher::InitDialUpdateSlice(void)    //切换表盘
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitDialUpdateSlice");
+        SliceProxy *dialupdate= new AbilitySliceProxy<DialUpdateView, DialUpdatePresenter>;
+        if (dialupdate == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dialupdate");
+            return;
+        }
+        NativeAbility::GetInstance().AddSliceProxy(VIEW_DIALUPDATE, dialupdate);
+    }
     void NativeLauncher::InitClassicBluetoothSlice(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitClassicBluetoothSlice");
diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdatePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdatePresenter.h
new file mode 100644 (file)
index 0000000..d75e1f4
--- /dev/null
@@ -0,0 +1,43 @@
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-01-17 19:23:30
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-02-20 17:27:36
+ * @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/dial/include/DialUpdatePresenter.h
+ * @Description:
+ * @
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved.
+ */
+#ifndef _DialUpdate_PRESENTER_H
+#define _DialUpdate_PRESENTER_H
+
+#include "Presenter.h"
+#include "DialViewGroup.h"
+#include "dialupdate/include/DialUpdateView.h"
+
+namespace OHOS
+{
+    class DialUpdateView;
+
+    class DialUpdatePresenter : public Presenter<DialUpdateView>,
+                                public UIView::OnClickListener,
+                                public UIView::OnDragListener
+    {
+    public:
+        DialUpdatePresenter();
+        virtual ~DialUpdatePresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+        DialViewGroup *dialGroup_ = nullptr;
+        static DialUpdatePresenter *GetInstance();
+
+    private:
+        bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+    };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateView.h b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateView.h
new file mode 100644 (file)
index 0000000..79722df
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DialUpdate_VIEW_H
+#define _DialUpdate_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include "components/ui_label.h"
+#include "components/ui_label_button.h"
+#include "components/ui_picker.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_swipe_view.h"
+#include "core/render_manager.h"
+#include "graphic_config.h"
+#include "components/ui_image_view.h"
+
+#include "dialupdate/include/DialUpdatePresenter.h"
+
+namespace OHOS
+{
+    class DialUpdatePresenter;
+    class DialUpdateView : public View<DialUpdatePresenter>,
+                           public UIView::OnClickListener,
+                           public UIView::OnDragListener
+    {
+    public:
+        DialUpdateView();
+        ~DialUpdateView();
+        static DialUpdateView *GetInstance(void);
+
+        void OnStart() override;
+        void OnSetUpView() override;
+        void OnTearDownView() override;
+        void OnStop() override;
+
+        void TestPicker();
+        void GetTestView();
+
+    private:
+
+        UIViewGroup *container_ = nullptr;
+        UILabel *label1_ = nullptr;
+        UIImageView *image1_ = nullptr;
+        UIButton *button3_ = nullptr;
+        UIButton *button1_ = nullptr;
+        UIButton *button2_ = nullptr;
+    };
+}
+
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdatePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdatePresenter.cpp
new file mode 100644 (file)
index 0000000..ba7f814
--- /dev/null
@@ -0,0 +1,94 @@
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+#include "DialViewGroup.h"
+#include "dialupdate/include/DialUpdatePresenter.h"
+
+namespace OHOS
+{
+
+    // 当前Presenter属性实例化的内存指针
+    static DialUpdatePresenter *g_pDialUpdatePresenter = nullptr;
+
+    DialUpdatePresenter::DialUpdatePresenter()
+    {
+        g_pDialUpdatePresenter = this;
+    }
+
+    DialUpdatePresenter::~DialUpdatePresenter()
+    {
+
+        g_pDialUpdatePresenter = nullptr;
+    }
+
+    DialUpdatePresenter *DialUpdatePresenter::GetInstance()
+    {
+
+        return g_pDialUpdatePresenter;
+    }
+
+    void DialUpdatePresenter::OnStart()
+    {
+
+        Presenter<DialUpdateView>::OnStart();
+    }
+
+    void DialUpdatePresenter::OnPause(void)
+    {
+
+        Presenter<DialUpdateView>::OnPause();
+    }
+
+    void DialUpdatePresenter::OnResume(void)
+    {
+
+        Presenter<DialUpdateView>::OnResume();
+    }
+
+    void DialUpdatePresenter::OnStop(void)
+    {
+
+        Presenter<DialUpdateView>::OnStop();
+    }
+
+    bool DialUpdatePresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+        if (event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
+        }
+        UNUSED(view);
+        return true;
+    }
+
+    bool DialUpdatePresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+        if (strcmp(view.GetViewId(), "button_choose") == 0)
+        {
+            // std::string filePath = RES_PATH "/dials/KUMI.bin";
+            // dialGroup_->SetDial(filePath);
+             NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
+        }
+        if (strcmp(view.GetViewId(), "flowerbudbutton") == 0)
+        {
+
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
+        }
+        if (strcmp(view.GetViewId(), "maomaobutton") == 0)
+        {
+
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
+        }
+        if (strcmp(view.GetViewId(), "momobutton") == 0)
+        {
+
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
+        }
+        if (strcmp(view.GetViewId(), "maliaobutton") == 0)
+        {
+
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
+        }
+        return true;
+    }
+
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateView.cpp b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateView.cpp
new file mode 100644 (file)
index 0000000..6fbb7fc
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "dialupdate/include/DialUpdateView.h"
+#include "wearable_log.h"
+
+namespace OHOS
+{
+
+    static DialUpdateView *g_pDialUpdateView{nullptr};
+    DialUpdateView::DialUpdateView()
+    {
+        g_pDialUpdateView = this;
+    }
+
+    DialUpdateView::~DialUpdateView()
+    {
+        if (container_ != nullptr)
+        {
+            container_->RemoveAll();
+            delete container_;
+            container_ = nullptr;
+        }
+        if (label1_ != nullptr)
+        {
+            delete label1_;
+            label1_ = nullptr;
+        }
+        if (image1_ != nullptr)
+        {
+            delete image1_;
+            image1_ = nullptr;
+        }
+        if (button3_ != nullptr)
+        {
+            delete button3_;
+            button3_ = nullptr;
+        }
+        if (button1_ != nullptr)
+        {
+            delete button1_;
+            button1_ = nullptr;
+        }
+        if (button2_ != nullptr)
+        {
+            delete button2_;
+            button2_ = nullptr;
+        }
+        g_pDialUpdateView = nullptr;
+    }
+
+    DialUpdateView *DialUpdateView::GetInstance()
+    {
+        return g_pDialUpdateView;
+    }
+
+    void DialUpdateView::GetTestView()
+    {
+        TestPicker();
+    }
+
+    void DialUpdateView::TestPicker()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TestPicker");
+        if (container_ == nullptr)
+        {
+            container_ = new UIViewGroup();
+            container_->SetPosition(0, 0, 466, 466);
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+        }
+
+        // Add Label to App
+        if (label1_ == nullptr)
+        {
+            label1_ = new UILabel();
+        }
+        label1_->SetPosition(181, 50);     // widget's left position and top position
+        label1_->Resize(200, 60);          // widget's width and height
+        label1_->SetViewId("label_title"); // Set style
+        label1_->SetStyle(STYLE_TEXT_FONT, 26);
+
+        // Set additional property
+        label1_->SetText("经典表盘");
+        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        label1_->SetRollSpeed(0);
+        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);
+
+        // Add to rootView
+        container_->Add(label1_);
+        label1_->SetVisible(true);
+
+        // Add ImageView to App
+        if (image1_ == nullptr)
+        {
+            image1_ = new UIImageView();
+        }
+        image1_->SetPosition(103, 103); // widget's left position and top position
+        image1_->Resize(100, 100);      // widget's width and height
+        image1_->SetViewId("image1");   // Set style
+
+        // Set additional property
+        char *image1imagesPath = "/user/res/dialupdate/KUMI.bin";
+
+        image1_->SetSrc(image1imagesPath);
+
+        // Add to rootView
+        container_->Add(image1_);
+        image1_->SetVisible(true);
+
+        // Add Button to App
+        if (button3_ == nullptr)
+        {
+            button3_ = new UIButton();
+        }
+        button3_->SetPosition(103, 103);      // widget's left position and top position
+        button3_->Resize(260, 260);           // widget's width and height
+        button3_->SetViewId("button_choose"); // Set style
+        button3_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+        button3_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+
+        // Set additional property
+        button3_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
+        button3_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+        button3_->SetStyleForState(STYLE_BORDER_COLOR, 0xfffafafa, UIButton::PRESSED);
+        button3_->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);
+
+        // Add the CallBack about events
+        UIView::OnClickListener *button3Click = static_cast<UIView::OnClickListener *>(DialUpdatePresenter::GetInstance());
+        button3_->SetOnClickListener(button3Click);
+        // Add to rootView
+        container_->Add(button3_);
+        button3_->SetVisible(true);
+
+        // Add Button to App
+        if (button1_ == nullptr)
+        {
+            button1_ = new UIButton();
+        }
+        button1_->SetPosition(402, 208);     // widget's left position and top position
+        button1_->Resize(23, 50);            // widget's width and height
+        button1_->SetViewId("button_right"); // Set style
+        button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+        button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+
+        // Set additional property
+        char *button1defaultImgSrc = "/user/res/dialupdate/right_boutton.bin";
+
+        char *button1triggeredImgSrc = nullptr;
+        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+        button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+        // Add the CallBack about events
+        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(DialUpdatePresenter::GetInstance());
+        button1_->SetOnClickListener(button1Click);
+        // Add to rootView
+        container_->Add(button1_);
+        button1_->SetVisible(true);
+
+        // Add Button to App
+        if (button2_ == nullptr)
+        {
+            button2_ = new UIButton();
+        }
+        button2_->SetPosition(40, 208);     // widget's left position and top position
+        button2_->Resize(23, 50);           // widget's width and height
+        button2_->SetViewId("button_left"); // Set style
+        button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+        button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+
+        // Set additional property
+        char *button2defaultImgSrc = "/user/res/dialupdate/left_boutton.bin";
+
+        char *button2triggeredImgSrc = nullptr;
+        button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc);
+        button2_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+        // Add the CallBack about events
+        UIView::OnClickListener *button2Click = static_cast<UIView::OnClickListener *>(DialUpdatePresenter::GetInstance());
+        button2_->SetOnClickListener(button2Click);
+        // Add to rootView
+        container_->Add(button2_);
+        button2_->SetVisible(true);
+    }
+
+    void DialUpdateView::OnStart()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialUpdateView");
+        View<DialUpdatePresenter>::OnStart();
+        BaseView::RootView(Color::Red().full);
+
+        container_ = new UIViewGroup();
+        container_->SetPosition(0, 0);
+        container_->SetWidth(Screen::GetInstance().GetWidth());
+        container_->SetHeight(Screen::GetInstance().GetHeight());
+
+        // 创建 draglistener 实例并设置为拖动监听器
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(DialUpdatePresenter::GetInstance());
+        if (draglistener == nullptr)
+        {
+            return;
+        }
+        container_->SetOnDragListener(draglistener);
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+        GetTestView();
+        RootView::GetInstance()->Add(container_);
+    }
+    void DialUpdateView::OnSetUpView()
+    {
+        View<DialUpdatePresenter>::OnSetUpView();
+        Draw();
+    }
+    void DialUpdateView::OnTearDownView()
+    {
+        View<DialUpdatePresenter>::OnTearDownView();
+        return;
+    }
+
+    void DialUpdateView::OnStop()
+    {
+        View<DialUpdatePresenter>::OnStop();
+        RootView::GetInstance()->RemoveAll();
+        return;
+    }
+}
index c2a3e40..4ff6081 100644 (file)
@@ -32,6 +32,7 @@ enum class DialDataType
     DATA_TYPE_TIME_MONTH,     // 月份
     DATA_TYPE_TIME_YEAR,      // 年份
     DATA_TYPE_CHARGE,         // 充电状态
+    DATA_TYPE_DIALPATH,       // 表盘路径
 
     DATA_TYPE_MULTI_FLOAT_BASE = 0x2fff, // 多个浮点数据类型基值
 
diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelPath.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelPath.h
new file mode 100644 (file)
index 0000000..0291902
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef DIAL_MODEL_PATH_H
+#define DIAL_MODEL_PATH_H
+
+#include "DialBaseModel.h"
+#include <cstdint>
+#include <string>
+
+namespace OHOS
+{
+    class DialModelPath : public DialBaseModel
+    {
+    public:
+        DialModelPath() {}
+        virtual ~DialModelPath() {}
+        static DialModelPath *GetInstance()
+        {
+            static DialModelPath instance;
+            return &instance;
+        }
+        bool GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum) override;
+        void UpdatePath(const std::string *&DialPath);
+
+    private:
+        std::string DialPath_ = "/user/res/dials/dog.bin";
+    };
+}
+#endif
\ No newline at end of file
index 6cf9fe6..d5cbad4 100644 (file)
@@ -178,7 +178,7 @@ namespace OHOS
         mainSwipeGroup->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
         mainSwipeGroup->SetAnimatorTime(50); // 50: animator drag time(ms);
         mainSwipeGroup->SetLoopState(true);
-        mainSwipeGroup->EnableScreenCap(true);//屏幕截图展示,取消使用实时绘制
+        mainSwipeGroup->EnableScreenCap(true); // 屏幕截图展示,取消使用实时绘制
         mainSwipeGroup->RegisterSwipeCallback(callback);
         SwitchToClockPage();
         SetContainerView(mainSwipeGroup);
@@ -335,6 +335,12 @@ namespace OHOS
         if (filePath.size() == 0)
         {
             filePath = RES_PATH "/dials/dog.bin";
+
+#if 0
+            const std::string *dialPathPtr = new std::string("example_path"); // 创建指向const std::string的指针
+            DialModelPath::GetInstance()->UpdatePath(dialPathPtr);                            // 调用UpdatePath函数并传递参数
+            delete dialPathPtr; // 释放内存
+#endif
         }
         mainClockView->SetDial(filePath);
 #else
diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelPath.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelPath.cpp
new file mode 100644 (file)
index 0000000..f8d70c0
--- /dev/null
@@ -0,0 +1,24 @@
+#include "RegisterDialModel.h"
+#include "DialModelPath.h"
+#include <string>
+
+REGIST_DIAL_MODULE(DialDataType::DATA_TYPE_DIALPATH, OHOS::DialModelPath::GetInstance());
+
+namespace OHOS
+{
+    bool DialModelPath::GetDialTextData(DialDataType &type, std::string *&out, int16_t &strNum)
+    {
+        (void)type;
+        out = &DialPath_;
+        return true;
+    }
+
+    void DialModelPath::UpdatePath(const std::string *&DialPath)
+    {
+        DialPath_ = *DialPath;
+        if (onChangeListener_ != nullptr)
+        {
+            onChangeListener_->OnDialTextDataUpdate(DialDataType::DATA_TYPE_HEART_RATE, &DialPath_, 0);
+        }
+    }
+}
index 1b022d7..95eafc8 100644 (file)
@@ -238,6 +238,7 @@ bool DialViewGroup::OnClickEvent(const ClickEvent& event)
         DialClick dialClick = node->data_;
         if (dialClick.area.IsContains(point)) {
             if (dialClick.isSliceType) {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClickEvent %d", dialClick.sliceId);
                 NativeAbility::GetInstance().ChangeSlice(dialClick.sliceId);
             } else {
 #ifdef JS_ENABLE
index 95b37cd..ffefc97 100644 (file)
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dog.bin and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dog.bin differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/KUMI.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/KUMI.bin
new file mode 100644 (file)
index 0000000..df8ecd7
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/KUMI.bin differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/flowerbud.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/flowerbud.bin
new file mode 100644 (file)
index 0000000..463c237
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/flowerbud.bin differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/left_boutton.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/left_boutton.bin
new file mode 100644 (file)
index 0000000..2714100
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/left_boutton.bin differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maliao.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maliao.bin
new file mode 100644 (file)
index 0000000..3c2ba11
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maliao.bin differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maomao.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maomao.bin
new file mode 100644 (file)
index 0000000..170542c
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maomao.bin differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/momo.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/momo.bin
new file mode 100644 (file)
index 0000000..f84214c
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/momo.bin differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/right_boutton.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/right_boutton.bin
new file mode 100644 (file)
index 0000000..20e8fdb
Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/right_boutton.bin differ