完善雷鸟界面逻辑
authorxue <2144439972@qq.com>
Sat, 30 Aug 2025 12:24:03 +0000 (20:24 +0800)
committerxue <2144439972@qq.com>
Sat, 30 Aug 2025 12:24:03 +0000 (20:24 +0800)
13 files changed:
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/include/ThunderBirdAdjustView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/include/ThunderBirdDialogueView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/include/ThunderBirdGuideView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/include/ThunderBirdOtaView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/include/ThunderBirdPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/include/ThunderBirdReminderView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/src/ThunderBirdAdjustView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/src/ThunderBirdOtaView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp

index 8b3f026..87a3eec 100644 (file)
@@ -4,6 +4,7 @@
 #include "View.h"
 #include "components/ui_view_group.h"
 #include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
 
 namespace OHOS
 {
@@ -15,10 +16,22 @@ namespace OHOS
         static ThunderBirdAdjustView *GetInstance(void);
         UIViewGroup *ThunderBirdAdjustViewInit(void);
         void ClearAll(void);
+        void Show(int16_t showView);
+
+        enum : int16_t {
+            THUNDERBIRD_ADJUSTVIEW_BIND_SUCCESS = 0,   // 绑定成功
+            THUNDERBIRD_ADJUSTVIEW_WARNING,            // 异常警告
+            THUNDERBIRD_ADJUSTVIEW_NETWORK_CONNECTING, // 网络连接中
+        };
 
     private:
         UIViewGroup *group{nullptr};
         UILabelExt *titleLabel{nullptr};
+        UILabelExt *TextLabel{nullptr};
+        UILabelExt *RemindLabel{nullptr};
+        UIImageView *RemindIcon{nullptr};
+        UIImageView *RemindIcon2{nullptr};
+        UIImageView *BackGround{nullptr};
     };
 }
 
index 66b1564..f0170b6 100644 (file)
@@ -4,6 +4,7 @@
 #include "View.h"
 #include "components/ui_view_group.h"
 #include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
 
 namespace OHOS
 {
@@ -15,10 +16,22 @@ namespace OHOS
         static ThunderBirdDialogueView *GetInstance(void);
         UIViewGroup *ThunderBirdDialogueViewInit(void);
         void ClearAll(void);
+        void Show(int16_t showView);
+
+        enum : int16_t {
+            THUNDERBIRD_DIALOGUEVIEW_SPEAKING = 0,     // 说话中
+            THUNDERBIRD_DIALOGUEVIEW_LISTENING,        // 聆听中
+            THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW,      // 状态展示
+        };
 
     private:
         UIViewGroup *group{nullptr};
         UILabelExt *titleLabel{nullptr};
+        UILabelExt *TextLabel{nullptr};
+        UILabelExt *RemindLabel{nullptr};
+        UIImageView *RemindIcon{nullptr};
+        UIImageView *RemindIcon2{nullptr};
+        UIImageView *BackGround{nullptr};
     };
 }
 
index eaa15ec..cf04f01 100644 (file)
@@ -28,9 +28,11 @@ namespace OHOS
         UIViewGroup *group{nullptr};
         UILabelExt *titleLabel{nullptr};
         UILabelExt *TextLabel{nullptr};
-        UIImageView *RemindGround{nullptr};
         UILabelExt *RemindLabel{nullptr};
+        UIImageView *RemindGround{nullptr};
         UIImageView *RemindIcon{nullptr};
+        UIImageView *RemindIcon2{nullptr};
+        UIImageView *BackGround{nullptr};
     };
 }
 
index c9c52ac..c1c1142 100644 (file)
@@ -35,6 +35,7 @@ namespace OHOS
         THUNDERBIRD_DIALOGUEVIEW,
         THUNDERBIRD_REMINDERVIEW,
         THUNDERBIRD_ADJUSTVIEW,
+        THUNDERBIRD_SHUTDOWNVIEW,
         MAXVIEW
     } BPVIEWID;
 
@@ -55,6 +56,7 @@ namespace OHOS
         bool ChangeThunderBirdDialogueView(int16_t);
         bool ChangeThunderBirdReminderView(int16_t);
         bool ChangeThunderBirdAdjustView(int16_t);
+        bool ChangeThunderBirdShutdownView(int16_t);
         bool ClickFunc(int16_t interface);
         void ChangeView(int16_t hideView, int16_t showView, int16_t subView = -1);
 
@@ -71,6 +73,8 @@ namespace OHOS
         void InitCommonPageComponents();
         void HideCommonPageComponents();
         bool SwitchVideo(const char *uri);
+        // 关机前关闭视频与相关资源
+        void CloseVideo();
 
 
     private:
