1.添加Ai Voice slice 整体框架 ,增加对应多国语言 ,图片资源
authorluozheng <1732036298@qq.com>
Thu, 20 Jun 2024 12:27:21 +0000 (20:27 +0800)
committerluozheng <1732036298@qq.com>
Thu, 20 Jun 2024 12:27:21 +0000 (20:27 +0800)
2.Ability 添加切换slice清除聚焦功能

31 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/include/UiConfig.h
code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp
code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang
code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang
code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/AIRecBlack.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/AIRecGreen.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/AIUnion.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/applist_icon/aivoice.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang

index 5ede29a..880e468 100644 (file)
@@ -376,11 +376,16 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/respiratorytraining/src/RespiratoryTrainingCompletedView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp
 
-    #呼吸训练
+    #显示方式
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/themestyle/src/ThemeStyleModel.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/themestyle/src/ThemeStylePresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/themestyle/src/ThemeStyleView.cpp
 
+    #Ai Voice
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aivoice/src/AiVoiceModel.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aivoice/src/AiVoicePresenter.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aivoice/src/AiVoiceView.cpp
+
     #声音与震动
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
index 502cb95..3ef0123 100644 (file)
@@ -66,6 +66,7 @@ typedef enum : uint16_t
     VIEW_WATCH_QR_CODE,             // 手表二维码
     VIEW_RESPIRATORY_TRAINING,      // 呼吸训练
     VIEW_THEME_STYLE,               // 主题样式
+    VIEW_AI_VOICE,                  // AI Voice(人工智能语音)
 
     /* ----------------------------------- 录音 ----------------------------------- */
     VIEW_RECORD,
index df262f5..99a9b5e 100644 (file)
@@ -62,6 +62,7 @@ namespace OHOS
         void InitWatchQRCodeSlice(void);
         void InitRespiratoryTrainingSlice(void);
         void InitThemeStyleSlice(void);
+        void InitAiVoiceSlice(void);
         /* --------------------------------界面------------------------------------ */
         void InitRotateSlice(void);
         void InitBloodSlice(void);
index faff5e5..90b6f77 100644 (file)
@@ -272,6 +272,7 @@ namespace OHOS
     static constexpr const char *PNG_APPLIST_BREATHE_IMAGE = APP_LIST_PATH "/breathe.bin";          // 呼吸训练
     static constexpr const char *PNG_APPLIST_GOAL_IMAGE = APP_LIST_PATH "/sport.bin";               // 每日目标
     static constexpr const char *PNG_APPLIST_VOICE_IMAGE = APP_LIST_PATH "/voice.bin";              // 声音
+    static constexpr const char *PNG_APPLIST_AIVOICE_IMAGE = APP_LIST_PATH "/aivoice.bin";          // AI Voice(人工智能语音)
 
     /* ---------------------------------- 快速训练 ---------------------------------- */
     static constexpr const char *PNG_TRAING_BOUTTONMORE_IMAGE = APP_RES_PATH "/Training/More.bin";
index 0af4c2d..3b646de 100644 (file)
 
 #include "themestyle/include/ThemeStyleView.h"
 #include "themestyle/include/ThemeStylePresenter.h"
+
+#include "aivoice/include/AiVoicePresenter.h"
+#include "aivoice/include/AiVoiceView.h"
 /* -------------------------------------------------------------------------- */
 #include "traing/include/TraingView.h"
 #include "traing/include/TraingPresenter.h"
@@ -284,6 +287,7 @@ namespace OHOS
         {VIEW_WATCH_QR_CODE, &NativeLauncher::InitWatchQRCodeSlice},                         // 手表二维码界面
         {VIEW_RESPIRATORY_TRAINING, &NativeLauncher::InitRespiratoryTrainingSlice},          // 呼吸训练界面
         {VIEW_THEME_STYLE, &NativeLauncher::InitThemeStyleSlice},                            // 主题样式界面
+        {VIEW_AI_VOICE, &NativeLauncher::InitAiVoiceSlice},                                  //  Ai Voice(人工智能语音)
 
         // {VIEW_SECONDARY_FUNCTION, &NativeLauncher::InitSecondaryFunction},
         // {VIEW_FAST_TRAINING, &NativeLauncher::InitFastTrainingSlice},
