优化电话代码结构,去掉不用代码
authorhcj <1224667075@qq.com>
Fri, 2 Aug 2024 06:34:39 +0000 (14:34 +0800)
committerhcj <1224667075@qq.com>
Fri, 2 Aug 2024 06:34:39 +0000 (14:34 +0800)
23 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h
code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h
code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingPresenter.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingView.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallupPresenter.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallupView.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneRingPresenter.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneRingView.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneView.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/include/phoneaddressmodel.h
code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingPresenter.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingView.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallupPresenter.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallupView.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirView.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingPresenter.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingView.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp
code/sdk/application/wearable/service/ble_service/bleservice/bleService.c

index 246a612..3e789a9 100644 (file)
@@ -672,12 +672,12 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneDirView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneDirPresenter.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallingView.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallingPresenter.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallupView.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallupPresenter.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneRingView.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneRingPresenter.cpp
+    # ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallingView.cpp
+    # ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallingPresenter.cpp
+    # ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallupView.cpp
+    # ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallupPresenter.cpp
+    # ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneRingView.cpp
+    # ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneRingPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/phoneaddressmodel.cpp
 
     #电话
index e88f797..3988b2e 100644 (file)
@@ -119,9 +119,9 @@ typedef enum : uint16_t
     VIEW_INDOORWALK,     // 室内步行
     VIEW_PHONE,          // 电话
     VIEW_PHONECALL,      // 拨号
-    VIEW_PHONERING,      // 拨号界面
-    VIEW_PHONECALLING,   // 来电
-    VIEW_PHONECALLUP,    // 通话界面
+    //VIEW_PHONERING,      // 拨号界面
+    // VIEW_PHONECALLING,   // 来电
+    // VIEW_PHONECALLUP,    // 通话界面
     VIEW_PHONEDIR,       // 电话簿
     VIEW_MAIN_PHONE,     // 主电话Slice
     VIEW_DIALING_METHOD, // 拨号方式
index e6ba0aa..228d6fd 100644 (file)
@@ -110,9 +110,9 @@ namespace OHOS
         // void InitPhoneSlice(void);
         void InitPhoneCallSlice(void);
         void InitPhoneDirSlice(void);
-        void InitPhoneCallingSlice(void);
-        void InitPhoneCallupSlice(void);
-        void InitPhoneRingSlice(void);
+        // //void InitPhoneCallingSlice(void);
+        // void InitPhoneCallupSlice(void);
+        // void InitPhoneRingSlice(void);
         void InitMainPhoneSlice(void);
         void InitDialingMethodSlice(void);
         /* -------------------------------------------------------------------------- */
index 3fd0115..6a6edb2 100644 (file)
 #include "phone/include/PhoneCallPresenter.h"
 #include "phone/include/PhoneDirView.h"
 #include "phone/include/PhoneDirPresenter.h"
-#include "phone/include/PhoneCallingView.h"
-#include "phone/include/PhoneCallingPresenter.h"
-#include "phone/include/PhoneCallupView.h"
-#include "phone/include/PhoneCallupPresenter.h"
-#include "phone/include/PhoneRingView.h"
-#include "phone/include/PhoneRingPresenter.h"
+// #include "phone/include/PhoneCallingView.h"
+// #include "phone/include/PhoneCallingPresenter.h"
+// #include "phone/include/PhoneCallupView.h"
+// #include "phone/include/PhoneCallupPresenter.h"
+// #include "phone/include/PhoneRingView.h"
+// #include "phone/include/PhoneRingPresenter.h"
 
 /* -------------------------------------------------------------------------- */
 #include "phone/include/MainPhoneView.h"
@@ -340,9 +340,9 @@ namespace OHOS
 
         {VIEW_PHONECALL, &NativeLauncher::InitPhoneCallSlice},
         {VIEW_PHONEDIR, &NativeLauncher::InitPhoneDirSlice},
-        {VIEW_PHONECALLING, &NativeLauncher::InitPhoneCallingSlice},
-        {VIEW_PHONECALLUP, &NativeLauncher::InitPhoneCallupSlice},
-        {VIEW_PHONERING, &NativeLauncher::InitPhoneRingSlice},
+        // {VIEW_PHONECALLING, &NativeLauncher::InitPhoneCallingSlice},
+        // {VIEW_PHONECALLUP, &NativeLauncher::InitPhoneCallupSlice},
+        // {VIEW_PHONERING, &NativeLauncher::InitPhoneRingSlice},
         {VIEW_MAIN_PHONE, &NativeLauncher::InitMainPhoneSlice},
         {VIEW_DIALING_METHOD, &NativeLauncher::InitDialingMethodSlice},
         {VIEW_TEST, &NativeLauncher::InittestSlice},
@@ -921,41 +921,41 @@ namespace OHOS
         NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONEDIR, phonedirview);
     }
 
-    void NativeLauncher::InitPhoneCallingSlice(void)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneCallingSlice");
-        SliceProxy *phonecallingview = new AbilitySliceProxy<PhoneCallingView, PhoneCallingPresenter>;
-        if (phonecallingview == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phonecallingview");
-            return;
-        }
-        NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONECALLING, phonecallingview);
-    }
+    // void NativeLauncher::InitPhoneCallingSlice(void)
+    // {
+    //     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneCallingSlice");
+    //     SliceProxy *phonecallingview = new AbilitySliceProxy<PhoneCallingView, PhoneCallingPresenter>;
+    //     if (phonecallingview == nullptr)
+    //     {
+    //         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phonecallingview");
+    //         return;
+    //     }
+    //     NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONECALLING, phonecallingview);
+    // }
 
-    void NativeLauncher::InitPhoneCallupSlice(void)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneCallupSlice");
-        SliceProxy *phonecallupview = new AbilitySliceProxy<PhoneCallupView, PhoneCallupPresenter>;
-        if (phonecallupview == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phonecallview");
-            return;
-        }
-        NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONECALLUP, phonecallupview);
-    }
+    // void NativeLauncher::InitPhoneCallupSlice(void)
+    // {
+    //     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneCallupSlice");
+    //     SliceProxy *phonecallupview = new AbilitySliceProxy<PhoneCallupView, PhoneCallupPresenter>;
+    //     if (phonecallupview == nullptr)
+    //     {
+    //         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phonecallview");
+    //         return;
+    //     }
+    //     NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONECALLUP, phonecallupview);
+    // }
 