index ba8a18a..4196483 100644 (file)
@@ -4,6 +4,7 @@
 #include "View.h"
 #include "components/ui_view_group.h"
 #include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
 
 namespace OHOS
 {
@@ -15,10 +16,30 @@ namespace OHOS
         static ThunderBirdOtaView *GetInstance(void);
         UIViewGroup *ThunderBirdOtaViewInit(void);
         void ClearAll(void);
+        void Show(int16_t showView);
+
+        enum : int16_t {
+            THUNDERBIRD_OTAVIEW_READY = 0,           // OTA就绪
+            THUNDERBIRD_OTAVIEW_NEW_FEATURE,         // 有新功能
+            THUNDERBIRD_OTAVIEW_UPDATE_NOW,          // 需要立即更新
+            THUNDERBIRD_OTAVIEW_NIGHT_UPDATE,        // 设置夜间更新
+            THUNDERBIRD_OTAVIEW_NIGHT_UPDATE_SUCCESS, // 设置夜间更新成功
+            THUNDERBIRD_OTAVIEW_COUNTDOWN,           // 更新倒计时
+            THUNDERBIRD_OTAVIEW_LOW_BATTERY,         // 电量不足
+            THUNDERBIRD_OTAVIEW_NETWORK_ERROR,       // 网络异常
+            THUNDERBIRD_OTAVIEW_MEMORY_ERROR,        // 内存不足
+            THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS,      // 更新成功
+            THUNDERBIRD_OTAVIEW_UPDATE_FAILED,       // 更新未完成
+        };
 
     private:
         UIViewGroup *group{nullptr};
         UILabelExt *titleLabel{nullptr};
+        UILabelExt *TextLabel{nullptr};
+        UILabelExt *RemindLabel{nullptr};
+        UIImageView *RemindIcon{nullptr};
+        UIImageView *RemindIcon2{nullptr};
+        UIImageView *BackGround{nullptr};
     };
 }
 
index c8365db..65b5e3f 100644 (file)
@@ -22,6 +22,9 @@ namespace OHOS
         void OnStart() override;
 
         static ThunderBirdPresenter *GetInstance();
+        
+        // 发布事件函数
+        void PublishEvent(uint16_t topic, uint8_t *data = nullptr, uint32_t size = 0);
 
     private:
         bool OnClick(UIView &view, const ClickEvent &event) override;
index efd04b1..2ae65e6 100644 (file)
@@ -4,6 +4,7 @@
 #include "View.h"
 #include "components/ui_view_group.h"
 #include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
 
 namespace OHOS
 {
@@ -15,10 +16,25 @@ namespace OHOS
         static ThunderBirdReminderView *GetInstance(void);
         UIViewGroup *ThunderBirdReminderViewInit(void);
         void ClearAll(void);
+        void Show(int16_t showView);
+
+        enum : int16_t {
+            THUNDERBIRD_REMINDERVIEW_VOLUME = 0,      // 音量调节
+            THUNDERBIRD_REMINDERVIEW_TASK_REMINDER,   // 事项提醒
+            THUNDERBIRD_REMINDERVIEW_NETWORK_DISCONNECT, // 网络断开
+            THUNDERBIRD_REMINDERVIEW_LOW_BATTERY,     // 电量不足
+            THUNDERBIRD_REMINDERVIEW_CHARGING,        // 充电中
+            THUNDERBIRD_REMINDERVIEW_CHARGE_COMPLETE, // 充电完成
+        };
 
     private:
         UIViewGroup *group{nullptr};
         UILabelExt *titleLabel{nullptr};
+        UILabelExt *TextLabel{nullptr};
+        UILabelExt *RemindLabel{nullptr};
+        UIImageView *RemindIcon{nullptr};
+        UIImageView *RemindIcon2{nullptr};
+        UIImageView *BackGround{nullptr};
     };
 }
 
index 34f3cf1..5eefc34 100644 (file)
@@ -29,11 +29,12 @@ namespace OHOS
             delete group;
             group = nullptr;
         }
-        if (titleLabel != nullptr)
-        {
-            delete titleLabel;
-            titleLabel = nullptr;
-        }
+        if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
+        if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
+        if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
+        if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
+        if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
+        if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
     }
 
     UIViewGroup *ThunderBirdAdjustView::ThunderBirdAdjustViewInit(void)
@@ -44,18 +45,130 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdAdjustView::group null!");
             return nullptr;
         }
-       group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+        group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
 
-        titleLabel = new UILabelExt();
-        if (titleLabel != nullptr)
+        // 公共控件
+        TextLabel = new UILabelExt();
+        if (TextLabel)
+        {
+            TextLabel->SetPosition(0, 104, 466, 48);
+            TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
+            TextLabel->SetVisible(false);
+            group->Add(TextLabel);
+        }
+        RemindLabel = new UILabelExt();
+        if (RemindLabel)
+        {
+            RemindLabel->SetPosition(0, 180, 466, 40);
+            RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
+            RemindLabel->SetVisible(false);
+            group->Add(RemindLabel);
+        }
+        RemindIcon = new UIImageView();
+        if (RemindIcon)
         {
-            titleLabel->SetPosition(20, 20, 300, 40);
-            titleLabel->SetText("调节界面");
-            group->Add(titleLabel);
+            RemindIcon->SetAutoEnable(false);
+            RemindIcon->SetVisible(false);
+            group->Add(RemindIcon);
+        }
+        RemindIcon2 = new UIImageView();
+        if (RemindIcon2)
+        {
+            RemindIcon2->SetAutoEnable(false);
+            RemindIcon2->SetVisible(false);
+            group->Add(RemindIcon2);
+        }
+        BackGround = new UIImageView();
+        if (BackGround)
+        {
+            BackGround->SetPosition(0, 0, 300, 300);
+            BackGround->SetStyle(STYLE_BACKGROUND_COLOR, 0x66191919);
+            BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
+            BackGround->SetVisible(false);
+            group->Add(BackGround);
         }
 
         return group;
     }