@@ -1241,6 +1245,18 @@ namespace OHOS
         }
         NativeAbility::GetInstance().AddSliceProxy(VIEW_THEME_STYLE, ThemeStyle);
     }
+    
+    /*Ai Voice(人工智能语音)*/
+    void NativeLauncher::InitAiVoiceSlice(void)
+    {
+        SliceProxy *AiVoice = new AbilitySliceProxy<AiVoiceView, AiVoicePresenter>;
+        if (AiVoice == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoice");
+            return;
+        }
+        NativeAbility::GetInstance().AddSliceProxy(VIEW_AI_VOICE, AiVoice);
+    }
     /* -------------------------------------------------------------------------- */
     void NativeLauncher::InitSetDesktopSlice(void)
     {
diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h
new file mode 100644 (file)
index 0000000..9c40b54
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-20 15:14:43
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-20 20:13:47
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h
+ */
+#ifndef AI_VOICE_MODEL_H
+#define AI_VOICE_MODEL_H
+
+namespace OHOS
+{
+    class AiVoiceModel
+    {
+    public:
+        static AiVoiceModel &GetInstance(void);
+
+    private:
+        AiVoiceModel();
+        ~AiVoiceModel();
+        AiVoiceModel(const AiVoiceModel &) = delete;
+        AiVoiceModel &operator=(const AiVoiceModel &) = delete;
+    };
+}
+
+#endif 
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h
new file mode 100644 (file)
index 0000000..94b32d2
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-20 14:44:22
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-20 15:25:08
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h
+ */
+#ifndef AI_VOICE_PRESENTER_H
+#define AI_VOICE_PRESENTER_H
+
+#include "Presenter.h"
+#include "View.h"
+
+namespace OHOS
+{
+    class AiVoiceView;
+    class AiVoiceModel;
+    class AiVoicePresenter : public Presenter<AiVoiceView>,
+                             public UIView::OnClickListener,
+                             public UIView::OnDragListener,
+                             public RootView::OnKeyActListener
+    {
+    public:
+        AiVoicePresenter();
+        virtual ~AiVoicePresenter();
+        static AiVoicePresenter *GetInstance();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+
+
+    private:
+        bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+        bool OnDragEnd(UIView &view, const DragEvent &event) override;
+        bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
+
+        AiVoiceModel *model;
+        bool X_DRAG_FLAG{false};
+    };
+}
+
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h
new file mode 100644 (file)
index 0000000..7e23752
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-08 09:36:01
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-20 19:53:13
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/AiVoiceView.h
+ */
+#ifndef AI_VOICE_VIEW_H
+#define AI_VOICE_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_button.h"
+
+namespace OHOS
+{
+    class AiVoicePresenter;
+    class AiVoiceView : public View<AiVoicePresenter>
+    {
+
+    public:
+        struct LabelConfig
+        {
+            int16_t left;
+            int16_t top;
+            int16_t width;
+            int16_t height;
+            int16_t fontSize;
+            int16_t lineHeigh;
+            uint16_t textId;
+            uint8_t lineBreakMode;
+        };
+
+        struct ButtonConfig
+        {
+            int16_t x;
+            int16_t y;
+            int16_t w;
+            int16_t h;
+            const char *ViewId;
+        };
+
+        AiVoiceView();
+        ~AiVoiceView();
+        static AiVoiceView *GetInstance(void);
+
+        void OnStart() override;
+        void OnSetUpView() override;
+        void OnTearDownView() override;
+        void OnStop() override;
+
+    private:
+        UILabelExt *AiVoiceViewLabelInit(LabelConfig &labelconfig);
+        UIButton *AiVoiceViewLabelButtonInit(ButtonConfig &buttonconfig);
+        bool CreateAiVoiceViewLabel(void);
+        bool CreateAiVoiceViewButton(void);
+        void CreateAiVoiceView(void);
+        void ClearAll(void);
+        UILabelExt *title{nullptr};
+        UILabelExt *startChatLabel{nullptr};
+        UIButton *startChatButton{nullptr};
+
+        bool viewInitStatus{false};
+    };
+}
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp
new file mode 100644 (file)
index 0000000..7de4eb6
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-20 15:14:50
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-20 15:25:15
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp
+ */
+#include "aivoice/include/AiVoiceModel.h"
+#include "wearable_log.h"
+
+namespace OHOS
+{
+    AiVoiceModel::AiVoiceModel() {}
+
+    AiVoiceModel::~AiVoiceModel() {}
+
+    AiVoiceModel &AiVoiceModel::GetInstance()
+    {
+        static AiVoiceModel instance;
+        return instance;
+    }
+
+}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp
new file mode 100644 (file)
index 0000000..8ece842
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-20 15:11:17
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-20 16:52:30
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp
+ */
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+#include "aivoice/include/AiVoicePresenter.h"
+#include "aivoice/include/AiVoiceView.h"
+#include "aivoice/include/AiVoiceModel.h"
+#include "common/key_code.h"
+#include <custom_utils.h>
+#include "UiConfig.h"
+
+namespace OHOS
+{
+
+    // 当前Presenter属性实例化的内存指针
+    static AiVoicePresenter *g_pAiVoicePresenter = nullptr;
+
+    AiVoicePresenter::AiVoicePresenter()
+    {
+        model = &AiVoiceModel::GetInstance();
+        g_pAiVoicePresenter = this;
+    }
+
+    AiVoicePresenter::~AiVoicePresenter()
+    {
+        g_pAiVoicePresenter = nullptr;
+    }
+
+    AiVoicePresenter *AiVoicePresenter::GetInstance()
+    {
+        return g_pAiVoicePresenter;
+    }
+
+    void AiVoicePresenter::OnStart()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnStart");
+        Presenter<AiVoiceView>::OnStart();
+    }
+
+    void AiVoicePresenter::OnPause(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnPause");
+        Presenter<AiVoiceView>::OnPause();
+    }
+
+    void AiVoicePresenter::OnResume(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnResume");
+        Presenter<AiVoiceView>::OnResume();
+        if (view_ == nullptr)
+        {
+            return;
+        }
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
+    void AiVoicePresenter::OnStop(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnStop");
+        Presenter<AiVoiceView>::OnStop();
+    }
+
+    bool AiVoicePresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+        UNUSED(event);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnClick");
+        return true;
+    }
+
+    bool AiVoicePresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+        UNUSED(view);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnDrag");
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+        {
+            AiVoicePresenter::X_DRAG_FLAG = true;
+        }
+        return true;
+    }
+
+    bool AiVoicePresenter::OnDragEnd(UIView &view, const DragEvent &event)
+    {
+        UNUSED(view);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnDragEnd");
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && AiVoicePresenter::X_DRAG_FLAG)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+            AiVoicePresenter::X_DRAG_FLAG = false;
+        }
+        return true;
+    }
+
+    bool AiVoicePresenter::OnKeyAct(UIView &view, const KeyEvent &event) // 增加按键事件
+    {
+        UNUSED(view);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnKeyAct");
+        uint16_t keyID = event.GetKeyId();
+        uint16_t keyState = event.GetState();
+        // 如果是power键,且是亮屏状态,按键释放就返回上一级
+        if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+        }
+        return true;
+    }
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp
new file mode 100644 (file)
index 0000000..1386fc2
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-05-07 11:25:58
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-20 20:22:36
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp
+ */
+#include "aivoice/include/AiVoicePresenter.h"
+#include "aivoice/include/AiVoiceView.h"
+#include "wearable_log.h"
+#include "language/font/ui_resource_string.h"
+namespace OHOS
+{
+
+    static AiVoiceView *g_pAiVoiceView{nullptr};
+
+    AiVoiceView::AiVoiceView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::AiVoiceView");
+        g_pAiVoiceView = this;
+    }
+
+    AiVoiceView::~AiVoiceView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::~AiVoiceView");
+        g_pAiVoiceView = nullptr;
+    }
+
+    AiVoiceView *AiVoiceView::GetInstance()
+    {
+        return g_pAiVoiceView;
+    }
+
+    void AiVoiceView::ClearAll(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::ClearAll");
+        if (viewInitStatus)
+        {
+            if (container_ != nullptr)
+            {
+                container_->RemoveAll();
+                delete container_;
+                container_ = nullptr;
+            }
+        }
+    }
+
+    UILabelExt *AiVoiceView::AiVoiceViewLabelInit(LabelConfig &labelconfig)
+    {
+        UILabelExt *label = new UILabelExt();
+        if (label == nullptr)
+        {
+            return nullptr;
+        }
+        label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height);
+        label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);
+        label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);
+        label->SetTextId(labelconfig.textId);
+        label->SetLineBreakMode(labelconfig.lineBreakMode);
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);
+        return label;
+    }
+
+    UIButton *AiVoiceView::AiVoiceViewLabelButtonInit(ButtonConfig &buttonconfig)
+    {
+        UIButton *button = new UIButton();
+        if (button == nullptr)
+        {
+            return nullptr;
+        }
+        button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);
+        button->SetViewId(buttonconfig.ViewId);
+        button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c);
+        button->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+        button->SetOnClickListener(presenter_);
+
+        return button;
+    }
+
+    bool AiVoiceView::CreateAiVoiceViewLabel(void)
+    {
+        LabelConfig labelConfig = {
+            .left = 83,
+            .top = 52,
+            .width = 300,
+            .height = 35,
+            .fontSize = 30,
+            .lineHeigh = 35,
+            .textId = STR_AI_INTELLIGENT_ASSISTANT,
+            .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+        };
+        title = AiVoiceViewLabelInit(labelConfig);
+        if (title == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "title new fail!");
+            return false;
+        }
+
+        labelConfig = {
+            .left = 133,
+            .top = 368,
+            .width = 200,
+            .height = 35,
+            .fontSize = 30,
+            .lineHeigh = 35,
+            .textId = STR_START_CHAT,
+            .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+        };
+        startChatLabel = AiVoiceViewLabelInit(labelConfig);
+        if (startChatLabel == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "startChatLabel new fail!");
+            return false;
+        }
+
+        return true;
+    }
+
+    bool AiVoiceView::CreateAiVoiceViewButton(void)
+    {
+        ButtonConfig buttonconfig = {
+            .x = 93,
+            .y = 340,
+            .w = 280,
+            .h = 90,
+            .ViewId = "StartChat",
+        };
+        startChatButton = AiVoiceViewLabelButtonInit(buttonconfig);
+        if (startChatButton == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "startChatButton new fail!");
+            return false;
+        }
+
+        return true;
+    }
+
+    void AiVoiceView::CreateAiVoiceView(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView");
+        if (!CreateAiVoiceViewLabel() || !CreateAiVoiceViewButton())
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView fail!");
+            return;
+        }
+        container_->Add(title);
+        container_->Add(startChatButton);
+        container_->Add(startChatLabel);
+    }
+
+    void AiVoiceView::OnStart()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::OnStart");
+        View<AiVoicePresenter>::OnStart();
+        SetContainerView(new UIViewGroup());
+        container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        container_->SetOnDragListener(presenter_);
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+
+        if (!viewInitStatus)
+        {
+            CreateAiVoiceView();
+            viewInitStatus = true;
+        }
+
+        return;
+    }
+
+    void AiVoiceView::OnSetUpView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::OnSetUpView");
+        View<AiVoicePresenter>::OnSetUpView();
+        Draw();
+        return;
+    }
+
+    void AiVoiceView::OnTearDownView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::OnTearDownView");
+        View<AiVoicePresenter>::OnTearDownView();
+        return;
+    }
+
+    void AiVoiceView::OnStop()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::OnStop");
+        View<AiVoicePresenter>::OnStop();
+        RootView::GetInstance()->ClearOnKeyActListener();
+        ClearAll();
+        return;
+    }
+}
\ No newline at end of file
index e2bdc19..c6b9e16 100644 (file)
@@ -44,7 +44,7 @@ namespace OHOS
         {VIEW_THEME_STYLE, PNG_APPLIST_THEME_IMAGE, PNG_APPLIST_THEME_IMAGE, "显示方式", STR_DISPLAY_MODE, nullptr},
         {VIEW_SET_CARD, PNG_APPLIST_CARDSET_IMAGE, PNG_APPLIST_CARDSET_IMAGE, "卡片管理", STR_CARD_MANAGEMENT, nullptr},
         {VIEW_SET_DIAL, PNG_APPLIST_CHANGEDIAL_IMAGE, PNG_APPLIST_CHANGEDIAL_IMAGE, "更换表盘", STR_WATCH_FACE, nullptr},
