查找手机slice合并提交 1709/1
authorluozheng <1732036298@qq.com>
Wed, 26 Mar 2025 02:51:29 +0000 (10:51 +0800)
committerluozheng <1732036298@qq.com>
Wed, 26 Mar 2025 02:51:29 +0000 (10:51 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/include/FindPhoneModel.h [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/include/FindPhonePresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/include/FindPhoneView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneModel.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhonePresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneView.cpp [new file with mode: 0644]

diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/include/FindPhoneModel.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/include/FindPhoneModel.h
new file mode 100644 (file)
index 0000000..92cffcc
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-27 15:21:17
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-10-12 17:22:50
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneModel.h
+ */
+#ifndef FINDPHONE_MODEL_H
+#define FINDPHONE_MODEL_H
+#include "cstdint"
+
+namespace OHOS
+{
+    class FindPhoneModel
+    {
+    public:
+        static FindPhoneModel &GetInstance();
+        void SetBlueToothConnectedState(bool state);
+        bool GetBlueToothConnectedState();
+        void start_or_stop_find_phone(uint8_t val);
+    private:
+        FindPhoneModel() {}
+        ~FindPhoneModel() {}
+        FindPhoneModel(const FindPhoneModel &) = delete;
+        const FindPhoneModel &operator=(const FindPhoneModel &) = delete;
+
+        bool isBlueToothConnected{false}; // 蓝牙是否连接
+    };
+}
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/include/FindPhonePresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/include/FindPhonePresenter.h
new file mode 100644 (file)
index 0000000..8983da0
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-27 10:47:24
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2025-02-25 17:43:12
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhonePresenter.h
+ */
+
+#ifndef FIND_PHONE_PRESENTER_H
+#define FIND_PHONE_PRESENTER_H
+
+#include "Presenter.h"
+#include "View.h"
+
+namespace OHOS
+{
+    static constexpr const uint8_t FINDPHONE_START = 1; // 开始查找手机
+    static constexpr const uint8_t FINDPHONE_STOP = 0;  // 停止查找手机
+    static constexpr char *FINDPHONE_LABELBUTTON = "FindPhoneLabelButton";
+    class FindPhoneView;
+    class FindPhonePresenter : public Presenter<FindPhoneView>,
+                               public UIView::OnClickListener,
+                               public RootView::OnKeyActListener,
+                               public UIView::OnDragListener
+    {
+    public:
+        FindPhonePresenter();
+        virtual ~FindPhonePresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+
+        static FindPhonePresenter *GetInstance();
+
+    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; // 增加按键事件
+        bool X_DRAG_FLAG{false};
+    };
+}
+#endif
diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/include/FindPhoneView.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/include/FindPhoneView.h
new file mode 100644 (file)
index 0000000..7cc5d13
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-31 09:52:34
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2025-02-24 18:39:46
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h
+ */
+#ifndef FIND_PHONE_VIEW_H
+#define FIND_PHONE_VIEW_H
+
+#include "View.h"
+#include "components/ui_view_group.h"
+#include "components/ui_label_ext.h"
+#include "ui_resource_string.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_image_view.h"
+namespace OHOS
+{
+    static constexpr int FINDPHONE_IMAGE_ANIMATOR_VIEW_X = 173;
+    static constexpr int FINDPHONE_IMAGE_ANIMATOR_VIEW_Y = 140;
+    static constexpr int FINDPHONE_IMAGE_ANIMATOR_VIEW_W = 120;
+    static constexpr int FINDPHONE_IMAGE_ANIMATOR_VIEW_H = 120;
+    static constexpr int FINDPHONE_IMAGE_ANIMATOR_VIEW_TIMEOFUPDATE = 100;
+    static constexpr int FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 50; // 图片帧数
+
+    class FindPhonePresenter;
+    class FindPhoneView : public View<FindPhonePresenter>
+    {
+    public:
+        FindPhoneView();
+        virtual ~FindPhoneView();
+        static FindPhoneView *GetInstance(void);
+
+        void OnStart() override;
+
+    private:
+        void FindPhoneViewInit_BlueToothConnected(void);
+        void FindPhoneViewInit_BlueToothDisConnected(void);
+        void ClearAll();
+        UIViewGroup *FindPhoneGroupView = nullptr;
+        UILabelExt *FindPhoneTitleLabel = nullptr;
+        UILabelExt *FindPhoneLabel = nullptr;
+        UIImageAnimatorView *FindPhoneImageAnimator = nullptr;
+        UILabelButtonExt *FindPhoneLabelButton = nullptr;
+        UIImageView *FindPhoneImageView{nullptr};
+        const ImageInfo **FindPhonePathsArray{nullptr};
+        ImageAnimatorInfo FindPhoneImageInfo[FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES];
+    };
+} // namespace OHOS
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneModel.cpp
new file mode 100644 (file)
index 0000000..793eb46
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-27 15:21:30
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-10-12 17:18:27
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneModel.cpp
+ */
+
+#include "findphone/include/FindPhoneModel.h"
+#include <custom_runtime.h>
+#include "wearable_log.h"
+
+#ifdef SUPPORT_BLE_SERVICE
+#include "bleEvent.h"
+#include "bletest.h"
+#endif
+
+namespace OHOS
+{
+    FindPhoneModel &FindPhoneModel::GetInstance()
+    {
+        static FindPhoneModel instance;
+        return instance;
+    }
+
+    /*设置蓝牙是否已连接*/
+    void FindPhoneModel::SetBlueToothConnectedState(bool state)
+    {
+        isBlueToothConnected = state;
+    }
+
+    /*获取与手机蓝牙是否已连接*/
+    bool FindPhoneModel::GetBlueToothConnectedState()
+    {
+        // return ble_is_ready() && ble_is_connect_ready();
+        uint8_t ret = uapi_dev_runtime_get_ble_connect_stat();
+        WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "ble phone connect stat = %d", ret);
+        if (ret == 1)
+            return true;
+        else
+            return false;
+    }
+
+    // 开始或停止查找手机
+    void FindPhoneModel::start_or_stop_find_phone(uint8_t val)
+    {
+        WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "start_or_stop_find_phone %d", val);
+        // 发送指令停止震动
+        if (FindPhoneModel::GetInstance().GetBlueToothConnectedState())
+        {
+            #ifdef SUPPORT_BLE_SERVICE
+            senfindphoneSend(val);
+            #endif
+        }
+    }
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhonePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhonePresenter.cpp
new file mode 100644 (file)
index 0000000..75a850e
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-27 10:47:40
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2025-02-25 17:43:45
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp
+ */
+#include "AppViewIDs.h"
+#include "UiConfig.h"
+#include "components/ui_label_ext.h"
+#include "ui_resource_string.h"
+#include "NativeAbility.h"
+#include "findphone/include/FindPhonePresenter.h"
+#include "findphone/include/FindPhoneModel.h"
+#include "findphone/include/FindPhoneView.h"
+#include "gfx_utils/mem_check.h"
+#include "bluetooth/include/BluetoothModel.h"
+#include "custom_utils.h"
+#include "common/key_code.h"
+#include "NativeRegisterManager.h"
+
+#ifdef SUPPORT_BLE_SERVICE
+#include "bleEvent.h"
+#endif
+
+namespace OHOS
+{
+    REGIST_MENU_PRO(VIEW_FIND_PHONE, FindPhoneView, FindPhonePresenter, PNG_APPLIST_FINDPHONE_IMAGE_BIG,
+                    PNG_APPLIST_FINDPHONE_IMAGE, PNG_APPLIST_FINDPHONE_IMAGE, "查找手机", STR_FIND_PHONE);
+
+    // 当前Presenter属性实例化的内存指针
+    static FindPhonePresenter *g_pFindPhonePresenter = nullptr;
+
+    FindPhonePresenter::FindPhonePresenter()
+    {
+        g_pFindPhonePresenter = this;
+#ifdef MEM_CHECK
+        MemCheck::GetInstance()->EnableLeakCheck(true);
+#endif
+    }
+
+    FindPhonePresenter::~FindPhonePresenter()
+    {
+        g_pFindPhonePresenter = nullptr;
+#ifdef MEM_CHECK
+        MemCheck::GetInstance()->EnableLeakCheck(false);
+#endif
+    }
+
+    FindPhonePresenter *FindPhonePresenter::GetInstance()
+    {
+        return g_pFindPhonePresenter;
+    }
+
+    void FindPhonePresenter::OnStart()
+    {
+#ifdef SUPPORT_BLE_SERVICE
+        if (FindPhoneModel::GetInstance().GetBlueToothConnectedState() &&
+            uapi_a2dp_snk_get_device_connect_state()) // 判断与手机蓝牙是否连接和判断a2dp是否是已连接状态
+        {
+            WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnStart a2dp is connected");
+            uapi_a2dp_snk_disconnect(); // 先断开a2dp
+        }
+#endif
+    }
+
+    void FindPhonePresenter::OnPause(void)
+    {
+        Presenter<FindPhoneView>::OnPause();
+    }
+
+    void FindPhonePresenter::OnResume(void)
+    {
+        Presenter<FindPhoneView>::OnResume();
+    }
+
+    void FindPhonePresenter::OnStop(void)
+    {
+#ifdef SUPPORT_BLE_SERVICE
+        FindPhoneModel::GetInstance().start_or_stop_find_phone(FINDPHONE_STOP); // 发送指令停止震动
+        if (FindPhoneModel::GetInstance().GetBlueToothConnectedState() &&
+            !uapi_a2dp_snk_get_device_connect_state()) // 判断与手机蓝牙是否连接和判断a2dp是为连接状态
+        {
+            WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnStop a2dp is not connected");
+            uapi_a2dp_snk_connect(); // 主动连接a2dp
+        }
+#endif
+    }
+
+    bool FindPhonePresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnClick");
+        UNUSED(event);
+        if (strcmp(view.GetViewId(), FINDPHONE_LABELBUTTON) == 0)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+        }
+        return true;
+    }
+
+    bool FindPhonePresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnDrag");
+        UNUSED(view);
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+        {
+            FindPhonePresenter::X_DRAG_FLAG = true;
+        }
+        return true;
+    }
+
+    bool FindPhonePresenter::OnDragEnd(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnDragEnd");
+        UNUSED(event);
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && FindPhonePresenter::X_DRAG_FLAG)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+            FindPhonePresenter::X_DRAG_FLAG = false;
+        }
+        return true;
+    }
+
+    bool FindPhonePresenter::OnKeyAct(UIView &view, const KeyEvent &event) // 增加按键事件
+    {
+        UNUSED(view);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnKeyAct");
+        unsigned short keyID = event.GetKeyId();
+        unsigned short keyState = event.GetState();
+        // 如果是power键,且是亮屏状态,按键释放就返回上一级
+        if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && 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/fd230/nativeapp/nativeui/findphone/src/FindPhoneView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/findphone/src/FindPhoneView.cpp
new file mode 100644 (file)
index 0000000..ea029b8
--- /dev/null
@@ -0,0 +1,290 @@
+/***
+ * @Date: 2024-06-19 19:25:22
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-30 19:23:15
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
+ */
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-27 10:47:46
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2025-02-25 16:19:36
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
+ */
+#include "findphone/include/FindPhoneView.h"
+#include "findphone/include/FindPhonePresenter.h"
+#include "wearable_log.h"
+#include "findphone/include/FindPhoneModel.h"
+#include "UiConfig.h"
+#include "ui_resource_string.h"
+#include "uicomponents/UIComponents.h"
+
+#ifdef SUPPORT_BLE_SERVICE
+#include "bletest.h"
+#include "bleEvent.h"
+#endif
+namespace OHOS
+{
+
+    static FindPhoneView *g_pFindPhoneView{nullptr};
+    static constexpr const char *FIND_PONE_IMAGE_SRC = "/user/res/findphone/";
+
+    FindPhoneView::FindPhoneView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FindPhoneView::FindPhoneView");
+        g_pFindPhoneView = this;
+    }
+
+    FindPhoneView::~FindPhoneView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FindPhoneView::~FindPhoneView");
+        ClearAll();
+        g_pFindPhoneView = nullptr;
+    }
+
+    FindPhoneView *FindPhoneView::GetInstance()
+    {
+        return g_pFindPhoneView;
+    }
+
+    void FindPhoneView::ClearAll()
+    {
+        if (FindPhoneGroupView != nullptr)
+        {
+            FindPhoneGroupView->RemoveAll();
+
+            if (FindPhoneTitleLabel != nullptr)
+            {
+                delete FindPhoneTitleLabel;
+                FindPhoneTitleLabel = nullptr;
+            }
+            if (FindPhoneImageView != nullptr)
+            {
+                delete FindPhoneImageView;
+                FindPhoneImageView = nullptr;
+            }
+            if (FindPhoneImageAnimator != nullptr)
+            {
+                FindPhoneImageAnimator->Stop();
+                delete FindPhoneImageAnimator;
+                FindPhoneImageAnimator = nullptr;
+                FreeImageInfoArray(FindPhonePathsArray, FIND_PONE_IMAGE_SRC, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+            }
+            if (FindPhoneLabel != nullptr)
+            {
+                delete FindPhoneLabel;
+                FindPhoneLabel = nullptr;
+            }
+            if (FindPhoneLabelButton != nullptr)
+            {
+                delete FindPhoneLabelButton;
+                FindPhoneLabelButton = nullptr;
+            }
+            delete FindPhoneGroupView;
+            FindPhoneGroupView = nullptr;
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhoneView::ClearAll over!!");
+        }
+    }
+
+    /*蓝牙如果是未连接状态*/
+    void FindPhoneView::FindPhoneViewInit_BlueToothDisConnected(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhoneView::FindPhoneViewInit_BlueToothConnected");
+        if (FindPhoneGroupView == nullptr)
+        {
+            /* --------------------------- FindPhoneGroupView --------------------------- */
+            FindPhoneGroupView = new UIViewGroup();
+            if (FindPhoneGroupView == nullptr)
+            {
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FindPhoneViewInit_BlueToothConnected] FindPhoneGroupView new fail!!");
+                return;
+            }
+            FindPhoneGroupView->SetPosition(0, 0, 466, 466);
+            FindPhoneGroupView->SetStyle(STYLE_BACKGROUND_OPA, 0);
+            FindPhoneGroupView->SetTouchable(true);
+            FindPhoneGroupView->SetDraggable(true);
+            FindPhoneGroupView->SetOnDragListener(presenter_);
+            /* --------------------------- FindPhoneTitleLabel -------------------------- */
+            FindPhoneTitleLabel = new UILabelExt();
+            if (FindPhoneTitleLabel == nullptr)
+            {
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FindPhoneViewInit_BlueToothConnected] FindPhoneTitleLabel new fail!!");
+                return;
+            }
+            FindPhoneTitleLabel->SetPosition(83, 50, 300, 35);
+            FindPhoneTitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            FindPhoneTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            FindPhoneTitleLabel->SetTextId(STR_FIND_PHONE); // 查找手机
+            FindPhoneTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            FindPhoneTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            FindPhoneTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            /* ----------------------- FindPhoneImageView ---------------------- */
+            FindPhoneImageView = new UIImageView();
+            if (FindPhoneImageView == nullptr)
+            {
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FindPhoneViewInit_BlueToothConnected] FindPhoneTitleLabel new fail!!");
+                return;
+            }
+            FindPhoneImageView->SetPosition(193, 140, 80, 80);
+#ifdef FD230
+            FindPhoneImageView->SetSrc(PNG_ATTENTION_IMAGE);
+#endif
+            /* ----------------------------- FindPhoneLabel ----------------------------- */
+            FindPhoneLabel = new UILabelExt();
+            if (FindPhoneLabel == nullptr)
+            {
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] FindPhoneLabel new fail");
+                return;
+            }
+            FindPhoneLabel->SetPosition(83, 270, 300, 35);
+            FindPhoneLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            FindPhoneLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            FindPhoneLabel->SetTextId(STR_BLUETOOTH_DISCONNECTED); // 蓝牙未连接
+            FindPhoneLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            FindPhoneLabel->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+            FindPhoneLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            FindPhoneLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            /* -------------------------- FindPhoneLabelButton -------------------------- */
+            FindPhoneLabelButton = new UILabelButtonExt();
+            if (FindPhoneLabelButton == nullptr)
+            {
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] FindPhoneLabelButton new fail");
+                return;
+            }
+            FindPhoneLabelButton->SetPosition(0, 366, 466, 100);
+            FindPhoneLabelButton->SetViewId(FINDPHONE_LABELBUTTON);
+#ifdef FD230
+            FindPhoneLabelButton->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE);
+#endif
+            FindPhoneLabelButton->SetTextId(STR_CLOSE); // 关闭
+            FindPhoneLabelButton->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
+            FindPhoneLabelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            FindPhoneLabelButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+            FindPhoneLabelButton->SetOnClickListener(presenter_);
+            /* ----------------------------------- Add ---------------------------------- */
+            FindPhoneGroupView->Add(FindPhoneTitleLabel);
+            FindPhoneGroupView->Add(FindPhoneImageView);
+            FindPhoneGroupView->Add(FindPhoneLabel);
+            FindPhoneGroupView->Add(FindPhoneLabelButton);
+            AddViewToRootContainer(FindPhoneGroupView);
+        }
+    }
+
+    /*蓝牙如果是已连接状态将初始化这个视图*/
+    void FindPhoneView::FindPhoneViewInit_BlueToothConnected(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhoneView::FindPhoneViewInit_BlueToothConnected");
+        if (FindPhoneGroupView == nullptr)
+        {
+            /* --------------------------- FindPhoneGroupView --------------------------- */
+            FindPhoneGroupView = new UIViewGroup();
+            if (FindPhoneGroupView == nullptr)
+            {
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FindPhoneViewInit_BlueToothConnected] FindPhoneGroupView new fail!!");
+                return;
+            }
+            FindPhoneGroupView->SetPosition(0, 0, 466, 466);
+            FindPhoneGroupView->SetStyle(STYLE_BACKGROUND_OPA, 0);
+            FindPhoneGroupView->SetTouchable(true);
+            FindPhoneGroupView->SetDraggable(true);
+            FindPhoneGroupView->SetOnDragListener(presenter_);
+            /* --------------------------- FindPhoneTitleLabel -------------------------- */
+            FindPhoneTitleLabel = new UILabelExt();
+            if (FindPhoneTitleLabel == nullptr)
+            {
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FindPhoneViewInit_BlueToothConnected] FindPhoneTitleLabel new fail!!");
+                return;
+            }
+            FindPhoneTitleLabel->SetPosition(83, 50, 300, 35);
+            FindPhoneTitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            FindPhoneTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            FindPhoneTitleLabel->SetTextId(STR_FIND_PHONE); // 查找手机
+            FindPhoneTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            FindPhoneTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            FindPhoneTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            /* ----------------------- FindPhoneImageAnimator ---------------------- */
+            FindPhonePathsArray = CreateImageInfoArray(FIND_PONE_IMAGE_SRC, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+            if (FindPhoneImageAnimator == nullptr)
+            {
+                FindPhoneImageAnimator = new UIImageAnimatorView();
+                if (FindPhoneImageAnimator == nullptr)
+                {
+                    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] FindPhoneImageAnimator new fail");
+                    return;
+                }
+                for (uint8_t i = 0; i < FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
+                {
+                    // FindPhoneImageInfo[i].imagePath = (FindPhonePathsArray[i]);
+                    // FindPhoneImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+                    FindPhoneImageInfo[i].imageInfo = (FindPhonePathsArray[i]);
+                    FindPhoneImageInfo[i].imageType = IMG_SRC_IMAGE_INFO;
+                    FindPhoneImageInfo[i].pos.x = FINDPHONE_IMAGE_ANIMATOR_VIEW_X;
+                    FindPhoneImageInfo[i].pos.y = FINDPHONE_IMAGE_ANIMATOR_VIEW_Y;
+                    FindPhoneImageInfo[i].width = FINDPHONE_IMAGE_ANIMATOR_VIEW_W;
+                    FindPhoneImageInfo[i].height = FINDPHONE_IMAGE_ANIMATOR_VIEW_H;
+                }
+                FindPhoneImageAnimator->SetPosition(FINDPHONE_IMAGE_ANIMATOR_VIEW_X, FINDPHONE_IMAGE_ANIMATOR_VIEW_Y, FINDPHONE_IMAGE_ANIMATOR_VIEW_W, FINDPHONE_IMAGE_ANIMATOR_VIEW_H);
+                FindPhoneImageAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+                FindPhoneImageAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+                FindPhoneImageAnimator->SetImageAnimatorSrc(FindPhoneImageInfo, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, FINDPHONE_IMAGE_ANIMATOR_VIEW_TIMEOFUPDATE);
+                FindPhoneImageAnimator->SetRepeat(true);
+                FindPhoneImageAnimator->Start();
+            }
+            /* ----------------------------- FindPhoneLabel ----------------------------- */
+            FindPhoneLabel = new UILabelExt();
+            if (FindPhoneLabel == nullptr)
+            {
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] FindPhoneLabel new fail");
+                return;
+            }
+            FindPhoneLabel->SetPosition(83, 270, 300, 35);
+            FindPhoneLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            FindPhoneLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            FindPhoneLabel->SetTextId(STR_PHONE_RINGING_VIBRATING); // 手机正在响铃/震动
+            FindPhoneLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            FindPhoneLabel->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+            FindPhoneLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            FindPhoneLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            /* -------------------------- FindPhoneLabelButton -------------------------- */
+            FindPhoneLabelButton = new UILabelButtonExt();
+            if (FindPhoneLabelButton == nullptr)
+            {
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] FindPhoneLabelButton new fail");
+                return;
+            }
+            FindPhoneLabelButton->SetPosition(0, 366, 466, 100);
+            FindPhoneLabelButton->SetViewId(FINDPHONE_LABELBUTTON);
+#ifdef FD230
+            FindPhoneLabelButton->SetImageSrc(PNG_466x100BUTTON_IMAGE, PNG_466x100BUTTON_IMAGE);
+#endif
+            // FindPhoneLabelButton->SetText("停止");
+            FindPhoneLabelButton->SetTextId(STR_STOP);
+            FindPhoneLabelButton->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
+            FindPhoneLabelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            FindPhoneLabelButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+            FindPhoneLabelButton->SetOnClickListener(presenter_);
+            /* ----------------------------------- Add ---------------------------------- */
+            FindPhoneGroupView->Add(FindPhoneTitleLabel);
+            FindPhoneGroupView->Add(FindPhoneImageAnimator);
+            FindPhoneGroupView->Add(FindPhoneLabel);
+            FindPhoneGroupView->Add(FindPhoneLabelButton);
+            AddViewToRootContainer(FindPhoneGroupView);
+        }
+    }
+
+    void FindPhoneView::OnStart()
+    {
+        if (FindPhoneModel::GetInstance().GetBlueToothConnectedState() == true) // 判断蓝牙是否是连接状态
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phone is connected");
+            FindPhoneViewInit_BlueToothConnected();
+            FindPhoneModel::GetInstance().start_or_stop_find_phone(FINDPHONE_START);
+        }
+        else
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phone is not connected");
+            FindPhoneViewInit_BlueToothDisConnected();
+        }
+        return;
+    }
+}
\ No newline at end of file