+
+    void ThunderBirdAdjustView::Show(int16_t showView)
+    {
+        if (group == nullptr) { return; }
+        if (BackGround) { BackGround->SetVisible(false); }
+        if (TextLabel) { TextLabel->SetVisible(false); TextLabel->SetY(104); }
+        if (RemindLabel) { RemindLabel->SetVisible(false); RemindLabel->SetY(180); }
+        if (RemindIcon) { RemindIcon->SetVisible(false); }
+        if (RemindIcon2) { RemindIcon2->SetVisible(false); }
+
+        switch (showView)
+        {
+        case THUNDERBIRD_ADJUSTVIEW_BIND_SUCCESS:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("绑定成功");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("设备已成功连接");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(200, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/check.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_ADJUSTVIEW_WARNING:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("异常警告");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("请检查设备状态");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(200, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/warning.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_ADJUSTVIEW_NETWORK_CONNECTING:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("网络连接中");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("请稍候...");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(200, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/connecting.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        default:
+            break;
+        }
+    }
 }
 
 
index 66eea88..57e4a1a 100644 (file)
@@ -29,11 +29,12 @@ namespace OHOS
             delete group;
             group = nullptr;
         }
-        if (titleLabel != nullptr)
-        {
-            delete titleLabel;
-            titleLabel = nullptr;
-        }
+        if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
+        if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
+        if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
+        if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
+        if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
+        if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
     }
 
     UIViewGroup *ThunderBirdDialogueView::ThunderBirdDialogueViewInit(void)
@@ -46,16 +47,134 @@ namespace OHOS
         }
         group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
 
-        titleLabel = new UILabelExt();
-        if (titleLabel != nullptr)
+        // 公共控件
+        TextLabel = new UILabelExt();
+        if (TextLabel)
+        {
+            TextLabel->SetPosition(0, 104, 466, 48);
+            TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
+            TextLabel->SetVisible(false);
+            group->Add(TextLabel);
+        }
+        RemindLabel = new UILabelExt();
+        if (RemindLabel)
+        {
+            RemindLabel->SetPosition(0, 180, 466, 40);
+            RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
+            RemindLabel->SetVisible(false);
+            group->Add(RemindLabel);
+        }
+        RemindIcon = new UIImageView();
+        if (RemindIcon)
         {
-            titleLabel->SetPosition(20, 20, 300, 40);
-            titleLabel->SetText("对话界面");
-            group->Add(titleLabel);
+            RemindIcon->SetAutoEnable(false);
+            RemindIcon->SetVisible(false);
+            group->Add(RemindIcon);
+        }
+        RemindIcon2 = new UIImageView();
+        if (RemindIcon2)
+        {
+            RemindIcon2->SetAutoEnable(false);
+            RemindIcon2->SetVisible(false);
+            group->Add(RemindIcon2);
+        }
+        BackGround = new UIImageView();
+        if (BackGround)
+        {
+            BackGround->SetPosition(0, 0, 300, 300);
+            BackGround->SetStyle(STYLE_BACKGROUND_COLOR, 0x66191919);
+            BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
+            BackGround->SetVisible(false);
+            group->Add(BackGround);
         }
 
         return group;
     }
+
+    void ThunderBirdDialogueView::Show(int16_t showView)
+    {
+        if (group == nullptr) { return; }
+        if (BackGround) { BackGround->SetVisible(false); }
+        if (TextLabel) { TextLabel->SetVisible(false); TextLabel->SetY(104); }
+        if (RemindLabel) { RemindLabel->SetVisible(false); RemindLabel->SetY(180); }
+        if (RemindIcon) { RemindIcon->SetVisible(false); }
+        if (RemindIcon2) { RemindIcon2->SetVisible(false); }
+
+        switch (showView)
+        {
+        case THUNDERBIRD_DIALOGUEVIEW_SPEAKING:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("说话中");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("正在为您播放语音");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(200, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/speaking.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_DIALOGUEVIEW_LISTENING:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("聆听中");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("请说出您的需求");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(200, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/listening.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("状态展示");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("按   取消   按   确认");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(140, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/volumedown.bin");
+                RemindIcon->SetVisible(true);
+            }
+            if (RemindIcon2)
+            {
+                RemindIcon2->SetPosition(275, 320, 30, 30);
+                RemindIcon2->SetSrc("/user/res/volumeup.bin");
+                RemindIcon2->SetVisible(true);
+            }
+            break;
+        }
+        default:
+            break;
+        }
+    }
 }
 
 