-        {VIEW_SOUND_VIBRATION, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_VOICE_IMAGE, "声音", STR_WATCH_FACE, nullptr},
+        {VIEW_SOUND_VIBRATION, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_VOICE_IMAGE, "声音", STR_SOUND, nullptr},
         {VIEW_CLASSIC_BLUETOOTH, PNG_APPLIST_BLUETOOTH_IMAGE, PNG_APPLIST_BLUETOOTH_IMAGE, "蓝牙", STR_BLUETOOTH, nullptr},
         {VIEW_DNOTDISTURB, PNG_APPLIST_DISTURB_IMAGE, PNG_APPLIST_DISTURB_IMAGE, "勿扰模式", STR_DO_NOT_DISTURB, nullptr},
         {VIEW_FLASHLIGHT, PNG_APPLIST_FLASHLIGHT_IMAGE, PNG_APPLIST_FLASHLIGHT_IMAGE, "手电筒", STR_FLASHLIGHT, nullptr},
@@ -53,6 +53,7 @@ namespace OHOS
         {VIEW_MESSAGE, PNG_APPLIST_MESSAGE_IMAGE, PNG_APPLIST_MESSAGE_IMAGE, "消息通知", STR_MESSAGE_NOTIFICATION, nullptr},
         {VIEW_TAKEPHOTOS, PNG_APPLIST_TACKEPHOTOS_IMAGE, PNG_APPLIST_TACKEPHOTOS_IMAGE, "遥控拍照", STR_REMOTE_SHOOTING, nullptr},
         {VIEW_RESPIRATORY_TRAINING, PNG_APPLIST_BREATHE_IMAGE, PNG_APPLIST_BREATHE_IMAGE, "呼吸训练", STR_BREATH_TRAINING, nullptr},