-    void NativeLauncher::InitPhoneRingSlice(void)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneRingSlice");
-        SliceProxy *phoneringview = new AbilitySliceProxy<PhoneRingView, PhoneRingPresenter>;
-        if (phoneringview == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneringview");
-            return;
-        }
-        NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONERING, phoneringview);
-    }
+    // void NativeLauncher::InitPhoneRingSlice(void)
+    // {
+    //     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneRingSlice");
+    //     SliceProxy *phoneringview = new AbilitySliceProxy<PhoneRingView, PhoneRingPresenter>;
+    //     if (phoneringview == nullptr)
+    //     {
+    //         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneringview");
+    //         return;
+    //     }
+    //     NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONERING, phoneringview);
+    // }
 
     void NativeLauncher::InitCalculatorSlice(void)
     {
index 6a41adb..7186316 100644 (file)
@@ -8,7 +8,7 @@
 #include "UiConfig.h"
 #include "CallerLogModel.h"
 #include "MainCallingPresenter.h"
-
+#include "phone/include/phoneaddressmodel.h"
 namespace OHOS {
 static constexpr uint16 MATH_ZERO = 0;
 // 挂断按钮位置
@@ -96,7 +96,16 @@ bool WaitingHintsView::InitUILabelDisplay()
     callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y,
         VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);
     callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
-    callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+    char name_buf[30]={0};
+    if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str()))
+    {
+        callerDisplay->SetText(name_buf);
+    }
+    else
+    {
+       callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+    }
+    
     callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER);
     callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_DISPLAY_FONE_SIZE);
     callerDisplay->SetTextColor(Color::White());
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingPresenter.h
deleted file mode 100644 (file)
index fe5f1f2..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _PhoneCalling_PRESENTER_H\r
-#define _PhoneCalling_PRESENTER_H\r
-\r
-#include "Presenter.h"\r
-#include "PhoneCallingView.h"\r
-\r
-namespace OHOS\r
-{\r
-    class PhoneCallingView;\r
-\r
-    class PhoneCallingPresenter : public Presenter<PhoneCallingView>,\r
-                               public UIView::OnClickListener,\r
-                               public UIView::OnDragListener\r
-    {\r
-    public:\r
-        PhoneCallingPresenter();\r
-        virtual ~PhoneCallingPresenter();\r
-\r
-        void OnStart() override;\r
-        void OnPause() override;\r
-        void OnResume() override;\r
-        void OnStop() override;\r
-\r
-        static PhoneCallingPresenter *GetInstance();\r
-\r
-    private:\r
-        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
-        bool OnClick(UIView &view, const ClickEvent &event) override;\r
-        bool OnDrag(UIView &view, const DragEvent &event) override;\r
-    };\r
-} // namespace OHOS\r
-\r
-#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingView.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingView.h
deleted file mode 100644 (file)
index 697e7b0..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef _PhoneCalling_VIEW_H\r
-#define _PhoneCalling_VIEW_H\r
-\r
-#include "BaseView.h"\r
-#include "View.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_view_group.h"\r
-#include "components/ui_label.h"\r
-#include "components/ui_label_ext.h"\r
-#include "components/ui_image_view.h"\r
-#include "components/ui_button.h"\r
-#include "components/ui_image_animator.h"\r
-\r
-#include "PhoneCallingPresenter.h"\r
-namespace OHOS\r
-{\r
-#define PHONECALLBUTTON "phonecall"\r
-#define PHONEOFFBUTTON "phoneoff"\r
-\r
-\r
-    class PhoneCallingPresenter;\r
-    class PhoneCallingView : public View<PhoneCallingPresenter>\r
-    {\r
-\r
-    public:\r
-        PhoneCallingView();\r
-        virtual ~PhoneCallingView();\r
-        static PhoneCallingView *GetInstance(void);\r
-\r
-        void OnStart() override;\r
-        void OnSetUpView() override;\r
-        void OnTearDownView() override;\r
-        void OnStop() override;\r
-        void Init();\r
-        void DeInit();\r
-\r
-        UIView *GetView();\r
-\r
-    private:\r
-        UIView::OnDragListener *draglistener{nullptr};\r
-        PhoneCallingView(PhoneCallingView &&) = delete;\r
-        PhoneCallingView &operator=(PhoneCallingView &&) = delete;\r
-\r
-        UIViewGroup *container_ = nullptr;\r
-        UILabel *label1_ = nullptr;\r
-        UILabel *label2_ = nullptr;\r
-        UIButton *button2_ = nullptr;\r
-        UIImageView *image1_ = nullptr;\r
-        UIButton *button1_ = nullptr;\r
-        UIImageAnimatorView *imageAnimator1_ = nullptr;\r
-        UILabel *label3_ = nullptr;\r
-    };\r
-} // namespace OHOS\r
-#endif // PhoneCalling_PRESENTER_H\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallupPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallupPresenter.h
deleted file mode 100644 (file)
index b7b32cf..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef _PhoneCallup_PRESENTER_H\r
-#define _PhoneCallup_PRESENTER_H\r
-\r
-#include "Presenter.h"\r
-#include "PhoneCallupView.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
-#define OFFBUTTON "button1"\r
-\r
-    class PhoneCallupView;\r
-\r
-    class PhoneCallupPresenter : public Presenter<PhoneCallupView>,\r
-                                 public UIView::OnClickListener,\r
-                                 public UIView::OnDragListener,\r
-                                 public UIView::OnLongPressListener\r
-    {\r
-    public:\r
-        PhoneCallupPresenter();\r
-        virtual ~PhoneCallupPresenter();\r
-\r
-        void OnStart() override;\r
-        void OnPause() override;\r
-        void OnResume() override;\r
-        void OnStop() override;\r
-\r
-        static PhoneCallupPresenter *GetInstance();\r
-\r
-    private:\r
-        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
-        bool OnClick(UIView &view, const ClickEvent &event) override;\r
-        bool OnDrag(UIView &view, const DragEvent &event) override;\r
-        bool OnLongPress(UIView &view, const LongPressEvent &event) override;\r
-    };\r
-} // namespace OHOS\r
-\r
-#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallupView.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallupView.h
deleted file mode 100644 (file)
index 3e6c05b..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef _PhoneCallup_VIEW_H\r
-#define _PhoneCallup_VIEW_H\r
-\r
-#include "BaseView.h"\r
-#include "View.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_view_group.h"\r
-#include "components/ui_label.h"\r
-#include "components/ui_label_ext.h"\r
-#include "components/ui_image_view.h"\r
-#include "components/ui_toggle_button.h"\r
-#include "components/ui_button.h"\r
-#include "animator/animator.h"\r
-\r
-#include "PhoneCallupPresenter.h"\r
-namespace OHOS\r
-{\r
-    class PhoneAnimatorCallback : public AnimatorCallback\r
-    {\r
-    public:\r
-        explicit PhoneAnimatorCallback(UILabel *label) : label_(label) {}\r
-        ~PhoneAnimatorCallback() override {}\r
-        void Callback(UIView *view) override;\r
-\r
-    private:\r
-        UILabel *label_ = nullptr;\r
-    };\r
-    class PhoneCallupPresenter;\r
-    class PhoneCallupView : public View<PhoneCallupPresenter>\r
-    {\r
-\r
-    public:\r
-        explicit PhoneCallupView();\r
-        virtual ~PhoneCallupView();\r
-        static PhoneCallupView *GetInstance(void);\r
-\r
-        void OnStart() override;\r
-        void OnSetUpView() override;\r
-        void OnTearDownView() override;\r
-        void OnStop() override;\r
-        void Init();\r
-        void DeInit();\r
-        UIView *GetView();\r
-\r
-    private:\r
-        UIView::OnDragListener *draglistener{nullptr};\r
-        PhoneCallupView(PhoneCallupView &&) = delete;\r
-        PhoneCallupView &operator=(PhoneCallupView &&) = delete;\r
-\r
-        UIViewGroup *container_ = nullptr;\r
-        UILabel *label2_ = nullptr;\r
-        UILabel *label1_ = nullptr;\r
-        UIToggleButton *toggleButton1_ = nullptr;\r
-        UIImageView *image1_ = nullptr;\r
-        UIToggleButton *toggleButton2_ = nullptr;\r
-        UIButton *button1_ = nullptr;\r
-        UIButton *button2_ = nullptr;\r
-        PhoneAnimatorCallback *callBack_ = nullptr;\r
-        Animator *animator_ = nullptr;\r
-    };\r
-} // namespace OHOS\r
-#endif // PhoneCallup_PRESENTER_H\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneRingPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneRingPresenter.h
deleted file mode 100644 (file)
index e2e16c0..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _PhoneRing_PRESENTER_H\r
-#define _PhoneRing_PRESENTER_H\r
-\r
-#include "Presenter.h"\r
-#include "PhoneRingView.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
-#define OFFBUTTON "button1"\r
-\r
-    class PhoneRingView;\r
-\r
-    class PhoneRingPresenter : public Presenter<PhoneRingView>,\r
-                                 public UIView::OnClickListener,\r
-                                 public UIView::OnDragListener\r
-    {\r
-    public:\r
-        PhoneRingPresenter();\r
-        virtual ~PhoneRingPresenter();\r
-\r
-        void OnStart() override;\r
-        void OnPause() override;\r
-        void OnResume() override;\r
-        void OnStop() override;\r
-\r
-        static PhoneRingPresenter *GetInstance();\r
-\r
-    private:\r
-        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
-        bool OnClick(UIView &view, const ClickEvent &event) override;\r
-        bool OnDrag(UIView &view, const DragEvent &event) override;\r
-    };\r
-} // namespace OHOS\r
-\r
-#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneRingView.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneRingView.h
deleted file mode 100644 (file)
index 29b896c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef _PhoneRing_VIEW_H\r
-#define _PhoneRing_VIEW_H\r
-\r
-#include "BaseView.h"\r
-#include "View.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_view_group.h"\r
-#include "components/ui_label.h"\r
-#include "components/ui_label_ext.h"\r
-#include "components/ui_image_view.h"\r
-#include "components/ui_toggle_button.h"\r
-#include "components/ui_button.h"\r
-\r
-#include "PhoneRingPresenter.h"\r
-namespace OHOS\r
-{\r
-\r
-    class PhoneRingPresenter;\r
-    class PhoneRingView : public View<PhoneRingPresenter>\r
-    {\r
-\r
-    public:\r
-        PhoneRingView();\r
-        virtual ~PhoneRingView();\r
-        static PhoneRingView *GetInstance(void);\r
-\r
-        void OnStart() override;\r
-        void OnSetUpView() override;\r
-        void OnTearDownView() override;\r
-        void OnStop() override;\r
-        void Init();\r
-        void DeInit();\r
-\r
-        UIView *GetView();\r
-\r
-    private:\r
-        UIView::OnDragListener *draglistener{nullptr};\r
-        PhoneRingView(PhoneRingView &&) = delete;\r
-        PhoneRingView &operator=(PhoneRingView &&) = delete;\r
-\r
-        UIViewGroup *container_ = nullptr;\r
-        UILabel *label2_ = nullptr;\r
-        UILabel *label1_ = nullptr;\r
-        UIToggleButton *toggleButton1_ = nullptr;\r
-        UIImageView *image1_ = nullptr;\r
-        UIToggleButton *toggleButton2_ = nullptr;\r
-        UIButton *button1_ = nullptr;\r
-    };\r
-} // namespace OHOS\r
-#endif // PhoneRing_PRESENTER_H\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneView.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneView.h
deleted file mode 100644 (file)
index 77b27c8..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef _Phone_VIEW_H\r
-#define _Phone_VIEW_H\r
-\r
-#include "BaseView.h"\r
-#include "View.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_view_group.h"\r
-#include "components/ui_label.h"\r
-#include "components/ui_label_ext.h"\r
-#include "components/ui_image_view.h"\r
-#include "components/ui_button.h"\r
-\r
-#include "PhonePresenter.h"\r
-namespace OHOS\r
-{\r
-#define SCROLLVIEW "scrollView1"\r
-#define CALLBUTTON "Call"\r
-#define RINGBUTTON "Ring"\r
-\r
-    class PhonePresenter;\r
-    class PhoneView : public View<PhonePresenter>\r
-    {\r
-\r
-    public:\r
-        PhoneView();\r
-        virtual ~PhoneView();\r
-        static PhoneView *GetInstance(void);\r
-\r
-        void OnStart() override;\r
-        void OnSetUpView() override;\r
-        void OnTearDownView() override;\r
-        void OnStop() override;\r
-        void Init();\r
-        void DeInit();\r
-        \r
-        UIView *GetView();\r
-\r
-    private:\r
-        UIView::OnDragListener *draglistener{nullptr};\r
-        PhoneView(PhoneView &&) = delete;\r
-        PhoneView &operator=(PhoneView &&) = delete;\r
-        \r
-        UIViewGroup *container_ = nullptr;\r
-        UIScrollView *scrollView1_ = nullptr;\r
-        UILabel *label1_ = nullptr;\r
-        UIImageView *image1_ = nullptr;\r
-        UIButton *button2_ = nullptr;\r
-        UIButton *button1_ = nullptr;\r
-        UIButton *button5_ = nullptr;\r
-        UILabel *label2_ = nullptr;\r
-        UILabel *label3_ = nullptr;\r
-        UILabel *label4_ = nullptr;\r
-        UILabel *label9_ = nullptr;\r
-        UILabel *label14_ = nullptr;\r
-        UIButton *button3_ = nullptr;\r
-        UILabel *label13_ = nullptr;\r
-        UILabel *label12_ = nullptr;\r
-        UILabel *label10_ = nullptr;\r
-        UIButton *button7_ = nullptr;\r
-        UILabel *label11_ = nullptr;\r
-        UILabel *label16_ = nullptr;\r
-        UILabel *label15_ = nullptr;\r
-        UIImageView *image3_ = nullptr;\r
-    };\r
-} // namespace OHOS\r
-#endif // Phone_PRESENTER_H\r
index fa869e1..7424829 100644 (file)
@@ -10,7 +10,7 @@
 #define OPERATOR_LEN (4*3)
 namespace OHOS
 {
-
+#pragma pack(1)
 struct phone_number
 {
     char number[NUMBER_LEN];
@@ -27,23 +27,26 @@ struct Contact
     uint8_t sex;
     struct phone_number phone_number_t[2];
 };
-
+#pragma pack()
 
 struct addressbook
 {
     uint16_t num=0;
     struct Contact Contact_t[20];
 };
+extern struct addressbook addressbook_t;
 
 void read_addressbook_to_struct(char *buf);
 
 void read_addressbook_bin_file();
 
-void write_addressbook_bin_flle();
+
+ void write_addressbook_bin_flle();
+
 
 void add_addressbook(struct Contact *data);
  
-void get_phone_addrss_name(char *name,const char *phone);
+bool get_phone_addrss_name(char *name,const char *phone);
 
 void free_address();
 
index 8bc372e..614bdb7 100644 (file)
@@ -8,7 +8,7 @@
 #include "phone/include/MainPhoneView.h"
 #include "phone/include/MainPhonePresenter.h"
 #include "components/ui_label_button_ext.h"
-
+#include "phone/include/phoneaddressmodel.h"
 #include "wearable_log.h"
 namespace OHOS
 {
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingPresenter.cpp
deleted file mode 100644 (file)
index ab73284..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#include "AppViewIDs.h"\r
-#include "components/ui_label_ext.h"\r
-#include"ui_resource_string.h"\r
-#include "NativeAbility.h"\r
-\r
-#include "phone/include/PhoneCallingPresenter.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
-    // 当前Presenter属性实例化的内存指针\r
-    static PhoneCallingPresenter *g_pPhoneCallingPresenter = nullptr;\r
-\r
-    PhoneCallingPresenter::PhoneCallingPresenter()\r
-    {\r
-\r
-        g_pPhoneCallingPresenter = this;\r
-    }\r
-\r
-    PhoneCallingPresenter::~PhoneCallingPresenter()\r
-    {\r
-\r
-        g_pPhoneCallingPresenter = nullptr;\r
-    }\r
-\r
-    PhoneCallingPresenter *PhoneCallingPresenter::GetInstance()\r
-    {\r
-\r
-        return g_pPhoneCallingPresenter;\r
-    }\r
-\r
-    void PhoneCallingPresenter::OnStart()\r
-    {\r
-\r
-        Presenter<PhoneCallingView>::OnStart();\r
-    }\r
-\r
-    void PhoneCallingPresenter::OnPause(void)\r
-    {\r
-\r
-        Presenter<PhoneCallingView>::OnPause();\r
-    }\r
-\r
-    void PhoneCallingPresenter::OnResume(void)\r
-    {\r
-\r
-        Presenter<PhoneCallingView>::OnResume();\r
-    }\r
-\r
-    void PhoneCallingPresenter::OnStop(void)\r
-    {\r
-\r
-        Presenter<PhoneCallingView>::OnStop();\r
-    }\r
-\r
-    bool PhoneCallingPresenter::OnDrag(UIView &view, const DragEvent &event)\r
-    {\r
-\r
-        // if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT)\r
-        // {\r
-        //     printf("draglistene is ok!\n");\r
-        //     NativeAbility::GetInstance().ChangeSlice(VIEW_PHONE);\r
-        // }\r
-         UNUSED(view);\r
-         return true;\r
-    }\r
-\r
-    bool PhoneCallingPresenter::OnClick(UIView &view, const ClickEvent &event)\r
-    {\r
-        // 根据控件id查找是哪个控件触发了点击回调\r
-        // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
-        if (strcmp(view.GetViewId(), PHONECALLBUTTON) == 0)\r
-        {\r
-           NativeAbility::GetInstance().ChangeSlice(VIEW_PHONECALLUP);\r
-        }\r
-        if (strcmp(view.GetViewId(), PHONEOFFBUTTON) == 0)\r
-        {\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_PHONE);\r
-        }\r
-        return true;\r
-    }\r
-}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingView.cpp
deleted file mode 100644 (file)
index 00db57a..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-\r
-\r
-#include "phone/include/PhoneCallingView.h"\r
-\r
-#include "common/image_cache_manager.h"\r
-#include "UiConfig.h"\r
-#include "ui_resource_image.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_button.h"\r
-namespace OHOS\r
-{\r
-\r
-    static PhoneCallingView *g_pPhoneCallingView{nullptr};\r
-\r
-#ifdef _WIN32\r
-    const char *IMAGEANIMATOR1_1_PATH = "c:/Users/caiking/project/image_converter_tool/output/Phone/phone-call.bin";\r
-#else\r
-    const char *IMAGEANIMATOR1_1_PATH = "/user/res/Phone/phone-call.bin";\r
-#endif\r
-#ifdef _WIN32\r
-    const char *IMAGEANIMATOR1_2_PATH = "c:/Users/caiking/project/image_converter_tool/output/Phone/phone-call1.bin";\r
-#else\r
-    const char *IMAGEANIMATOR1_2_PATH = "/user/res/Phone/phone-call1.bin";\r
-#endif\r
-\r
-    static ImageAnimatorInfo g_imageAnimator1Info[2] = {\r
-        {IMAGEANIMATOR1_1_PATH, {369, 207}, 52, 52, IMG_SRC_FILE_PATH},\r
-        {IMAGEANIMATOR1_2_PATH, {369, 207}, 52, 52, IMG_SRC_FILE_PATH},\r
-    };\r
-\r
-    PhoneCallingView::PhoneCallingView()\r
-    {\r
-\r
-        g_pPhoneCallingView = this;\r
-    }\r
-\r
-    PhoneCallingView::~PhoneCallingView()\r
-    {\r
-        DeInit();\r
-        g_pPhoneCallingView = nullptr;\r
-    }\r
-\r
-    PhoneCallingView *PhoneCallingView::GetInstance()\r
-    {\r
-\r
-        return g_pPhoneCallingView;\r
-    }\r
-\r
-    void PhoneCallingView::Init()\r
-    {\r
-        if (container_ == nullptr)\r
-        {\r
-            container_ = new UIViewGroup();\r
-            container_->SetPosition(0, 0, 466, 466);\r
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
-        }\r
-\r
-        // Add Label to App\r
-        if (label1_ == nullptr)\r
-        {\r
-            label1_ = new UILabel();\r
-        }\r
-        label1_->SetPosition(203, 52); // widget's left position and top position\r
-        label1_->Resize(200, 60);      // widget's width and height\r
-        label1_->SetViewId("label1");  // Set style\r
-        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
-\r
-        // Set additional property\r
-        label1_->SetText("来电");\r
-        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label1_->SetRollSpeed(0);\r
-        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
-        // Add to rootView\r
-        container_->Add(label1_);\r
-        label1_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label2_ == nullptr)\r
-        {\r
-            label2_ = new UILabel();\r
-        }\r
-        label2_->SetPosition(104, 109); // widget's left position and top position\r
-        label2_->Resize(249, 40);       // widget's width and height\r
-        label2_->SetViewId("label2");   // Set style\r
-        label2_->SetStyle(STYLE_TEXT_FONT, 40);\r
-\r
-        // Set additional property\r
-        label2_->SetText("15576711544");\r
-        label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label2_->SetRollSpeed(0);\r
-        label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);\r
-\r
-        // Add to rootView\r
-        container_->Add(label2_);\r
-        label2_->SetVisible(true);\r
-\r
-        // Add Button to App\r
-        if (button2_ == nullptr)\r
-        {\r
-            button2_ = new UIButton();\r
-        }\r
-        button2_->SetPosition(369, 207);      // widget's left position and top position\r
-        button2_->Resize(52, 52);             // widget's width and height\r
-        button2_->SetViewId(PHONECALLBUTTON); // Set style\r
-        button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
-        button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-        button2_->SetStyle(STYLE_IMAGE_OPA, 0);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button2defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/phone-call.bin";\r
-#else\r
-        char *button2defaultImgSrc = "/user/res/Phone/phone-call.bin";\r
-#endif\r
-        char *button2triggeredImgSrc = nullptr;\r
-        button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc);\r
-        button2_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button2Click = static_cast<UIView::OnClickListener *>(PhoneCallingPresenter::GetInstance());\r
-        button2_->SetOnClickListener(button2Click);\r
-        // Add to rootView\r
-        container_->Add(button2_);\r
-        button2_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image1_ == nullptr)\r
-        {\r
-            image1_ = new UIImageView();\r
-        }\r
-        image1_->SetPosition(158, 174); // widget's left position and top position\r
-        image1_->Resize(100, 100);      // widget's width and height\r
-        image1_->SetViewId("image1");   // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/boy.bin";\r
-#else\r
-        char *image1imagesPath = "/user/res/Phone/boy.bin";\r
-#endif\r
-        image1_->SetSrc(image1imagesPath);\r
-\r
-        // Add to rootView\r
-        container_->Add(image1_);\r
-        image1_->SetVisible(true);\r
-\r
-        // Add Button to App\r
-        if (button1_ == nullptr)\r
-        {\r
-            button1_ = new UIButton();\r
-        }\r
-        button1_->SetPosition(46, 207);      // widget's left position and top position\r
-        button1_->Resize(52, 52);            // widget's width and height\r
-        button1_->SetViewId(PHONEOFFBUTTON); // Set style\r
-        button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
-        button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button1defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/phone-off.bin";\r
-#else\r
-        char *button1defaultImgSrc = "/user/res/Phone/phone-off.bin";\r
-#endif\r
-        char *button1triggeredImgSrc = nullptr;\r
-        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
-        button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(PhoneCallingPresenter::GetInstance());\r
-        button1_->SetOnClickListener(button1Click);\r
-        // Add to rootView\r
-        container_->Add(button1_);\r
-        button1_->SetVisible(true);\r
-\r
-        // Add ImageAnimatorView to App\r
-        if (imageAnimator1_ == nullptr)\r
-        {\r
-            imageAnimator1_ = new UIImageAnimatorView();\r
-        }\r
-        imageAnimator1_->SetPosition(369, 207);       // widget's left position and top position\r
-        imageAnimator1_->Resize(52, 52);              // widget's width and height\r
-        imageAnimator1_->SetViewId("imageAnimator1"); // Set style\r
-        imageAnimator1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
-        imageAnimator1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
-\r
-        // Set additional property\r
-        imageAnimator1_->SetImageAnimatorSrc(g_imageAnimator1Info, 2, 200);\r
-        imageAnimator1_->SetTimeOfPause(200);\r
-        imageAnimator1_->SetRepeatTimes(1);\r
-        imageAnimator1_->SetReverse(true);\r
-        imageAnimator1_->Start();\r
-\r
-        // Add to rootView\r
-        container_->Add(imageAnimator1_);\r
-        imageAnimator1_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label3_ == nullptr)\r
-        {\r
-            label3_ = new UILabel();\r
-        }\r
-        label3_->SetPosition(167, 353); // widget's left position and top position\r
-        label3_->Resize(132, 35);       // widget's width and height\r
-        label3_->SetViewId("label3");   // Set style\r
-        label3_->SetStyle(STYLE_TEXT_FONT, 30);\r
-\r
-        // Set additional property\r
-        label3_->SetText("挂断/接听");\r
-        label3_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label3_->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff));\r
-        label3_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label3_->SetRollSpeed(0);\r
-        label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
-        // Add to rootView\r
-        container_->Add(label3_);\r
-        label3_->SetVisible(true);\r
-    }\r
-\r
-    void PhoneCallingView::DeInit()\r
-    {\r
-        if (container_ != nullptr)\r
-        {\r
-            container_->RemoveAll();\r
-            delete container_;\r
-            container_ = nullptr;\r
-        }\r
-        if (label1_ != nullptr)\r
-        {\r
-            delete label1_;\r
-            label1_ = nullptr;\r
-        }\r
-        if (label2_ != nullptr)\r
-        {\r
-            delete label2_;\r
-            label2_ = nullptr;\r
-        }\r
-        if (button2_ != nullptr)\r
-        {\r
-            delete button2_;\r
-            button2_ = nullptr;\r
-        }\r
-        if (image1_ != nullptr)\r
-        {\r
-            delete image1_;\r
-            image1_ = nullptr;\r
-        }\r
-        if (button1_ != nullptr)\r
-        {\r
-            delete button1_;\r
-            button1_ = nullptr;\r
-        }\r
-        if (imageAnimator1_ != nullptr)\r
-        {\r
-            delete imageAnimator1_;\r
-            imageAnimator1_ = nullptr;\r
-        }\r
-        if (label3_ != nullptr)\r
-        {\r
-            delete label3_;\r
-            label3_ = nullptr;\r
-        }\r
-    }\r
-\r
-    UIView *PhoneCallingView::GetView()\r
-    {\r
-        Init();\r
-        return container_;\r
-    }\r
-\r
-    void PhoneCallingView::OnStart()\r
-    {\r
-        container_ = new UIScrollView();\r
-        if (container_ == nullptr)\r
-        {\r
-            return;\r
-        }\r
-        container_->SetPosition(0, 0);\r
-        container_->SetWidth(Screen::GetInstance().GetWidth());\r
-        container_->SetHeight(Screen::GetInstance().GetHeight());\r
-\r
-        // 创建 draglistener 实例并设置为拖动监听器\r
-        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(PhoneCallingPresenter::GetInstance());\r
-        if (draglistener == nullptr)\r
-        {\r
-            return;\r
-        }\r
-        container_->SetOnDragListener(draglistener);\r
-\r
-        container_->SetTouchable(true);\r
-        container_->SetDraggable(true);\r
-\r
-        GetView();\r
-        RootView::GetInstance()->Add(container_);\r
-    }\r
-\r
-    void PhoneCallingView::OnSetUpView()\r
-    {\r
-\r
-        View<PhoneCallingPresenter>::OnSetUpView();\r
-        Draw();\r
-    }\r
-\r
-    void PhoneCallingView::OnTearDownView()\r
-    {\r
-\r
-        View<PhoneCallingPresenter>::OnTearDownView();\r
-        return;\r
-    }\r
-\r
-    void PhoneCallingView::OnStop()\r
-    {\r
-        View<PhoneCallingPresenter>::OnStop();\r
-        RootView::GetInstance()->RemoveAll();\r
-        return;\r
-    }\r
-}\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallupPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallupPresenter.cpp
deleted file mode 100644 (file)
index fbf2aab..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "AppViewIDs.h"\r
-#include "components/ui_label_ext.h"\r
-#include"ui_resource_string.h"\r
-#include "NativeAbility.h"\r
-\r
-#include "phone/include/PhoneCallupPresenter.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
-    // 当前Presenter属性实例化的内存指针\r
-    static PhoneCallupPresenter *g_pPhoneCallupPresenter = nullptr;\r
-\r
-    PhoneCallupPresenter::PhoneCallupPresenter()\r
-    {\r
-\r
-        g_pPhoneCallupPresenter = this;\r
-    }\r
-\r
-    PhoneCallupPresenter::~PhoneCallupPresenter()\r
-    {\r
-\r
-        g_pPhoneCallupPresenter = nullptr;\r
-    }\r
-\r
-    PhoneCallupPresenter *PhoneCallupPresenter::GetInstance()\r
-    {\r
-\r
-        return g_pPhoneCallupPresenter;\r
-    }\r
-\r
-    void PhoneCallupPresenter::OnStart()\r
-    {\r
-\r
-        Presenter<PhoneCallupView>::OnStart();\r
-    }\r
-\r
-    void PhoneCallupPresenter::OnPause(void)\r
-    {\r
-\r
-        Presenter<PhoneCallupView>::OnPause();\r
-    }\r
-\r
-    void PhoneCallupPresenter::OnResume(void)\r
-    {\r
-\r
-        Presenter<PhoneCallupView>::OnResume();\r
-    }\r
-\r
-    void PhoneCallupPresenter::OnStop(void)\r
-    {\r
-\r
-        Presenter<PhoneCallupView>::OnStop();\r
-    }\r
-\r
-    bool PhoneCallupPresenter::OnDrag(UIView &view, const DragEvent &event)\r
-    {\r
-\r
-        // if (event.GetDragCallupection() == DragEvent::CallupECTION_RIGHT_TO_LEFT)\r
-        // {\r
-        //     printf("draglistene is ok!\n");\r
-        //     NativeAbility::GetInstance().ChangeSlice(VIEW_PHONE);\r
-        // }\r
-        UNUSED(view);\r
-        return true;\r
-    }\r
-\r
-    bool PhoneCallupPresenter::OnClick(UIView &view, const ClickEvent &event)\r
-    {\r
-        // 根据控件id查找是哪个控件触发了点击回调\r
-        if (strcmp(view.GetViewId(), OFFBUTTON) == 0)\r
-        {\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_PHONE);\r
-        }\r
-        if (strcmp(view.GetViewId(), "button2") == 0)\r
-        {\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM_VOLUME);\r
-        }\r
-\r
-        return true;\r
-    }\r
-    bool PhoneCallupPresenter::OnLongPress(UIView &view, const LongPressEvent &event)\r
-    {\r
-        // 1.长按button1\r
-        // 2.退出 button1NativeAbility::GetInstance().ChangeSlice(VIEW_SAVEELE);\r
-        // 3.返回 true 以消耗点击事件\r
-        if (strcmp(view.GetViewId(), "toggleButton2") == 0)\r
-        {\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM_VOLUME);\r
-        }\r
-        return true;\r
-    }\r
-}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallupView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallupView.cpp
deleted file mode 100644 (file)
index 0e4e96b..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-\r
-\r
-#include "phone/include/PhoneCallupView.h"\r
-\r
-#include "common/image_cache_manager.h"\r
-#include "UiConfig.h"\r
-#include "ui_resource_image.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_button.h"\r
-#include "sys/time.h"\r
-#include "securec.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
-    static PhoneCallupView *g_pPhoneCallupView{nullptr};\r
-    static constexpr int16_t TIME_CONVERT = 60; // sec to min, and min to hor\r
-    static constexpr int16_t USEC_TO_MILLI = 1000;\r
-    static constexpr int16_t TEXT_BUFFER_SIEZ = 20;\r
-\r
-    PhoneCallupView::PhoneCallupView()\r
-    {\r
-        g_pPhoneCallupView = this;\r
-    }\r
-    PhoneCallupView::~PhoneCallupView()\r
-    {\r
-        DeInit();\r
-        animator_->~Animator();\r
-        g_pPhoneCallupView = nullptr;\r
-    }\r
-\r
-    PhoneCallupView *PhoneCallupView::GetInstance()\r
-    {\r
-\r
-        return g_pPhoneCallupView;\r
-    }\r
-    void GetTime(char *buf, int len)\r
-    {\r
-        struct timeval tv;\r
-        gettimeofday(&tv, NULL);\r
-        uint32_t second = tv.tv_sec % TIME_CONVERT;\r
-        uint32_t minute = tv.tv_sec / TIME_CONVERT;\r
-        uint32_t hour = (minute / TIME_CONVERT) % 24; // 24: 24 hours per day\r
-        uint32_t realMilliSecond = tv.tv_usec / USEC_TO_MILLI;\r
-        minute = minute % TIME_CONVERT;\r
-\r
-        sprintf_s(buf, len, "%02d : %02d", minute, second);\r
-    }\r
-    void PhoneAnimatorCallback::Callback(UIView *view)\r
-    {\r
-        (void)view;\r
-        char buf[TEXT_BUFFER_SIEZ] = {0};\r
-        GetTime(buf, TEXT_BUFFER_SIEZ);\r
-        label_->SetText(buf);\r
-        RootView::GetInstance()->Invalidate();\r
-    }\r
-    void PhoneCallupView::Init()\r
-    {\r
-        if (container_ == nullptr)\r
-        {\r
-            container_ = new UIViewGroup();\r
-            container_->SetPosition(0, 0, 466, 466);\r
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
-        }\r
-        // Add Label to App\r
-        if (label2_ == nullptr)\r
-        {\r
-            label2_ = new UILabel();\r
-        }\r
-        char buf[TEXT_BUFFER_SIEZ] = {0};\r
-        GetTime(buf, TEXT_BUFFER_SIEZ);\r
-        label2_->SetPosition(190, 52); // widget's left position and top position\r
-        label2_->Resize(85, 35);       // widget's width and height\r
-        label2_->SetViewId("label2");  // Set style\r
-        label2_->SetStyle(STYLE_TEXT_FONT, 35);\r
-        // Set additional property\r
-        label2_->SetText(buf);\r
-        label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label2_->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff));\r
-        label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        // label2_->SetRollSpeed(0);\r
-        label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35);\r
-\r
-        // Add to rootView\r
-        callBack_ = new PhoneAnimatorCallback(label2_);\r
-        animator_ = new Animator(callBack_, label2_, 0, true);\r
-        animator_->Start();\r
-\r
-        container_->Add(label2_);\r
-        label2_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label1_ == nullptr)\r
-        {\r
-            label1_ = new UILabel();\r
-        }\r
-        label1_->SetPosition(109, 104); // widget's left position and top position\r
-        label1_->Resize(249, 40);       // widget's width and height\r
-        label1_->SetViewId("label1");   // Set style\r
-        label1_->SetStyle(STYLE_TEXT_FONT, 40);\r
-\r
-        // Set additional property\r
-        label1_->SetText("155 7671 1544");\r
-        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label1_->SetRollSpeed(0);\r
-        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);\r
-\r
-        container_->Add(label1_);\r
-        label1_->SetVisible(true);\r
-\r
-        // Add ToggleButton to App\r
-        if (toggleButton1_ == nullptr)\r
-        {\r
-            toggleButton1_ = new UIToggleButton();\r
-        }\r
-        toggleButton1_->SetPosition(46, 207);       // widget's left position and top position\r
-        toggleButton1_->Resize(52, 52);             // widget's width and height\r
-        toggleButton1_->SetViewId("toggleButton1"); // Set style\r
-        toggleButton1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *toggleButton1selectedImg = "c:/Users/caiking/project/image_converter_tool/output/Phone/microphone.bin";\r
-#else\r
-        char *toggleButton1selectedImg = "/user/res/Phone/microphone.bin";\r
-#endif\r
-#ifdef _WIN32\r
-        char *toggleButton1unSelectedImg = "c:/Users/caiking/project/image_converter_tool/output/Phone/microphone-no.bin";\r
-#else\r
-        char *toggleButton1unSelectedImg = "/user/res/Phone/microphone-no.bin";\r
-#endif\r
-        toggleButton1_->SetImages(toggleButton1selectedImg, toggleButton1unSelectedImg);\r
-\r
-        // Add to rootView\r
-        container_->Add(toggleButton1_);\r
-        toggleButton1_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image1_ == nullptr)\r
-        {\r
-            image1_ = new UIImageView();\r
-        }\r
-        image1_->SetPosition(158, 158); // widget's left position and top position\r
-        image1_->Resize(100, 100);      // widget's width and height\r
-        image1_->SetViewId("image1");   // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/boy.bin";\r
-#else\r
-        char *image1imagesPath = "/user/res/Phone/boy.bin";\r
-#endif\r
-        image1_->SetSrc(image1imagesPath);\r
-\r
-        // Add to rootView\r
-        container_->Add(image1_);\r
-        image1_->SetVisible(true);\r
-\r
-        // Add Button to App\r
-        if (button2_ == nullptr)\r
-        {\r
-            button2_ = new UIButton();\r
-        }\r
-        button2_->SetPosition(369, 207); // widget's left position and top position\r
-        button2_->Resize(52, 52);        // widget's width and height\r
-        button2_->SetViewId("button2");  // Set style\r
-        button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
-        button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button2defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/voice.bin";\r
-#else\r
-        char *button2defaultImgSrc = "/user/res/Phone/voice.bin";\r
-#endif\r
-        char *button2triggeredImgSrc = nullptr;\r
-        button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc);\r
-        button2_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);\r
-        button2_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button2Click = static_cast<UIView::OnClickListener *>(PhoneCallupPresenter::GetInstance());\r
-        button2_->SetOnClickListener(button2Click);\r
-        // Add to rootView\r
-        container_->Add(button2_);\r
-        button2_->SetVisible(true);\r
-\r
-        // Add Button to App\r
-        if (button1_ == nullptr)\r
-        {\r
-            button1_ = new UIButton();\r
-        }\r
-        button1_->SetPosition(188, 340); // widget's left position and top position\r
-        button1_->Resize(90, 90);        // widget's width and height\r
-        button1_->SetViewId(OFFBUTTON);  // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button1defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/phone-off-round.bin";\r
-#else\r
-        char *button1defaultImgSrc = "/user/res/Phone/phone-off-round.bin";\r
-#endif\r
-        char *button1triggeredImgSrc = nullptr;\r
-        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
-        button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(PhoneCallupPresenter::GetInstance());\r
-        button1_->SetOnClickListener(button1Click);\r
-        // Add to rootView\r
-        container_->Add(button1_);\r
-        button1_->SetVisible(true);\r
-    }\r
-\r
-    void PhoneCallupView::DeInit()\r
-    {\r
-        if (container_ != nullptr)\r
-        {\r
-            container_->RemoveAll();\r
-            delete container_;\r
-            container_ = nullptr;\r
-        }\r
-        if (label2_ != nullptr)\r
-        {\r
-            delete label2_;\r
-            label2_ = nullptr;\r
-        }\r
-        if (label1_ != nullptr)\r
-        {\r
-            delete label1_;\r
-            label1_ = nullptr;\r
-        }\r
-        if (toggleButton1_ != nullptr)\r
-        {\r
-            delete toggleButton1_;\r
-            toggleButton1_ = nullptr;\r
-        }\r
-        if (image1_ != nullptr)\r
-        {\r
-            delete image1_;\r
-            image1_ = nullptr;\r
-        }\r
-        if (toggleButton2_ != nullptr)\r
-        {\r
-            delete toggleButton2_;\r
-            toggleButton2_ = nullptr;\r
-        }\r
-        if (button1_ != nullptr)\r
-        {\r
-            delete button1_;\r
-            button1_ = nullptr;\r
-        }\r
-    }\r
-\r
-    UIView *PhoneCallupView::GetView()\r
-    {\r
-        Init();\r
-        return container_;\r
-    }\r
-    void PhoneCallupView::OnStart()\r
-    {\r
-        container_ = new UIScrollView();\r
-        if (container_ == nullptr)\r
-        {\r
-            return;\r
-        }\r
-        container_->SetPosition(0, 0);\r
-        container_->SetWidth(Screen::GetInstance().GetWidth());\r
-        container_->SetHeight(Screen::GetInstance().GetHeight());\r
-\r
-        // 创建 draglistener 实例并设置为拖动监听器\r
-        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(PhoneCallupPresenter::GetInstance());\r
-        if (draglistener == nullptr)\r
-        {\r
-            return;\r
-        }\r
-        container_->SetOnDragListener(draglistener);\r
-\r
-        container_->SetTouchable(true);\r
-        container_->SetDraggable(true);\r
-\r
-        GetView();\r
-        RootView::GetInstance()->Add(container_);\r
-    }\r
-\r
-    void PhoneCallupView::OnSetUpView()\r
-    {\r
-\r
-        View<PhoneCallupPresenter>::OnSetUpView();\r
-        Draw();\r
-    }\r
-\r
-    void PhoneCallupView::OnTearDownView()\r
-    {\r
-\r
-        View<PhoneCallupPresenter>::OnTearDownView();\r
-        return;\r
-    }\r
-\r
-    void PhoneCallupView::OnStop()\r
-    {\r
-        View<PhoneCallupPresenter>::OnStop();\r
-        RootView::GetInstance()->RemoveAll();\r
-        return;\r
-    }\r
-}\r
index c567c03..f2868aa 100644 (file)
@@ -105,8 +105,8 @@ namespace OHOS
         if (label1_phone_name == nullptr) {\r
             label1_phone_name = new UILabel();\r
         }\r