index 65d4261..6a811a4 100644 (file)
@@ -16,6 +16,7 @@
 #include "uicomponents/UIComponents.h"
 #include "MainPresenterSample.h"
 #include "thunderbird/include/ThunderBirdMainView.h"
+#include "thunderbird/include/ThunderBirdShutdownView.h"
 
 #include "wearable_log.h"
 
@@ -41,6 +42,8 @@ namespace OHOS
 
     static MediaVideoPlay *g_videoPlay = nullptr;
     static bool g_lastPlayed = false;
+
+    static ThunderBirdShutdownView *g_pThunderBirdShutdownView{nullptr};
     static void ScreenStatusNotify(ScreenStatus status)
     {
         if (g_videoPlay == nullptr)
@@ -102,7 +105,7 @@ namespace OHOS
         if (g_pThunderBirdDialogueView) { delete g_pThunderBirdDialogueView; g_pThunderBirdDialogueView = nullptr; }
         if (g_pThunderBirdReminderView) { delete g_pThunderBirdReminderView; g_pThunderBirdReminderView = nullptr; }
         if (g_pThunderBirdAdjustView) { delete g_pThunderBirdAdjustView; g_pThunderBirdAdjustView = nullptr; }
-
+        if (g_pThunderBirdShutdownView) { delete g_pThunderBirdShutdownView; g_pThunderBirdShutdownView = nullptr; }
         // 置空所有分组索引,避免悬空指针
         for (int i = 0; i < MAXVIEW; i++)
         {
@@ -262,6 +265,39 @@ namespace OHOS
         int32_t ret = videoPlay_->StartVideoPlay();
         return (ret == 0);
     }
+
+    void ThunderBirdMainView::CloseVideo()
+    {
+        // 停止视频并释放播放器
+        if (videoPlay_ != nullptr)
+        {
+            if (videoPlay_->isPlayed_)
+            {
+                videoPlay_->PauseVideoPlay();
+            }
+            if (videoPlay_->isEntered_)
+            {
+                videoPlay_->StopVideoPlay();
+            }
+            delete videoPlay_;
+            videoPlay_ = nullptr;
+        }
+        g_videoPlay = nullptr;
+        g_lastPlayed = false;
+        // 注销屏幕状态通知
+        deregisterNotifyScreenStatus(ScreenStatusNotify);
+        // 释放表面与背景
+        if (surfaceView_ != nullptr)
+        {
+            delete surfaceView_;
+            surfaceView_ = nullptr;
+        }
+        if (curFace != nullptr)
+        {
+            delete curFace;
+            curFace = nullptr;
+        }
+    }
     bool ThunderBirdMainView::ChangeThunderBirdView(int16_t thisView)
     {
         // 检查视图是否已初始化
@@ -376,6 +412,24 @@ namespace OHOS
         }
         return true;
     }