+        //{VIEW_AI_VOICE, PNG_APPLIST_AIVOICE_IMAGE, PNG_APPLIST_AIVOICE_IMAGE, "AI Voice", STR_AI_VOICE, nullptr},
 #ifdef SUPPORT_ALIPAY_SEC
         {VIEW_MAIN_ALIPAY, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_ALIPAY_IMAGE, "支付宝", STR_ALIPAY, nullptr},
 #endif
index 8888740..644c540 100644 (file)
@@ -62,11 +62,13 @@ namespace OHOS {
 
     void ApplistPresenter::OnPause()
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnPause");
         Presenter<ApplistView>::OnPause();
     }
 
     void ApplistPresenter::OnStop(void)
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnStop");
         Presenter<ApplistView>::OnStop();
     }
 
index 67763dc..c01a756 100644 (file)
@@ -174,7 +174,7 @@ void ApplistView::OnStop()
         container_ = nullptr;
     }
     RootView::GetInstance()->ClearOnKeyActListener();
-    FocusManager::GetInstance()->ClearFocus();
+    //FocusManager::GetInstance()->ClearFocus();
     return;
 }
 
index e080bb3..0b67237 100644 (file)
@@ -459,4 +459,17 @@ STR_GRID_DISPLAY$网格显示
 STR_CELLULAR_DISPLAY$蜂窝显示\r
 STR_RECORDING_LIST$录音列表\r
 STR_CRLEMPTY$当前录音列表为空\r