-        label1_phone_name->SetPosition(173, 53);         // widget's left position and top position\r
-        label1_phone_name->Resize(120, 55);          // widget's width and height\r
+        label1_phone_name->SetPosition(0, 53);         // widget's left position and top position\r
+        label1_phone_name->Resize(466, 55);          // widget's width and height\r
         label1_phone_name->SetViewId("label1");// Set style\r
         label1_phone_name->SetStyle(STYLE_TEXT_FONT, 50);\r
 \r
@@ -114,7 +114,7 @@ namespace OHOS
         label1_phone_name->SetText(addressbook_t.Contact_t[0].name);\r
         label1_phone_name->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);\r
         label1_phone_name->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label1_phone_name->SetRollSpeed(0);\r
+        label1_phone_name->SetRollSpeed(1);\r
         label1_phone_name->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 50);\r
 \r
         // Add to rootView\r
@@ -127,7 +127,7 @@ namespace OHOS
         }\r
         phone_name->SetPosition(170, 140);         // widget's left position and top position\r
         phone_name->Resize(109, 111);          // widget's width and height\r
-        phone_name->SetViewId("image1");// Set style\r
+        phone_name->SetViewId("phone_sex");// Set style\r
         const char *Imagesrc=addressbook_t.Contact_t[0].sex ? PHONE_DIR_BOY_1:PHONE_DIR_GIRL_1;\r
         phone_name->SetSrc(Imagesrc);\r
 \r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingPresenter.cpp