+    bool ThunderBirdMainView::ChangeThunderBirdShutdownView(int16_t thisView)
+    {
+        if (group[thisView] == nullptr)
+        {
+            g_pThunderBirdShutdownView = new ThunderBirdShutdownView();
+            if (g_pThunderBirdShutdownView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownView new fail %d", thisView);
+                return false;
+            }
+            group[thisView] = g_pThunderBirdShutdownView->ThunderBirdShutdownViewInit();
+            ScrollView_->Add(group[thisView]);
+            // 启动关机动动画
+            g_pThunderBirdShutdownView->StartShutdownAnimation();
+        }
+        return true;
+    }
+
 
     /**
      * 视图映射结构体 - 将视图ID映射到对应的视图切换函数
@@ -394,6 +448,7 @@ namespace OHOS
         {THUNDERBIRD_DIALOGUEVIEW, &ThunderBirdMainView::ChangeThunderBirdDialogueView},
         {THUNDERBIRD_REMINDERVIEW, &ThunderBirdMainView::ChangeThunderBirdReminderView},
         {THUNDERBIRD_ADJUSTVIEW, &ThunderBirdMainView::ChangeThunderBirdAdjustView},
+        {THUNDERBIRD_SHUTDOWNVIEW, &ThunderBirdMainView::ChangeThunderBirdShutdownView},
     };
 
     bool ThunderBirdMainView::ClickFunc(int16_t interface)
@@ -451,6 +506,30 @@ namespace OHOS
                     g_pThunderBirdLullabyView->Show(subView);
                 }
                 break;
+            case THUNDERBIRD_OTAVIEW:
+                if (g_pThunderBirdOtaView)
+                {
+                    g_pThunderBirdOtaView->Show(subView);
+                }
+                break;
+            case THUNDERBIRD_DIALOGUEVIEW:
+                if (g_pThunderBirdDialogueView)
+                {
+                    g_pThunderBirdDialogueView->Show(subView);
+                }
+                break;
+            case THUNDERBIRD_REMINDERVIEW:
+                if (g_pThunderBirdReminderView)
+                {
+                    g_pThunderBirdReminderView->Show(subView);
+                }
+                break;
+            case THUNDERBIRD_ADJUSTVIEW:
+                if (g_pThunderBirdAdjustView)
+                {
+                    g_pThunderBirdAdjustView->Show(subView);
+                }
+                break;
             default:
                 break;
             }
@@ -759,7 +838,7 @@ namespace OHOS
         if (isCharging)
         {
             if (!isChargeBatteryIconVisible)
-            {
+            {  
                 chargeBatteryicon->SetVisible(true);                           // 充电图标
                 isChargeBatteryIconVisible = true;
             }
index a145834..c657747 100644 (file)
@@ -29,11 +29,12 @@ namespace OHOS
             delete group;
             group = nullptr;
         }
-        if (titleLabel != nullptr)
-        {
-            delete titleLabel;
-            titleLabel = nullptr;
-        }
+        if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
+        if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
+        if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
+        if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
+        if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
+        if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
     }
 
     UIViewGroup *ThunderBirdOtaView::ThunderBirdOtaViewInit(void)
@@ -46,16 +47,294 @@ namespace OHOS
         }
         group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
 
-        titleLabel = new UILabelExt();
-        if (titleLabel != nullptr)
+        // 公共控件
+        TextLabel = new UILabelExt();
+        if (TextLabel)
+        {
+            TextLabel->SetPosition(0, 104, 466, 48);
+            TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
+            TextLabel->SetVisible(false);
+            group->Add(TextLabel);
+        }
+        RemindLabel = new UILabelExt();
+        if (RemindLabel)
+        {
+            RemindLabel->SetPosition(0, 180, 466, 40);
+            RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
+            RemindLabel->SetVisible(false);
+            group->Add(RemindLabel);
+        }
+        RemindIcon = new UIImageView();
+        if (RemindIcon)
+        {
+            RemindIcon->SetAutoEnable(false);
+            RemindIcon->SetVisible(false);
+            group->Add(RemindIcon);
+        }
+        RemindIcon2 = new UIImageView();
+        if (RemindIcon2)
+        {
+            RemindIcon2->SetAutoEnable(false);
+            RemindIcon2->SetVisible(false);
+            group->Add(RemindIcon2);
+        }
+        BackGround = new UIImageView();
+        if (BackGround)
         {
-            titleLabel->SetPosition(20, 20, 300, 40);
-            titleLabel->SetText("OTA 升级");
-            group->Add(titleLabel);
+            BackGround->SetPosition(0, 0, 300, 300);
+            BackGround->SetStyle(STYLE_BACKGROUND_COLOR, 0x66191919);
+            BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
+            BackGround->SetVisible(false);
+            group->Add(BackGround);
         }
 
         return group;
     }
+
+    void ThunderBirdOtaView::Show(int16_t showView)
+    {
+        if (group == nullptr) { return; }
+        if (BackGround) { BackGround->SetVisible(false); }
+        if (TextLabel) { TextLabel->SetVisible(false); TextLabel->SetY(104); }
+        if (RemindLabel) { RemindLabel->SetVisible(false); RemindLabel->SetY(180); }
+        if (RemindIcon) { RemindIcon->SetVisible(false); }
+        if (RemindIcon2) { RemindIcon2->SetVisible(false); }
+
+        switch (showView)
+        {
+        case THUNDERBIRD_OTAVIEW_READY:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("OTA 就绪");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("按   检查更新");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(180, 175, 30, 30);
+                RemindIcon->SetSrc("/user/res/volumeup.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_NEW_FEATURE:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("有新功能可用");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("按   取消   按   更新");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(140, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/volumedown.bin");
+                RemindIcon->SetVisible(true);
+            }
+            if (RemindIcon2)
+            {
+                RemindIcon2->SetPosition(275, 320, 30, 30);
+                RemindIcon2->SetSrc("/user/res/volumeup.bin");
+                RemindIcon2->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_UPDATE_NOW:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("需要立即更新");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("按   取消   按   立即更新");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(140, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/volumedown.bin");
+                RemindIcon->SetVisible(true);
+            }
+            if (RemindIcon2)
+            {
+                RemindIcon2->SetPosition(275, 320, 30, 30);
+                RemindIcon2->SetSrc("/user/res/volumeup.bin");
+                RemindIcon2->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_NIGHT_UPDATE:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("设置夜间更新");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("按   取消   按   确认");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(140, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/volumedown.bin");
+                RemindIcon->SetVisible(true);
+            }
+            if (RemindIcon2)
+            {
+                RemindIcon2->SetPosition(275, 320, 30, 30);
+                RemindIcon2->SetSrc("/user/res/volumeup.bin");
+                RemindIcon2->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_NIGHT_UPDATE_SUCCESS:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("夜间更新设置成功");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("将在夜间自动更新");
+                RemindLabel->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_COUNTDOWN:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("更新倒计时");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("按   取消更新");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(180, 175, 30, 30);
+                RemindIcon->SetSrc("/user/res/volumeup.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_LOW_BATTERY:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("电量不足");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("请充电后重试");
+                RemindLabel->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_NETWORK_ERROR:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("网络异常");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("请检查网络连接");
+                RemindLabel->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_MEMORY_ERROR:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("内存不足");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("请清理存储空间");
+                RemindLabel->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("更新成功");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("按   重启设备");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(140, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/check.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_OTAVIEW_UPDATE_FAILED:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("更新未完成");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("按   重试   按   取消");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(140, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/volumedown.bin");
+                RemindIcon->SetVisible(true);
+            }
+            if (RemindIcon2)
+            {
+                RemindIcon2->SetPosition(275, 320, 30, 30);
+                RemindIcon2->SetSrc("/user/res/volumeup.bin");
+                RemindIcon2->SetVisible(true);
+            }
+            break;
+        }
+        default:
+            break;
+        }
+    }
 }
 
 
index b440ba4..2184d90 100644 (file)
@@ -6,12 +6,22 @@
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/ThunderBird/src/ThunderBirdPresenter.cpp
  */
 #include "thunderbird/include/ThunderBirdPresenter.h"