-STR_CALL_VOLUME$通话音量
\ No newline at end of file
+STR_CALL_VOLUME$通话音量\r
+STR_AI_VOICE$AI Voice\r
+STR_AI_INTELLIGENT_ASSISTANT$AI智能助手\r
+STR_START_CHAT$开始对话\r
+STR_BOOT_FAILED$启动失败\r
+STR_ENABLE_MOBILE_DATA_FIRST$请先开启移动数据 \r
+STR_ENABLE_BLUETOOTH_FIRST$请先开启蓝牙\r
+STR_LISTENING$正在聆听...\r
+STR_FINISH_SPEAKING$说话完毕\r
+STR_THINKING$正在思考\r
+STR_CANCEL$取消\r
+STR_CONNECT_TIMEOUT$连接超时\r
+STR_PLEASE_RESTART_CHAT$请开始重新对话\r
+STR_CONTINUE_CHAT$继续对话
\ No newline at end of file
index 503010b..f03ceb6 100644 (file)
        <lanstr id="STR_RECORDING_LIST" value="录音列表"/>
        <lanstr id="STR_CRLEMPTY" value="当前录音列表为空"/>
        <lanstr id="STR_CALL_VOLUME" value="通话音量"/>
+       <lanstr id="STR_AI_VOICE" value="AI Voice"/>
+       <lanstr id="STR_AI_INTELLIGENT_ASSISTANT" value="AI智能助手"/>
+       <lanstr id="STR_START_CHAT" value="开始对话"/>
+       <lanstr id="STR_BOOT_FAILED" value="启动失败"/>
+       <lanstr id="STR_ENABLE_MOBILE_DATA_FIRST" value="请先开启移动数据"/>
+       <lanstr id="STR_ENABLE_BLUETOOTH_FIRST" value="请先开启蓝牙"/>
+       <lanstr id="STR_LISTENING" value="正在聆听..."/>
+       <lanstr id="STR_FINISH_SPEAKING" value="说话完毕"/>
+       <lanstr id="STR_THINKING" value="正在思考"/>
+       <lanstr id="STR_CANCEL" value="取消"/>
+       <lanstr id="STR_CONNECT_TIMEOUT" value="连接超时"/>
+       <lanstr id="STR_PLEASE_RESTART_CHAT" value="请开始重新对话"/>
+       <lanstr id="STR_CONTINUE_CHAT" value="继续对话"/>
 </language>