deleted file mode 100644 (file)
index 778df1c..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "AppViewIDs.h"\r
-#include "components/ui_label_ext.h"\r
-#include"ui_resource_string.h"\r
-#include "NativeAbility.h"\r
-\r
-#include "phone/include/PhoneRingPresenter.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
-    // 当前Presenter属性实例化的内存指针\r
-    static PhoneRingPresenter *g_pPhoneRingPresenter = nullptr;\r
-\r
-    PhoneRingPresenter::PhoneRingPresenter()\r
-    {\r
-\r
-        g_pPhoneRingPresenter = this;\r
-    }\r
-\r
-    PhoneRingPresenter::~PhoneRingPresenter()\r
-    {\r
-\r
-        g_pPhoneRingPresenter = nullptr;\r
-    }\r
-\r
-    PhoneRingPresenter *PhoneRingPresenter::GetInstance()\r
-    {\r
-\r
-        return g_pPhoneRingPresenter;\r
-    }\r
-\r
-    void PhoneRingPresenter::OnStart()\r
-    {\r
-\r
-        Presenter<PhoneRingView>::OnStart();\r
-    }\r
-\r
-    void PhoneRingPresenter::OnPause(void)\r
-    {\r
-\r
-        Presenter<PhoneRingView>::OnPause();\r
-    }\r
-\r
-    void PhoneRingPresenter::OnResume(void)\r
-    {\r
-\r
-        Presenter<PhoneRingView>::OnResume();\r
-    }\r
-\r
-    void PhoneRingPresenter::OnStop(void)\r
-    {\r
-\r
-        Presenter<PhoneRingView>::OnStop();\r
-    }\r
-\r
-    bool PhoneRingPresenter::OnDrag(UIView &view, const DragEvent &event)\r
-    {\r
-\r
-        // if (event.GetDragCallupection() == DragEvent::CallupECTION_RIGHT_TO_LEFT)\r
-        // {\r
-        //     printf("draglistene is ok!\n");\r
-        //     NativeAbility::GetInstance().ChangeSlice(VIEW_PHONE);\r
-        // }\r
-        UNUSED(view);\r
-        return true;\r
-    }\r
-\r
-    bool PhoneRingPresenter::OnClick(UIView &view, const ClickEvent &event)\r
-    {\r
-        // 根据控件id查找是哪个控件触发了点击回调\r
-        if (strcmp(view.GetViewId(), OFFBUTTON) == 0)\r
-        {\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_PHONE);\r
-        }\r
-        return true;\r
-    }\r
-}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingView.cpp
deleted file mode 100644 (file)
index 75528b7..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-\r
-\r
-#include "phone/include/PhoneRingView.h"\r
-#include "phone/include/PhoneCallPresenter.h"\r
-#include "common/image_cache_manager.h"\r
-#include "UiConfig.h"\r
-#include "ui_resource_image.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_button.h"\r
-namespace OHOS\r
-{\r
-\r
-    static PhoneRingView *g_pPhoneRingView{nullptr};\r
-\r
-    PhoneRingView::PhoneRingView()\r
-    {\r
-\r
-        g_pPhoneRingView = this;\r
-    }\r
-\r
-    PhoneRingView::~PhoneRingView()\r
-    {\r
-        DeInit();\r
-        g_pPhoneRingView = nullptr;\r
-    }\r
-\r
-    PhoneRingView *PhoneRingView::GetInstance()\r
-    {\r
-\r
-        return g_pPhoneRingView;\r
-    }\r
-\r
-    void PhoneRingView::Init()\r
-    {\r
-        if (container_ == nullptr)\r
-        {\r
-            container_ = new UIViewGroup();\r
-            container_->SetPosition(0, 0, 466, 466);\r
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
-        }\r
-\r
-        // Add Label to App\r
-        if (label2_ == nullptr)\r
-        {\r
-            label2_ = new UILabel();\r
-        }\r
-        label2_->SetPosition(190, 52); // widget's left position and top position\r
-        label2_->Resize(85, 35);       // widget's width and height\r
-        label2_->SetViewId("label2");  // Set style\r
-        label2_->SetStyle(STYLE_TEXT_FONT, 30);\r
-\r
-        // Set additional property\r
-        label2_->SetText("拨号中...");\r
-        label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label2_->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff));\r
-        label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label2_->SetRollSpeed(0);\r
-        label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
-        // Add to rootView\r
-        container_->Add(label2_);\r
-        label2_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label1_ == nullptr)\r
-        {\r
-            label1_ = new UILabel();\r
-        }\r
-        label1_->SetPosition(109, 104); // widget's left position and top position\r
-        label1_->Resize(249, 40);       // widget's width and height\r
-        label1_->SetViewId("label1");   // Set style\r
-        label1_->SetStyle(STYLE_TEXT_FONT, 40);\r
-\r
-        // Set additional property\r
-        label1_->SetText(PhoneCallPresenter::GetInstance()->phoneNumber.c_str());\r
-        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label1_->SetRollSpeed(0);\r
-        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);\r
-\r
-        // Add to rootView\r
-        container_->Add(label1_);\r
-        label1_->SetVisible(true);\r
-\r
-        // Add ToggleButton to App\r
-        if (toggleButton1_ == nullptr)\r
-        {\r
-            toggleButton1_ = new UIToggleButton();\r
-        }\r
-        toggleButton1_->SetPosition(46, 207);       // widget's left position and top position\r
-        toggleButton1_->Resize(52, 52);             // widget's width and height\r
-        toggleButton1_->SetViewId("toggleButton1"); // Set style\r
-        toggleButton1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *toggleButton1selectedImg = "c:/Users/caiking/project/image_converter_tool/output/Phone/microphone.bin";\r
-#else\r
-        char *toggleButton1selectedImg = "/user/res/Phone/microphone.bin";\r
-#endif\r
-#ifdef _WIN32\r
-        char *toggleButton1unSelectedImg = "c:/Users/caiking/project/image_converter_tool/output/Phone/microphone-no.bin";\r
-#else\r
-        char *toggleButton1unSelectedImg = "/user/res/Phone/microphone-no.bin";\r
-#endif\r
-        toggleButton1_->SetImages(toggleButton1selectedImg, toggleButton1unSelectedImg);\r
-\r
-        // Add to rootView\r
-        container_->Add(toggleButton1_);\r
-        toggleButton1_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image1_ == nullptr)\r
-        {\r
-            image1_ = new UIImageView();\r
-        }\r
-        image1_->SetPosition(158, 158); // widget's left position and top position\r
-        image1_->Resize(100, 100);      // widget's width and height\r
-        image1_->SetViewId("image1");   // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/girl.bin";\r
-#else\r
-        char *image1imagesPath = "/user/res/Phone/girl.bin";\r
-#endif\r
-        image1_->SetSrc(image1imagesPath);\r
-\r
-        // Add to rootView\r
-        container_->Add(image1_);\r
-        image1_->SetVisible(true);\r
-\r
-        // Add ToggleButton to App\r
-        if (toggleButton2_ == nullptr)\r
-        {\r
-            toggleButton2_ = new UIToggleButton();\r
-        }\r
-        toggleButton2_->SetPosition(369, 207);      // widget's left position and top position\r
-        toggleButton2_->Resize(52, 52);             // widget's width and height\r
-        toggleButton2_->SetViewId("toggleButton2"); // Set style\r
-        toggleButton2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *toggleButton2selectedImg = "c:/Users/caiking/project/image_converter_tool/output/Phone/voice.bin";\r
-#else\r
-        char *toggleButton2selectedImg = "/user/res/Phone/voice.bin";\r
-#endif\r
-#ifdef _WIN32\r
-        char *toggleButton2unSelectedImg = "c:/Users/caiking/project/image_converter_tool/output/Phone/voice-no.bin";\r
-#else\r
-        char *toggleButton2unSelectedImg = "/user/res/Phone/voice-no.bin";\r
-#endif\r
-        toggleButton2_->SetImages(toggleButton2selectedImg, toggleButton2unSelectedImg);\r
-\r
-        // Add to rootView\r
-        container_->Add(toggleButton2_);\r
-        toggleButton2_->SetVisible(true);\r
-\r
-        // Add Button to App\r
-        if (button1_ == nullptr)\r
-        {\r
-            button1_ = new UIButton();\r
-        }\r
-        button1_->SetPosition(188, 340); // widget's left position and top position\r
-        button1_->Resize(90, 90);        // widget's width and height\r
-        button1_->SetViewId("button1");  // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button1defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/phone-off-round.bin";\r
-#else\r
-        char *button1defaultImgSrc = "/user/res/Phone/phone-off-round.bin";\r
-#endif\r
-        char *button1triggeredImgSrc = nullptr;\r
-        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
-        button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(PhoneRingPresenter::GetInstance());\r
-        button1_->SetOnClickListener(button1Click);\r
-        // Add to rootView\r
-        container_->Add(button1_);\r
-        button1_->SetVisible(true);\r
-    }\r
-\r
-    void PhoneRingView::DeInit()\r
-    {\r
-        if (container_ != nullptr)\r
-        {\r
-            container_->RemoveAll();\r
-            delete container_;\r
-            container_ = nullptr;\r
-        }\r
-        if (label2_ != nullptr)\r
-        {\r
-            delete label2_;\r
-            label2_ = nullptr;\r
-        }\r
-        if (label1_ != nullptr)\r
-        {\r
-            delete label1_;\r
-            label1_ = nullptr;\r
-        }\r
-        if (toggleButton1_ != nullptr)\r
-        {\r
-            delete toggleButton1_;\r
-            toggleButton1_ = nullptr;\r
-        }\r
-        if (image1_ != nullptr)\r
-        {\r
-            delete image1_;\r
-            image1_ = nullptr;\r
-        }\r
-        if (toggleButton2_ != nullptr)\r
-        {\r
-            delete toggleButton2_;\r
-            toggleButton2_ = nullptr;\r
-        }\r
-        if (button1_ != nullptr)\r
-        {\r
-            delete button1_;\r
-            button1_ = nullptr;\r
-        }\r
-    }\r
-\r
-    UIView *PhoneRingView::GetView()\r
-    {\r
-        Init();\r
-        return container_;\r
-    }\r
-    void PhoneRingView::OnStart()\r
-    {\r
-        container_ = new UIScrollView();\r
-        if (container_ == nullptr)\r
-        {\r
-            return;\r
-        }\r
-        container_->SetPosition(0, 0);\r
-        container_->SetWidth(Screen::GetInstance().GetWidth());\r
-        container_->SetHeight(Screen::GetInstance().GetHeight());\r
-\r
-        // 创建 draglistener 实例并设置为拖动监听器\r
-        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(PhoneRingPresenter::GetInstance());\r
-        if (draglistener == nullptr)\r
-        {\r
-            return;\r
-        }\r
-        container_->SetOnDragListener(draglistener);\r
-\r
-        container_->SetTouchable(true);\r
-        container_->SetDraggable(true);\r
-\r
-        GetView();\r
-        RootView::GetInstance()->Add(container_);\r
-    }\r
-\r
-    void PhoneRingView::OnSetUpView()\r
-    {\r
-\r
-        View<PhoneRingPresenter>::OnSetUpView();\r
-        Draw();\r
-    }\r
-\r
-    void PhoneRingView::OnTearDownView()\r
-    {\r
-\r
-        View<PhoneRingPresenter>::OnTearDownView();\r
-        return;\r
-    }\r
-\r
-    void PhoneRingView::OnStop()\r
-    {\r
-        View<PhoneRingPresenter>::OnStop();\r
-        RootView::GetInstance()->RemoveAll();\r
-        return;\r
-    }\r
-}\r
index d29a4bb..430eeba 100644 (file)
@@ -130,126 +130,45 @@ namespace OHOS
         // }
     }
 