+#include "thunderbird/include/ThunderBirdGuideView.h"
+#include "thunderbird/include/ThunderBirdOtaView.h"
+#include "thunderbird/include/ThunderBirdLullabyView.h"
+#include "thunderbird/include/ThunderBirdDialogueView.h"
+#include "thunderbird/include/ThunderBirdReminderView.h"
+#include "thunderbird/include/ThunderBirdAdjustView.h"
 #include "AppViewIDs.h"
 #include "NativeAbility.h"
 #include "common/key_code.h"
 #include <custom_utils.h>
 #include "NativeRegisterManager.h"
 #include "uicomponents/UIComponents.h"
+#include "broadcast_feature.h"
+#include "broadcast_service.h"
+#include "samgr_lite.h"
+#include "service_id_define.h"
 namespace OHOS
 {
 
@@ -35,6 +45,58 @@ namespace OHOS
         return g_pThunderBirdPresenter;
     }
 
+    void ThunderBirdPresenter::PublishEvent(uint16_t topic, uint8_t *data, uint32_t size)
+    {
+        int32 ret;
+        BroadcastApi *broadcastApi = nullptr;
+        IUnknown *api = nullptr;
+        
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter::PublishEvent topic=%u!!", topic);
+
+        void *publishData = nullptr;
+        if (size > 0 && data != nullptr)
+        {
+            publishData = malloc(size);
+            if (publishData == nullptr)
+            {
+                return;
+            }
+            ret = memcpy_s(publishData, size, (const void *)data, size);
+            if (ret != EOK)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PublishEvent memcpy_s fail! ret = %d", ret);
+                free(publishData);
+                return;
+            }
+        }
+
+        Request request = {
+            .msgId = topic,
+            .len = size,
+            .msgValue = 0,
+            .data = publishData,
+        };
+
+        /* public request */
+        api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME);
+        if (api == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetFeatureApi failed");
+            free(publishData);
+            return;
+        }
+        ret = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi);
+        if (ret != 0 || broadcastApi == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QueryInterface failed");
+            free(publishData);
+            return;
+        }
+        broadcastApi->PublishTopic((IUnknown *)broadcastApi, &request);
+        broadcastApi->Release((IUnknown *)broadcastApi);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PublishEvent end!!");
+    }
+
     void ThunderBirdPresenter::OnStart()
     {
         Presenter<ThunderBirdMainView>::OnStart();
@@ -84,45 +146,168 @@ namespace OHOS
         {
             int16_t currentView = ThunderBirdMainView::GetInstance()->GetCurrentView();
             int16_t currentSubView = ThunderBirdMainView::GetInstance()->GetCurrentSubView();
+             // 引导界面导航
             if(currentView == THUNDERBIRD_GUIDEVIEW)
+             {
+                 if(currentSubView == ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_1)
+                 {
+                     ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_GUIDEVIEW, ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_2);
+                 }
+                 else if(currentSubView == ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_2)
+                 {
+                     ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_GUIDEVIEW, ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_3);
+                 }
+                 else if(currentSubView == ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_3)
+                 {
+                     ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_READY);
+                 }
+             }
+            
+            // OTA界面导航
+            else if(currentView == THUNDERBIRD_OTAVIEW)
             {
-                if(currentSubView == 0)
+                if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_READY) // 有新功能
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NEW_FEATURE);
+                }
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NEW_FEATURE) // 需要立即更新
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_NOW);
+                }
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_NOW) // 设置夜间更新
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NIGHT_UPDATE);
+                }
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NIGHT_UPDATE) // 设置夜间更新成功
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NIGHT_UPDATE_SUCCESS);
+                }
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NIGHT_UPDATE_SUCCESS) // 更新倒计时
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_COUNTDOWN);
+                }
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_COUNTDOWN) // 电量不足
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_LOW_BATTERY);
+                }
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_LOW_BATTERY) // 网络异常
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NETWORK_ERROR);
+                }
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NETWORK_ERROR) // 内存不足
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_MEMORY_ERROR);
+                }
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_MEMORY_ERROR) // 更新成功
                 {
-                    ThunderBirdMainView::GetInstance()->ChangeView(currentView,THUNDERBIRD_GUIDEVIEW,1);
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS);
                 }