index 8b36d0d..f1028ed 100644 (file)
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang differ
index 527f904..13f845c 100644 (file)
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang differ
index eb9eee3..561c4c7 100644 (file)
@@ -483,7 +483,20 @@ enum UIResourceTextId : uint16_t {
     STR_RECORDING_LIST = 470,\r
     STR_CRLEMPTY = 471,\r
     STR_CALL_VOLUME = 472,\r
-    STR_MAX_ID = 473,\r
+    STR_AI_VOICE = 473,\r
+    STR_AI_INTELLIGENT_ASSISTANT = 474,\r
+    STR_START_CHAT = 475,\r
+    STR_BOOT_FAILED = 476,\r
+    STR_ENABLE_MOBILE_DATA_FIRST = 477,\r
+    STR_ENABLE_BLUETOOTH_FIRST = 478,\r
+    STR_LISTENING = 479,\r
+    STR_FINISH_SPEAKING = 480,\r
+    STR_THINKING = 481,\r
+    STR_CANCEL = 482,\r
+    STR_CONNECT_TIMEOUT = 483,\r
+    STR_PLEASE_RESTART_CHAT = 484,\r
+    STR_CONTINUE_CHAT = 485,\r
+    STR_MAX_ID = 486,\r
 }; // UIResourceTextId\r
 
 enum FontLanguageId : uint8_t {
index 7ed341f..ca52a6d 100644 (file)
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang differ
index 9d3c380..9ead7f8 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-02-19 10:39:11\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-06-19 15:40:58\r
+ * @LastEditTime: 2024-06-20 18:02:46\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp\r
  */\r
 \r
@@ -43,16 +43,19 @@ namespace OHOS
 \r
     void SoundAndVibrationPresenter::OnStart()\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationPresenter::OnStart");\r
         Presenter<SoundAndVibrationView>::OnStart();\r
     }\r
 \r
     void SoundAndVibrationPresenter::OnPause(void)\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationPresenter::OnPause");\r
         Presenter<SoundAndVibrationView>::OnPause();\r
     }\r
 \r
     void SoundAndVibrationPresenter::OnResume(void)\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationPresenter::OnResume");\r
         Presenter<SoundAndVibrationView>::OnResume();\r
         if (view_ == nullptr)\r
         {\r
@@ -62,6 +65,7 @@ namespace OHOS
 \r
     void SoundAndVibrationPresenter::OnStop(void)\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationPresenter::OnStop");\r
         Presenter<SoundAndVibrationView>::OnStop();\r
     }\r
 \r