-    void get_phone_addrss_name(char *name,const char *phone)
+    bool get_phone_addrss_name(char *name,const char *phone)
     {
         for(int i=0;i<addressbook_t.num;i++)
         {
             if(strcmp(phone,addressbook_t.Contact_t[i].phone_number_t[0].number)==0)
             {
                 strcpy(name,addressbook_t.Contact_t[i].name);
-                return;
+                return true;
             }
             else if(phone,addressbook_t.Contact_t[i].phone_num==2)
             {
                 if(strcmp(phone,addressbook_t.Contact_t[i].phone_number_t[1].number)==0)
                 {
                     strcpy(name,addressbook_t.Contact_t[i].name);
-                    return;
+                    return true;
                 }   
             }
         }
         strcpy(name,"未知");
-        return;
+        return false;
     }
 
     void read_addressbook_bin_file()
     {
         FILE *fp= fopen(ADDRESS_BOOK_PATH,"rb+");
-        if(fp==NULL)
-        {
-            return;
-        }
-        // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "read_addressbook_bin_file!!!!!!");
-        char* buf = (char *)malloc(512);
-        memset(buf,0,512);
-
-        int ret=fread(buf,1,512,fp);
-        if(ret==0)
-        {
-            printf("文件为空\r\n");
-            free(buf);
-            return;
-        }
-
-        int offset_f=512;
-        while (ret==512)
+        if(fp==NULL)return;
+        int num=0;
+        for (size_t i = 0; i < 20; i++)
         {
-            buf = (char *)realloc(buf,offset_f+512);
-            ret=fread(&buf[offset_f],1,512,fp);
-            offset_f+=512;  
-        }
+            int readsize= fread(&addressbook_t.Contact_t[i],sizeof(Contact),1,fp);
+            if(readsize!=1)
+            break;
+            else
+            num++;
 
-        int num=buf[0];//人数
-        if(num>20 || num<0)
-        {
-            num=0;
-            addressbook_t.num=0;
-            printf("异常全部清除\r\n");
-            free(buf);
-            return;
         }
-        printf("人数: %d\r\n",num);
         addressbook_t.num=num;
-        int offset=1;
-        for (int j=0;j<num;j++)
-        {
-            uint8_t sex = buf[offset];
-            printf("性别: %d\r\n",sex);
-            addressbook_t.Contact_t[j].sex=sex;
-            offset=offset+1;
-            
-            //uint8_t name_len=buf[offset];
-            //("name_len %d\r\n",name_len);
-            // char *name=(char *)malloc(sizeof(char)*name_len+1);
-            memset(addressbook_t.Contact_t[j].name,0,NAME_LEN);
-            {
-                
-                memcpy(addressbook_t.Contact_t[j].name,&buf[offset],NAME_LEN);
-                printf("姓名: %s\r\n",addressbook_t.Contact_t[j].name);
-                // addressbook_t.Contact_t[j].name=name;
-            }
-            offset=offset+NAME_LEN+1;
-            uint8_t phone_num=buf[offset]; 
-            offset=offset+1;
-            addressbook_t.Contact_t[j].phone_num=phone_num;
-            for(int i=0;i<2;i++)
-            { 
-
-                memset(addressbook_t.Contact_t[j].phone_number_t[i].number,0,NUMBER_LEN);
-               
-                memcpy(addressbook_t.Contact_t[j].phone_number_t[i].number,&buf[offset],NUMBER_LEN);
-
-                printf("号码: %s\r\n",addressbook_t.Contact_t[j].phone_number_t[i].number);
-                // addressbook_t.Contact_t[j].phone_number_t[i].number=phonen_name;
-                offset=offset+NUMBER_LEN;
-            }
-            for(int i=0;i<2;i++)
-            {
-                
-                memset(addressbook_t.Contact_t[j].phone_number_t[i].affiliating_area,0,AREA_LEN);
-
-                memcpy(addressbook_t.Contact_t[j].phone_number_t[i].affiliating_area,&buf[offset],AREA_LEN);
-
-                printf("归属地: %s\r\n",addressbook_t.Contact_t[j].phone_number_t[i].affiliating_area);
-                // addressbook_t.Contact_t[j].phone_number_t[i].affiliating_area=add_buf;
-                offset=offset+AREA_LEN;
-
-                memset(addressbook_t.Contact_t[j].phone_number_t[i].operator_t,0,OPERATOR_LEN);
-
-                memcpy(addressbook_t.Contact_t[j].phone_number_t[i].operator_t,&buf[offset],OPERATOR_LEN);
-               
-                printf("运营商: %s\r\n",addressbook_t.Contact_t[j].phone_number_t[i].operator_t);
-                // addressbook_t.Contact_t[j].phone_number_t[i].operator_t=yun_buf;
-
-                offset=offset+OPERATOR_LEN;
-            }
-        }
         fclose(fp);
-        if(buf)
-        {
-            free(buf);
-        }
-       
+         
     }
 
     void write_addressbook_bin_flle()