-                else if(currentSubView == 1)
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS) // 更新未完成
                 {
-                    ThunderBirdMainView::GetInstance()->ChangeView(currentView,THUNDERBIRD_GUIDEVIEW,2);
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_FAILED);
                 }
-                else if(currentSubView == 2)
+                else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_FAILED) // 更新未完成
                 {
-                    ThunderBirdMainView::GetInstance()->ChangeView(currentView,THUNDERBIRD_LULLABYVIEW,0);
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_1);
                 }
             }
+           
+            // 哄睡界面导航
             else if(currentView == THUNDERBIRD_LULLABYVIEW)
             {
-                if(currentSubView == 0) 
+                if(currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_1) 
                 {
-                    ThunderBirdMainView::GetInstance()->ChangeView(currentView,THUNDERBIRD_LULLABYVIEW,1);
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_2);
                 }
-                else if(currentSubView == 1)
+                else if(currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_2)
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3);
+                }
+                else if(currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3)
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4);
+                }
+                else if(currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4)
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_5);
+                }
+                else if(currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_5)
+                {
+                    // 返回主界面
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_SPEAKING);
+                }
+            }
+            // 对话界面导航
+            else if(currentView == THUNDERBIRD_DIALOGUEVIEW)
+            {
+                if(currentSubView == ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_SPEAKING) // 说话中
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_LISTENING);
+                }
+                else if(currentSubView == ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_LISTENING) // 聆听中
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW);
+                }
+                else if(currentSubView == ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW) // 状态展示
+                {
+                    // 返回主界面
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_REMINDERVIEW, ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_VOLUME);
+                }
+            }
+            // 提醒界面导航
+            else if(currentView == THUNDERBIRD_REMINDERVIEW)
+            {
+                if(currentSubView == ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_VOLUME) // 音量调节
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_REMINDERVIEW, ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_TASK_REMINDER);
+                }
+                else if(currentSubView == ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_TASK_REMINDER) // 事项提醒
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_REMINDERVIEW, ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_NETWORK_DISCONNECT);
+                }
+                else if(currentSubView == ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_NETWORK_DISCONNECT) // 网络断开
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_REMINDERVIEW, ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_LOW_BATTERY);
+                }
+                else if(currentSubView == ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_LOW_BATTERY) // 电量不足
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_REMINDERVIEW, ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_CHARGING);
+                }
+                else if(currentSubView == ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_CHARGING) // 充电中
+                {
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_REMINDERVIEW, ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_CHARGE_COMPLETE);
+                }
+                else if(currentSubView == ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_CHARGE_COMPLETE) // 充电完成
+                {
+                    // 返回主界面
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_ADJUSTVIEW, ThunderBirdAdjustView::THUNDERBIRD_ADJUSTVIEW_BIND_SUCCESS);
+                }
+            }
+            // 调节界面导航
+            else if(currentView == THUNDERBIRD_ADJUSTVIEW)
+            {
+                if(currentSubView == ThunderBirdAdjustView::THUNDERBIRD_ADJUSTVIEW_BIND_SUCCESS) // 绑定成功
                 {
-                    ThunderBirdMainView::GetInstance()->ChangeView(currentView,THUNDERBIRD_LULLABYVIEW,2);
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_ADJUSTVIEW, ThunderBirdAdjustView::THUNDERBIRD_ADJUSTVIEW_WARNING);
                 }
-                else if(currentSubView == 2)
+                else if(currentSubView == ThunderBirdAdjustView::THUNDERBIRD_ADJUSTVIEW_WARNING) // 异常警告
                 {
-                    ThunderBirdMainView::GetInstance()->ChangeView(currentView,THUNDERBIRD_LULLABYVIEW,3);
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_ADJUSTVIEW, ThunderBirdAdjustView::THUNDERBIRD_ADJUSTVIEW_NETWORK_CONNECTING);
                 }
-                else if(currentSubView == 3)
+                else if(currentSubView == ThunderBirdAdjustView::THUNDERBIRD_ADJUSTVIEW_NETWORK_CONNECTING) // 网络连接中
                 {
-                    ThunderBirdMainView::GetInstance()->ChangeView(currentView,THUNDERBIRD_LULLABYVIEW,4);
+                    ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_SHUTDOWNVIEW, 0);
                 }
             }