index 9f0427e..fe77925 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-02-19 10:39:14\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-06-19 17:46:53\r
+ * @LastEditTime: 2024-06-20 18:03:01\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp\r
  */\r
 #include "soundandvibration/include/SoundAndVibrationView.h"\r
@@ -250,9 +250,7 @@ namespace OHOS
         container_->SetDraggable(true);\r
 \r
         CreateSoundAndVibrationView();\r
-\r
-        RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::SoundAndVibrationPresenter::GetInstance();\r
-        RootView::GetInstance()->SetOnKeyActListener(keyactListener);\r
+        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
     }\r
 \r
     void SoundAndVibrationView::OnSetUpView()\r
index 75376b1..0df25d5 100755 (executable)
@@ -17,7 +17,7 @@
 #include "graphic_service.h"
 #include "abilityms_slite_client.h"
 #include "common/input_device_manager.h"
-
+#include "dock/focus_manager.h"
 namespace OHOS {
 /*
  * @brief 负责将一个SliceProxy对象添加到Ability对象中,如果传入的sliceId是无效的或者代理对象proxy为空,则不执行任何操作。
@@ -134,6 +134,7 @@ void Ability::PostChangeSlice(const uint16_t targetSliceId, TransitionType type,
     */
     bool useTransition = sliceTransition_.SetTransitionType(type);
     bool isCurSnapshotEnabled = sliceTransition_.IsCurrentSnapshotEnabled();
+    FocusManager::GetInstance()->ClearFocus();
 
     if (!useTransition) {
         StopSlice();
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/AIRecBlack.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/AIRecBlack.bin
new file mode 100644 (file)
index 0000000..e73db6e
--- /dev/null
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fd2acea8d7166abd98536687c9a59a37e66dcadf5dc0152bb6185e04ce9fa13d
+size 1560
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/AIRecGreen.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/AIRecGreen.bin
new file mode 100644 (file)
index 0000000..c216e1b
--- /dev/null
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:96e2af6c30df028b9c9c0e032325f1e45d8b872aaffe8712215d3d2262ea9c0e
+size 1560
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/AIUnion.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/AIUnion.bin
new file mode 100644 (file)
index 0000000..4507f42
--- /dev/null
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:72c650a3bf3f61a231a466b92b72c75322b158da9bb966dd72d37619fb79830f
+size 408
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/applist_icon/aivoice.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/applist_icon/aivoice.bin
new file mode 100644 (file)
index 0000000..9832b7c
--- /dev/null
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2aac78100175b3b8cf9b5fc04ac3c41611825058e88601847a0f03263248b771
+size 5544
index 8b36d0d..f1028ed 100644 (file)
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang differ
index 527f904..13f845c 100644 (file)
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang differ
index eb9eee3..561c4c7 100644 (file)
@@ -483,7 +483,20 @@ enum UIResourceTextId : uint16_t {
     STR_RECORDING_LIST = 470,\r
     STR_CRLEMPTY = 471,\r
     STR_CALL_VOLUME = 472,\r
-    STR_MAX_ID = 473,\r
+    STR_AI_VOICE = 473,\r
+    STR_AI_INTELLIGENT_ASSISTANT = 474,\r
+    STR_START_CHAT = 475,\r
+    STR_BOOT_FAILED = 476,\r
+    STR_ENABLE_MOBILE_DATA_FIRST = 477,\r
+    STR_ENABLE_BLUETOOTH_FIRST = 478,\r
+    STR_LISTENING = 479,\r
+    STR_FINISH_SPEAKING = 480,\r
+    STR_THINKING = 481,\r
+    STR_CANCEL = 482,\r
+    STR_CONNECT_TIMEOUT = 483,\r
+    STR_PLEASE_RESTART_CHAT = 484,\r
+    STR_CONTINUE_CHAT = 485,\r
+    STR_MAX_ID = 486,\r
 }; // UIResourceTextId\r
 
 enum FontLanguageId : uint8_t {
index 7ed341f..ca52a6d 100644 (file)
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang differ