@@ -257,62 +176,14 @@ namespace OHOS
         FILE *fp= fopen(ADDRESS_BOOK_PATH,"wb+");
         if(fp==NULL)
         return;
-        char buf[128*20];
-        // int ret=fread(buf,1,512,fp);
-        // int offset_f=512;
-        // while (ret==512)
-        // {
-        //     ret=fread(&buf[offset_f],1,512,fp);
-        //     offset_f+=512;
-        // }
-    
-        buf[0] =addressbook_t.num;
-        if(buf[0]>20 && buf[0]<0)
-        {
-            buf[0]=0;
-        }
-        printf("人数: %d\r\n",buf[0]);
-        int offset=1;
+
         for(int i=0;i<addressbook_t.num;i++)
         {
-            buf[offset]= addressbook_t.Contact_t[i].sex;
-            printf("性别 %d\r\n",buf[offset]);
-            offset=offset+1;
-            //buf[offset]=NAME_LEN;//strlen(addressbook_t.Contact_t[i].name)+1;
-            //printf("写入名字长度: %d\r\n",buf[offset]);
-            memcpy(&buf[offset],addressbook_t.Contact_t[i].name,NAME_LEN);
-            printf("写入名字: %s\r\n",&buf[offset]);
-            offset=offset+NAME_LEN+1;
-
-            buf[offset]=addressbook_t.Contact_t[i].phone_num;
-            if(buf[offset]>2)
-            {
-                buf[offset]=2;
-            }
-            printf("写入号码个数: %d\r\n",buf[offset]);
-            offset=offset+1;
-            for(int j=0;j<2;j++)
-            {
-                memcpy(&buf[offset],addressbook_t.Contact_t[i].phone_number_t[j].number,NUMBER_LEN);
-                printf("写入号码: %s\r\n",&buf[offset]);
-                offset=offset+NUMBER_LEN;
-            }
-            for(int j=0;j<2;j++)
-            {
-                //buf[offset]=strlen(addressbook_t.Contact_t[i].phone_number_t[j].affiliating_area)+1;
-                memcpy(&buf[offset],addressbook_t.Contact_t[i].phone_number_t[j].affiliating_area,AREA_LEN);
-                printf("写入所属地: %s\r\n",&buf[offset]);
-                offset=offset+AREA_LEN;
-
-                //buf[offset]=strlen(addressbook_t.Contact_t[i].phone_number_t[j].operator_t)+1;
-                memcpy(&buf[offset],addressbook_t.Contact_t[i].phone_number_t[j].operator_t,OPERATOR_LEN);
-                printf("写入运营商: %s\r\n",&buf[offset]);
-                offset=offset+OPERATOR_LEN;
-            }
+
+            fwrite((void *)&addressbook_t.Contact_t[i],1,sizeof(Contact),fp);
         }
-        fwrite((void *)buf,1,offset,fp);
+        
         fclose(fp);
-
     }
     
     void add_addressbook(struct Contact *data)
index 997050c..827c1d5 100644 (file)
@@ -342,7 +342,7 @@ void svr_pair_result_cbt_cb(uint16_t conn_id, const bd_addr_t *addr, errcode_t s
     {\r
         ble_ancs_client_cmd_setup_and_subscribe(g_ble_conn_id);\r
 \r
-        if(get_ctkd_flag())\r
+        if(get_ctkd_flag() && cm_custom_ble_service_on_flag())\r
         {\r
            \r
             int ret=gap_reconnect_media_device(&phone_addr);\r