-            //NativeAbility::GetInstance().Back();
         }
         if(keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC) && keyState == 1 && uapi_get_screen_state() == 0)
         {
-            ThunderBirdMainView::GetInstance()->SwitchVideo("/user/video/46x46_shocked.mp4");
+            // // 发布OTA升级事件,显示OTA升级弹窗
+            // PublishEvent(TOPIC_EVENT_OTA_UPDATE, nullptr, 0);
+            // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter: Published OTA update event");
+            
+            // // 原有的视频切换功能
+            // ThunderBirdMainView::GetInstance()->SwitchVideo("/user/video/46x46_shocked.mp4");
         }
         return true;
     }
index 609941d..52f289f 100644 (file)
@@ -29,11 +29,12 @@ namespace OHOS
             delete group;
             group = nullptr;
         }
-        if (titleLabel != nullptr)
-        {
-            delete titleLabel;
-            titleLabel = nullptr;
-        }
+        if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
+        if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
+        if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
+        if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
+        if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
+        if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
     }
 
     UIViewGroup *ThunderBirdReminderView::ThunderBirdReminderViewInit(void)
@@ -46,16 +47,196 @@ namespace OHOS
         }
         group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
 
-        titleLabel = new UILabelExt();
-        if (titleLabel != nullptr)
+        // 公共控件
+        TextLabel = new UILabelExt();
+        if (TextLabel)
+        {
+            TextLabel->SetPosition(0, 104, 466, 48);
+            TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
+            TextLabel->SetVisible(false);
+            group->Add(TextLabel);
+        }
+        RemindLabel = new UILabelExt();
+        if (RemindLabel)
+        {
+            RemindLabel->SetPosition(0, 180, 466, 40);
+            RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
+            RemindLabel->SetVisible(false);
+            group->Add(RemindLabel);
+        }
+        RemindIcon = new UIImageView();
+        if (RemindIcon)
+        {
+            RemindIcon->SetAutoEnable(false);
+            RemindIcon->SetVisible(false);
+            group->Add(RemindIcon);
+        }
+        RemindIcon2 = new UIImageView();
+        if (RemindIcon2)
+        {
+            RemindIcon2->SetAutoEnable(false);
+            RemindIcon2->SetVisible(false);
+            group->Add(RemindIcon2);
+        }
+        BackGround = new UIImageView();
+        if (BackGround)
         {
-            titleLabel->SetPosition(20, 20, 300, 40);
-            titleLabel->SetText("提醒界面");
-            group->Add(titleLabel);
+            BackGround->SetPosition(0, 0, 300, 300);
+            BackGround->SetStyle(STYLE_BACKGROUND_COLOR, 0x66191919);
+            BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
+            BackGround->SetVisible(false);
+            group->Add(BackGround);
         }
 
         return group;
     }
+
+    void ThunderBirdReminderView::Show(int16_t showView)
+    {
+        if (group == nullptr) { return; }
+        if (BackGround) { BackGround->SetVisible(false); }
+        if (TextLabel) { TextLabel->SetVisible(false); TextLabel->SetY(104); }
+        if (RemindLabel) { RemindLabel->SetVisible(false); RemindLabel->SetY(180); }
+        if (RemindIcon) { RemindIcon->SetVisible(false); }
+        if (RemindIcon2) { RemindIcon2->SetVisible(false); }
+
+        switch (showView)
+        {
+        case THUNDERBIRD_REMINDERVIEW_VOLUME:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("音量调节");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("按   减小音量   按   增大音量");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(140, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/volumedown.bin");
+                RemindIcon->SetVisible(true);
+            }
+            if (RemindIcon2)
+            {
+                RemindIcon2->SetPosition(275, 320, 30, 30);
+                RemindIcon2->SetSrc("/user/res/volumeup.bin");
+                RemindIcon2->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_REMINDERVIEW_TASK_REMINDER:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("事项提醒");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("您有新的提醒事项");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(180, 175, 30, 30);
+                RemindIcon->SetSrc("/user/res/notification.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_REMINDERVIEW_NETWORK_DISCONNECT:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("网络断开");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("请检查网络连接");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(180, 175, 30, 30);
+                RemindIcon->SetSrc("/user/res/wifi_off.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_REMINDERVIEW_LOW_BATTERY:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("电量不足");
+                TextLabel->SetY(160);
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("请及时充电");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(180, 175, 30, 30);
+                RemindIcon->SetSrc("/user/res/battery_low.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_REMINDERVIEW_CHARGING:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("充电中");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("请保持连接");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(200, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/charging.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        case THUNDERBIRD_REMINDERVIEW_CHARGE_COMPLETE:
+        {
+            if (TextLabel)
+            {
+                TextLabel->SetText("充电完成");
+                TextLabel->SetVisible(true);
+            }
+            if (RemindLabel)
+            {
+                RemindLabel->SetText("可以拔掉充电器");
+                RemindLabel->SetVisible(true);
+            }
+            if (RemindIcon)
+            {
+                RemindIcon->SetPosition(200, 320, 30, 30);
+                RemindIcon->SetSrc("/user/res/check.bin");
+                RemindIcon->SetVisible(true);
+            }
+            break;
+        }
+        default:
+            break;
+        }
+    }
 }