拨号
authorhcj <1224667075@qq.com>
Thu, 7 Mar 2024 06:10:42 +0000 (14:10 +0800)
committerhcj <1224667075@qq.com>
Thu, 7 Mar 2024 06:10:42 +0000 (14:10 +0800)
44 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h
code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h
code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h
code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp
code/sdk/application/wearable/fd230app/nativeui/callerlog/include/CallerLogModel.h
code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallupPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallupView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhonePresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneRingPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneRingView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallupPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallupView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhonePresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogModel.h
code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp
code/sdk/application/wearable/nativeapp/nativeui/main/include/VolumeSettingView.h
code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h
code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c
code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp
code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.h

index 761d965..f4d9cfc 100644 (file)
@@ -32,6 +32,7 @@ set(PRIVATE_HEADER
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/offlinevoice/include
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/settings/include
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/key/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/include
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/player/include
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/applist/include
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phoneservice/include
@@ -42,6 +43,7 @@ set(PRIVATE_HEADER
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/UIInitializer/
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/InitComponent/include
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/uisample/uitest/framework/include
+    
 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/alipay/include
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/alipay/include/AlipayList
@@ -383,6 +385,19 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialSequenceImgView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialStaticImgView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/parser/DialBinParser.cpp
+
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneView.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhonePresenter.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallView.cpp
+    ${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
 )
 if("SUPPORT_ALIPAY_SEC" IN_LIST DEFINES)
 set(SOURCES   
index 1ae0601..6a9e370 100644 (file)
@@ -71,6 +71,13 @@ typedef enum : uint16_t
     VIEW_OFFLINEVOICE,  // 语音助手界面(暂时不用)
     VIEW_MAIN_ACTIVITY, // 记录步数界面(暂时不用)
     VIEW_UISAMPLE,      // 示例(暂时不用)
+
+    VIEW_PHONE,        // 电话
+    VIEW_PHONECALL,    // 拨号
+    VIEW_PHONERING,    // 拨号界面
+    VIEW_PHONECALLING, // 来电
+    VIEW_PHONECALLUP,  // 通话界面
+    VIEW_PHONEDIR,     // 电话簿
 /* -------------------------------------------------------------------------- */
 #ifdef SUPPORT_ALIPAY_SEC
     VIEW_MAIN_ALIPAY,
index 3c204b4..362a004 100644 (file)
@@ -62,6 +62,13 @@ namespace OHOS
         void InitFastTrainingSlice(void);
         void InitFastTrainingAttentionSlice(void);
 
+        void InitPhoneSlice(void);
+        void InitPhoneCallSlice(void);
+        void InitPhoneDirSlice(void);
+        void InitPhoneCallingSlice(void);
+        void InitPhoneCallupSlice(void);
+        void InitPhoneRingSlice(void);
+
     private:
         void InitAllNativeSlices(void);
 
index 1f48666..742b356 100644 (file)
@@ -364,6 +364,7 @@ namespace OHOS
     static constexpr const char *B024_009_IMAGE_PATH = APP_RES_PATH "/HOURHAND.bin";
     static constexpr const char *B024_010_IMAGE_PATH = APP_RES_PATH "/SECONDHAND.bin";
     static constexpr const char *B024_011_IMAGE_PATH = APP_RES_PATH "/MINUTEHAND.bin";
+    static constexpr const char *PNG_APPLIST_PHONE_IMAGE = APP_RES_PATH "/phone.bin";                     // 电话
     /* -------------------------------------------------------------------------- */
     static constexpr const char *PNG_NEW_WLAN_WIFI = APP_RES_PATH "/FULL_SIGNAL_OPEN.bin";
     static constexpr const char *FULL_SIGNAL_ENCRYPTION = APP_RES_PATH "/FULL_SIGNAL_ENCRYPTION.bin";
index 483b567..0d4c8a2 100644 (file)
 
 #include "config/include/ConfigModel.h"
 
+#include "phone/include/PhoneView.h"
+#include "phone/include/PhonePresenter.h"
+#include "phone/include/PhoneCallView.h"
+#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"
+
 #ifdef SUPPORT_ALIPAY_SEC
 #include "AlipayMainView.h"
 #include "AlipayPresenter.h"
@@ -173,6 +186,13 @@ namespace OHOS
         {VIEW_DIALUPDATE, &NativeLauncher::InitDialUpdateSlice},
         {VIEW_BLOODOXY, &NativeLauncher::InitMainBloodOxyView},
         {VIEW_HEART, &NativeLauncher::InitHeartSlice},
+
+        {VIEW_PHONE, &NativeLauncher::InitPhoneSlice},                                                         //电话
+        {VIEW_PHONECALL, &NativeLauncher::InitPhoneCallSlice},
+        {VIEW_PHONEDIR, &NativeLauncher::InitPhoneDirSlice},
+        {VIEW_PHONECALLING, &NativeLauncher::InitPhoneCallingSlice},
+        {VIEW_PHONECALLUP, &NativeLauncher::InitPhoneCallupSlice},
+        {VIEW_PHONERING, &NativeLauncher::InitPhoneRingSlice},
 #ifdef SUPPORT_ALIPAY_SEC
         {VIEW_MAIN_ALIPAY, &NativeLauncher::InitMainAlipaySlice},
 #endif
@@ -197,6 +217,7 @@ namespace OHOS
         {VIEW_BLOODOXY, "bloodOxygenView"},
         {VIEW_COMPASS, "mainCompassView"},
         {VIEW_CONNECT_PHONE, "ConnectPhoneView"},
+        {VIEW_PHONE, "phoneview"},
         {VIEW_INDOORWALK, "IndoorWalkView"},
         {VIEW_SHUTDOWN_OR_REBOOT, "RebootView"}};
 
@@ -673,6 +694,77 @@ namespace OHOS
         }
         NativeAbility::GetInstance().AddSliceProxy(VIEW_RECORD_DELETE, recorddelete);
     }
+    void NativeLauncher::InitPhoneSlice(void)
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneSlice");
+    SliceProxy *phoneview = new AbilitySliceProxy<PhoneView, PhonePresenter>;
+    if (phoneview == nullptr)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneview");
+        return;
+    }
+    NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONE, phoneview);
+}
+
+void NativeLauncher::InitPhoneCallSlice(void)
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneCallSlice");
+    SliceProxy *phonecallview = new AbilitySliceProxy<PhoneCallView, PhoneCallPresenter>;
+    if (phonecallview == nullptr)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phonecallview");
+        return;
+    }
+    NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONECALL, phonecallview);
+}
+
+void NativeLauncher::InitPhoneDirSlice(void)
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneCallSlice");
+    SliceProxy *phonedirview = new AbilitySliceProxy<PhoneDirView, PhoneDirPresenter>;
+    if (phonedirview == nullptr)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phonedirview");
+        return;
+    }
+    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::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);
+}
 
     
 }
index 2d05348..fe0b8af 100644 (file)
@@ -30,6 +30,7 @@ namespace OHOS
         {VIEW_SETTING, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_SETTING_IMAGE, "设置", nullptr},
         {VIEW_DIALUPDATE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_UI_SAMPLE_IMAGE, "表盘切换", nullptr},
         {VIEW_CALLER_LOG, PNG_APPLIST_CALLLOG_IMAGE, PNG_APPLIST_CALLLOG_IMAGE, "通话记录", nullptr},
+        {VIEW_PHONE, PNG_APPLIST_CALLLOG_IMAGE, PNG_APPLIST_PHONE_IMAGE, "电话", nullptr},
 #ifdef SUPPORT_ALIPAY_SEC
         {VIEW_MAIN_ALIPAY, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_ALIPAY_IMAGE, "支付宝", nullptr},
 #endif
index 4069b2b..f7c45b9 100644 (file)
@@ -29,6 +29,10 @@ enum PhoneStatus {
     PHONE_SINGLE_STATUS\r
 };\r
 \r
+void g_callTimesclean();\r
+\r
+void g_callTimesadd();\r
+\r
 bool MulitplePhoneTextReplaces();\r
 bool FindCallListInfoAndSetPriorityNumber();\r
 void PhoneScoStatausCallback(hfp_sco_connect_state_t state);\r
index 13f60ba..8ba3608 100644 (file)
@@ -38,6 +38,17 @@ static int g_secondPriority = NO_NUMBER_STATUS;
 static int g_thirdPriority = NO_NUMBER_STATUS;
 static int g_fourthPriority = NO_NUMBER_STATUS;
 
+void g_callTimesclean()
+{
+    g_callTimes=0;
+}
+
+void g_callTimesadd()
+{
+    g_callTimes++;
+}
+
+
 static void SetPriorityNumber()
 {
     time_t seconds;
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallPresenter.h
new file mode 100644 (file)
index 0000000..7f21805
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef _PhoneCall_PRESENTER_H\r
+#define _PhoneCall_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "PhoneCallView.h"\r
+#include "string"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    class PhoneCallView;\r
+    class PhoneCallPresenter : public Presenter<PhoneCallView>,\r
+                               public UIView::OnClickListener,\r
+                               public UIView::OnDragListener\r
+\r
+    {\r
+    public:\r
+        PhoneCallPresenter();\r
+        virtual ~PhoneCallPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+        void Invalidate();\r
+        void UpdatePhoneNumberView(const std::string &number);\r
+        static PhoneCallPresenter *GetInstance();\r
+        std::string phoneNumber;\r
+\r
+    private:\r
+        // 声明一个字符串变量用于存储用户输入的号码\r
+\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/PhoneCallView.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallView.h
new file mode 100644 (file)
index 0000000..e56056e
--- /dev/null
@@ -0,0 +1,98 @@
+#ifndef _PHONECALL_VIEW_H\r
+#define _PHONECALL_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_image_view.h"\r
+#include "components/ui_button.h"\r
+\r
+#include "PhoneCallPresenter.h"\r
+namespace OHOS\r
+{\r
+#define BUTTON1 "button1"\r
+#define BUTTON2 "button2"\r
+#define BUTTON3 "button3"\r
+#define BUTTON4 "button4"\r
+#define BUTTON5 "button5"\r
+#define BUTTON6 "button6"\r
+#define BUTTON7 "button7"\r
+#define BUTTON8 "button8"\r
+#define BUTTON9 "button9"\r
+#define BUTTONCALL "buttoncall"\r
+#define BUTTON0 "button0"\r
+#define BUTTONDEL "buttondel"\r
+\r
+#define BUTTON_PATH "/user/res/Phone/"\r
+\r
+    static const char *button1Path = BUTTON_PATH "1.bin";\r
+    static const char *button2Path = BUTTON_PATH "2.bin";\r
+    static const char *button3Path = BUTTON_PATH "3.bin";\r
+    static const char *button4Path = BUTTON_PATH "4.bin";\r
+    static const char *button5Path = BUTTON_PATH "5.bin";\r
+    static const char *button6Path = BUTTON_PATH "6.bin";\r
+    static const char *button7Path = BUTTON_PATH "7.bin";\r
+    static const char *button8Path = BUTTON_PATH "8.bin";\r
+    static const char *button9Path = BUTTON_PATH "9.bin";\r
+    static const char *buttonCallPath = BUTTON_PATH "call.bin";\r
+    static const char *button0Path = BUTTON_PATH "0.bin";\r
+    static const char *buttonDelPath = BUTTON_PATH "del.bin";\r
+\r
+    // 定义包含按钮初始化参数的结构体\r
+    struct ButtonInitParams\r
+    {\r
+        UIButton *button;\r
+        const char *buttonNumber;\r
+        int leftPos;\r
+        int topPos;\r
+        int width;\r
+        int height;\r
+        const char *defaultImgSrc;\r
+        const char *triggeredImgSrc;\r
+    };\r
+\r
+    class PhoneCallPresenter;\r
+    class PhoneCallView : public View<PhoneCallPresenter>\r
+    {\r
+\r
+    public:\r
+        PhoneCallView();\r
+        virtual ~PhoneCallView();\r
+        static PhoneCallView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+        void Invalidate();\r
+        void ReLabel();\r
+        void Init();\r
+        void DeInit();\r
+\r
+        void initButton(const ButtonInitParams &params);\r
+        void UpdateLabel(const std::string &text);\r
+        UIView *GetView();\r
+\r
+    private:\r
+        UIView::OnDragListener *draglistener{nullptr};\r
+        PhoneCallView(PhoneCallView &&) = delete;\r
+        PhoneCallView &operator=(PhoneCallView &&) = delete;\r
+        UIViewGroup *container_ = nullptr;\r
+        UILabel *label_ = nullptr;\r
+        UIButton *button1_ = nullptr;\r
+        UIButton *button2_ = nullptr;\r
+        UIButton *button3_ = nullptr;\r
+        UIButton *button4_ = nullptr;\r
+        UIButton *button5_ = nullptr;\r
+        UIButton *button6_ = nullptr;\r
+        UIButton *button7_ = nullptr;\r
+        UIButton *button8_ = nullptr;\r
+        UIButton *button9_ = nullptr;\r
+        UIButton *button0_ = nullptr;\r
+        UIButton *buttoncall_ = nullptr;\r
+        UIButton *buttondel_ = nullptr;\r
+    };\r
+} // namespace OHOS\r
+#endif\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallingPresenter.h
new file mode 100644 (file)
index 0000000..fe5f1f2
--- /dev/null
@@ -0,0 +1,33 @@
+#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
new file mode 100644 (file)
index 0000000..9e2ed69
--- /dev/null
@@ -0,0 +1,53 @@
+#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_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
new file mode 100644 (file)
index 0000000..97b51b2
--- /dev/null
@@ -0,0 +1,38 @@
+#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);\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
new file mode 100644 (file)
index 0000000..e4e7cf3
--- /dev/null
@@ -0,0 +1,61 @@
+#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_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/PhoneDirPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirPresenter.h
new file mode 100644 (file)
index 0000000..ddbdb05
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _PhoneDir_PRESENTER_H\r
+#define _PhoneDir_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "PhoneDirView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class PhoneDirView;\r
+\r
+    class PhoneDirPresenter : public Presenter<PhoneDirView>,\r
+                               public UIView::OnClickListener,\r
+                               public UIView::OnDragListener\r
+    {\r
+    public:\r
+        PhoneDirPresenter();\r
+        virtual ~PhoneDirPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static PhoneDirPresenter *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/PhoneDirView.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirView.h
new file mode 100644 (file)
index 0000000..c586407
--- /dev/null
@@ -0,0 +1,68 @@
+#ifndef _PhoneDir_VIEW_H\r
+#define _PhoneDir_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_image_view.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_label_button_ext.h"\r
+#include "graphic_config.h"\r
+#include "components/ui_label_button.h"\r
+\r
+#include "PhoneDirPresenter.h"\r
+namespace OHOS\r
+{\r
+\r
+    class PhoneDirPresenter;\r
+    class PhoneDirView : public View<PhoneDirPresenter>\r
+    {\r
+\r
+    public:\r
+        PhoneDirView();\r
+        virtual ~PhoneDirView();\r
+        static PhoneDirView *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
+        PhoneDirView(PhoneDirView &&) = delete;\r
+        PhoneDirView &operator=(PhoneDirView &&) = delete;\r
+\r
+#if 0\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UILabel *label2_ = nullptr;\r
+        UIImageView *image1_ = nullptr;\r
+#endif\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UILabelButtonExt *labelButton8_ = nullptr;\r
+        UIImageView *image2_ = nullptr;\r
+        UILabelButtonExt *labelButton9_ = nullptr;\r
+        UIImageView *image3_ = nullptr;\r
+        UILabelButtonExt *labelButton10_ = nullptr;\r
+        UIImageView *image5_ = nullptr;\r
+        UIImageView *image7_ = nullptr;\r
+        UILabelButtonExt *labelButton13_ = nullptr;\r
+        UIImageView *image9_ = nullptr;\r
+        UIImageView *image8_ = nullptr;\r
+        UILabelButtonExt *labelButton11_ = nullptr;\r
+        UIImageView *image6_ = nullptr;\r
+        UILabelButtonExt *labelButton7_ = nullptr;\r
+        UIImageView *image1_ = nullptr;\r
+    };\r
+} // namespace OHOS\r
+#endif // PhoneDir_PRESENTER_H\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhonePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhonePresenter.h
new file mode 100644 (file)
index 0000000..3d46515
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _PHONE_PRESENTER_H\r
+#define _PHONE_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "PhoneView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class PhoneView;\r
+\r
+    class PhonePresenter : public Presenter<PhoneView>,\r
+                            public UIView::OnClickListener,\r
+                            public UIView::OnDragListener\r
+    {\r
+    public:\r
+        PhonePresenter();\r
+        virtual ~PhonePresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static PhonePresenter *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/PhoneRingPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneRingPresenter.h
new file mode 100644 (file)
index 0000000..e2e16c0
--- /dev/null
@@ -0,0 +1,36 @@
+#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
new file mode 100644 (file)
index 0000000..45d65d2
--- /dev/null
@@ -0,0 +1,49 @@
+#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_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
new file mode 100644 (file)
index 0000000..f1e5ba4
--- /dev/null
@@ -0,0 +1,65 @@
+#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_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
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp
new file mode 100644 (file)
index 0000000..212cfc9
--- /dev/null
@@ -0,0 +1,157 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "string"\r
+#include "phone/include/PhoneCallPresenter.h"\r
+#include <iostream>\r
+#include "cat1_server_hal.h"\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static PhoneCallPresenter *g_pPhoneCallPresenter = nullptr;\r
+\r
+    PhoneCallPresenter::PhoneCallPresenter()\r
+    {\r
+        g_pPhoneCallPresenter = this;\r
+    }\r
+\r
+    PhoneCallPresenter::~PhoneCallPresenter()\r
+    {\r
+\r
+        g_pPhoneCallPresenter = nullptr;\r
+    }\r
+\r
+    PhoneCallPresenter *PhoneCallPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pPhoneCallPresenter;\r
+    }\r
+\r
+    void PhoneCallPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<PhoneCallView>::OnStart();\r
+    }\r
+\r
+    void PhoneCallPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<PhoneCallView>::OnPause();\r
+    }\r
+\r
+    void PhoneCallPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<PhoneCallView>::OnResume();\r
+    }\r
+\r
+    void PhoneCallPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<PhoneCallView>::OnStop();\r
+    }\r
+\r
+    bool PhoneCallPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_PHONE);\r
+        }\r
+        if ((event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP) &&\r
+            (event.GetStartPoint().y > 300))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_PHONECALLING);\r
+        }\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+    bool PhoneCallPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 获取控件id\r
+        const char *viewId = view.GetViewId();\r
+\r
+        // 根据控件id处理点击事件\r
+        if (strcmp(viewId, BUTTONCALL) == 0)\r
+        {\r
+            // 拨号键\r
+            //NativeAbility::GetInstance().ChangeSlice(VIEW_PHONERING);\r
+            calldial_event_sendmsg_toUI((char *)phoneNumber.c_str());\r
+        }\r
+        else if (strcmp(viewId, BUTTONDEL) == 0)\r
+        {\r
+            // 点击删除键,从号码字符串中删除最后一个字符\r
+            if (!phoneNumber.empty())\r
+            {\r
+                phoneNumber.pop_back();\r
+            }\r
+        }\r
+        else if (phoneNumber.length() < 11) // 检查号码字符串长度是否小于11\r
+        {\r
+            if (strcmp(viewId, BUTTON0) == 0)\r
+            {\r
+                // 点击0键,将字符'0'追加到号码字符串中\r
+                phoneNumber += "0";\r
+                printf("----0-----\n");\r
+            }\r
+            else if (strcmp(viewId, BUTTON1) == 0)\r
+            {\r
+                // 点击1键,将字符'1'追加到号码字符串中\r
+                phoneNumber += "1";\r
+                printf("----1-----\n");\r
+            }\r
+            else if (strcmp(viewId, BUTTON2) == 0)\r
+            {\r
+                // 点击2键,将字符'2'追加到号码字符串中\r
+                phoneNumber += "2";\r
+                printf("----2-----\n");\r
+            }\r
+            else if (strcmp(viewId, BUTTON3) == 0)\r
+            {\r
+                // 点击3键,将字符'3'追加到号码字符串中\r
+                phoneNumber += "3";\r
+            }\r
+            else if (strcmp(viewId, BUTTON4) == 0)\r
+            {\r
+                // 点击4键,将字符'4'追加到号码字符串中\r
+                phoneNumber += "4";\r
+            }\r
+            else if (strcmp(viewId, BUTTON5) == 0)\r
+            {\r
+                // 点击5键,将字符'5'追加到号码字符串中\r
+                phoneNumber += "5";\r
+            }\r
+            else if (strcmp(viewId, BUTTON6) == 0)\r
+            {\r
+                // 点击6键,将字符'6'追加到号码字符串中\r
+                phoneNumber += "6";\r
+            }\r
+            else if (strcmp(viewId, BUTTON7) == 0)\r
+            {\r
+                // 点击7键,将字符'7'追加到号码字符串中\r
+                phoneNumber += "7";\r
+            }\r
+            else if (strcmp(viewId, BUTTON8) == 0)\r
+            {\r
+                // 点击8键,将字符'8'追加到号码字符串中\r
+                phoneNumber += "8";\r
+            }\r
+            else if (strcmp(viewId, BUTTON9) == 0)\r
+            {\r
+                // 点击9键,将字符'9'追加到号码字符串中\r
+                phoneNumber += "9";\r
+            }\r
+        }\r
+        printf("**************************\n");\r
+        printf("per phoneNumber: %s\n", phoneNumber.c_str());\r
+\r
+        PhoneCallView::GetInstance()->ReLabel();\r
+\r
+        // view.Invalidate();\r
+        //  RootView::GetInstance()->Invalidate();\r
+\r
+        printf("now phoneNumber: %s\n", phoneNumber.c_str());\r
+        printf("**************************\n");\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallView.cpp
new file mode 100644 (file)
index 0000000..1873f5e
--- /dev/null
@@ -0,0 +1,246 @@
+#include "phone/include/PhoneCallView.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 PhoneCallView *g_pPhoneCallView{nullptr};\r
+\r
+    // 声明全局变量phoneNumber\r
+    extern std::string phoneNumber;\r
+\r
+    PhoneCallView::PhoneCallView()\r
+    {\r
+        g_pPhoneCallView = this;\r
+    }\r
+\r
+    PhoneCallView::~PhoneCallView()\r
+    {\r
+        DeInit();\r
+        g_pPhoneCallView = nullptr;\r
+    }\r
+\r
+    PhoneCallView *PhoneCallView::GetInstance()\r
+    {\r
+\r
+        return g_pPhoneCallView;\r
+    }\r
+\r
+    void PhoneCallView ::initButton(const ButtonInitParams &params)\r
+    {\r
+        UIButton *button = params.button;\r
+        if (button == nullptr)\r
+        {\r
+            button = new UIButton();\r
+        }\r
+\r
+        const char *buttonNumber = params.buttonNumber;\r
+        int leftPos = params.leftPos;\r
+        int topPos = params.topPos;\r
+        int width = params.width;\r
+        int height = params.height;\r
+        const char *defaultImgSrc = params.defaultImgSrc;\r
+        const char *triggeredImgSrc = params.triggeredImgSrc;\r
+\r
+        button->SetPosition(leftPos, topPos);\r
+        button->Resize(width, height);\r
+        button->SetViewId(buttonNumber);\r
+        button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
+\r
+        // Set additional properties\r
+        button->SetImageSrc(defaultImgSrc, triggeredImgSrc);\r
+        button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the callback for events\r
+        UIView::OnClickListener *buttonClick = static_cast<UIView::OnClickListener *>(PhoneCallPresenter::GetInstance());\r
+        button->SetOnClickListener(buttonClick);\r
+\r
+        // Add to rootView\r
+        container_->Add(button);\r
+        button->SetVisible(true);\r
+    }\r
+\r
+    void PhoneCallView::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 (label_ == nullptr)\r
+        {\r
+            label_ = new UILabel();\r
+        }\r
+        label_->SetPosition(115, 40); // widget's left position and top position\r
+        label_->Resize(236, 47);      // widget's width and height\r
+        label_->SetViewId("label1");  // Set style\r
+        label_->SetStyle(STYLE_TEXT_FONT, 40);\r
+\r
+        // Set additional property\r
+\r
+        label_->SetText(PhoneCallPresenter::GetInstance()->phoneNumber.c_str());\r
+        printf("view phoneNumber: %s\n", PhoneCallPresenter::GetInstance()->phoneNumber.c_str());\r
+        label_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label_->SetRollSpeed(0);\r
+        label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);\r
+\r
+        // Add to rootView\r
+        container_->Add(label_);\r
+        label_->SetVisible(true);\r
+        ButtonInitParams buttonParams[] = {\r
+            {button1_, BUTTON1, 68, 104, 104, 70, button1Path, nullptr},\r
+            {button2_, BUTTON2, 181, 104, 104, 70, button2Path, nullptr},\r
+            {button3_, BUTTON3, 293, 104, 104, 70, button3Path, nullptr},\r
+            {button4_, BUTTON4, 69, 182, 104, 70, button4Path, nullptr},\r
+            {button5_, BUTTON5, 182, 182, 104, 70, button5Path, nullptr},\r
+            {button6_, BUTTON6, 293, 182, 104, 70, button6Path, nullptr},\r
+            {button7_, BUTTON7, 69, 260, 104, 70, button7Path, nullptr},\r
+            {button8_, BUTTON8, 181, 260, 104, 70, button8Path, nullptr},\r
+            {button9_, BUTTON9, 293, 260, 104, 70, button9Path, nullptr},\r
+            {button0_, BUTTON0, 181, 338, 104, 70, button0Path, nullptr},\r
+            {buttoncall_, BUTTONCALL, 69, 338, 104, 70, buttonCallPath, nullptr},\r
+            {buttondel_, BUTTONDEL, 293, 338, 104, 70, buttonDelPath, nullptr},\r
+        };\r
+\r
+        for (const auto &params : buttonParams)\r
+        {\r
+            initButton(params);\r
+        }\r
+    }\r
+    void PhoneCallView::ReLabel()\r
+    {\r
+        label_->SetText(PhoneCallPresenter::GetInstance()->phoneNumber.c_str());\r
+    }\r
+    void PhoneCallView::DeInit()\r
+    {\r
+        printf("DeInit is ok !\n");\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+        }\r
+        if (button1_ != nullptr)\r
+        {\r
+            delete button1_;\r
+            button1_ = nullptr;\r
+        }\r
+        if (button2_ != nullptr)\r
+        {\r
+            delete button2_;\r
+            button2_ = nullptr;\r
+        }\r
+        if (button3_ != nullptr)\r
+        {\r
+            delete button3_;\r
+            button3_ = nullptr;\r
+        }\r
+        if (button4_ != nullptr)\r
+        {\r
+            delete button4_;\r
+            button4_ = nullptr;\r
+        }\r
+        if (button5_ != nullptr)\r
+        {\r
+            delete button5_;\r
+            button5_ = nullptr;\r
+        }\r
+        if (button6_ != nullptr)\r
+        {\r
+            delete button6_;\r
+            button6_ = nullptr;\r
+        }\r
+        if (button7_ != nullptr)\r
+        {\r
+            delete button7_;\r
+            button7_ = nullptr;\r
+        }\r
+        if (button8_ != nullptr)\r
+        {\r
+            delete button8_;\r
+            button8_ = nullptr;\r
+        }\r
+        if (button9_ != nullptr)\r
+        {\r
+            delete button9_;\r
+            button9_ = nullptr;\r
+        }\r
+        if (button0_ != nullptr)\r
+        {\r
+            delete button0_;\r
+            button0_ = nullptr;\r
+        }\r
+        if (buttoncall_ != nullptr)\r
+        {\r
+            delete buttoncall_;\r
+            buttoncall_ = nullptr;\r
+        }\r
+        if (buttondel_ != nullptr)\r
+        {\r
+            delete buttondel_;\r
+            buttondel_ = nullptr;\r
+        }\r
+        delete container_;\r
+        container_ = nullptr;\r
+    }\r
+    UIView *PhoneCallView::GetView()\r
+    {\r
+        Init();\r
+        return container_;\r
+    }\r
+    void PhoneCallView::OnStart()\r
+    {\r
+        printf("Start\n");\r
+        container_ = new UIViewGroup();\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 *>(PhoneCallPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
+        {\r
+            printf("draglistene is error!\n");\r
+            return;\r
+        }\r
+        container_->SetOnDragListener(draglistener);\r
+\r
+        container_->SetTouchable(true);\r
+        container_->SetDraggable(true);\r
+\r
+        // GetView();\r
+        GetView();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void PhoneCallView::OnSetUpView()\r
+    {\r
+\r
+        View<PhoneCallPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void PhoneCallView::OnTearDownView()\r
+    {\r
+\r
+        View<PhoneCallPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void PhoneCallView::OnStop()\r
+    {\r
+        View<PhoneCallPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+\r
+}\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallingPresenter.cpp
new file mode 100644 (file)
index 0000000..d5d1d01
--- /dev/null
@@ -0,0 +1,80 @@
+#include "AppViewIDs.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_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
new file mode 100644 (file)
index 0000000..00db57a
--- /dev/null
@@ -0,0 +1,320 @@
+\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
new file mode 100644 (file)
index 0000000..afff599
--- /dev/null
@@ -0,0 +1,91 @@
+#include "AppViewIDs.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_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
new file mode 100644 (file)
index 0000000..0e4e96b
--- /dev/null
@@ -0,0 +1,307 @@
+\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
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirPresenter.cpp
new file mode 100644 (file)
index 0000000..d67d465
--- /dev/null
@@ -0,0 +1,72 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+\r
+#include "phone/include/PhoneDirPresenter.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static PhoneDirPresenter *g_pPhoneDirPresenter = nullptr;\r
+\r
+    PhoneDirPresenter::PhoneDirPresenter()\r
+    {\r
+\r
+        g_pPhoneDirPresenter = this;\r
+    }\r
+\r
+    PhoneDirPresenter::~PhoneDirPresenter()\r
+    {\r
+\r
+        g_pPhoneDirPresenter = nullptr;\r
+    }\r
+\r
+    PhoneDirPresenter *PhoneDirPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pPhoneDirPresenter;\r
+    }\r
+\r
+    void PhoneDirPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<PhoneDirView>::OnStart();\r
+    }\r
+\r
+    void PhoneDirPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<PhoneDirView>::OnPause();\r
+    }\r
+\r
+    void PhoneDirPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<PhoneDirView>::OnResume();\r
+    }\r
+\r
+    void PhoneDirPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<PhoneDirView>::OnStop();\r
+    }\r
+\r
+    bool PhoneDirPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_PHONE);\r
+        }\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+\r
+    bool PhoneDirPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirView.cpp
new file mode 100644 (file)
index 0000000..914eb21
--- /dev/null
@@ -0,0 +1,635 @@
+\r
+\r
+#include "phone/include/PhoneDirView.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 "components/ui_label_button.h"\r
+namespace OHOS\r
+{\r
+\r
+    static PhoneDirView *g_pPhoneDirView{nullptr};\r
+\r
+    PhoneDirView::PhoneDirView()\r
+    {\r
+\r
+        g_pPhoneDirView = this;\r
+    }\r
+\r
+    PhoneDirView::~PhoneDirView()\r
+    {\r
+        DeInit();\r
+        g_pPhoneDirView = nullptr;\r
+    }\r
+\r
+    PhoneDirView *PhoneDirView::GetInstance()\r
+    {\r
+\r
+        return g_pPhoneDirView;\r
+    }\r
+#if 0\r
+    void PhoneDirView::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 ScrollView to App\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);        // widget's left position and top position\r
+        scrollView1_->Resize(466, 466);         // widget's width and height\r
+        scrollView1_->SetViewId("scrollView1"); // Set style\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+\r
+        // Set additional property\r
+\r
+        // Add to rootView\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(158, 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 scrollView1\r
+        scrollView1_->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(51, 291); // widget's left position and top position\r
+        label2_->Resize(400, 124);     // widget's width and height\r
+        label2_->SetViewId("label2");  // Set style\r
+        label2_->SetStyle(STYLE_TEXT_FONT, 26);\r
+\r
+        // Set additional property\r
+        label2_->SetText("未添加联系人,请前往“小希爱\n玩”APP进行设置");\r
+        label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label2_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
+        label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label2_->SetRollSpeed(0);\r
+        label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label2_);\r
+        label2_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image1_ == nullptr)\r
+        {\r
+            image1_ = new UIImageView();\r
+        }\r
+        image1_->SetPosition(158, 120); // widget's left position and top position\r
+        image1_->Resize(150, 150);      // 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/PhoneDir/PhoneDirdir.bin";\r
+#else\r
+        char *image1imagesPath = "/user/res/Phone/phonedir.bin";\r
+#endif\r
+        image1_->SetSrc(image1imagesPath);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image1_);\r
+        image1_->SetVisible(true);\r
+    }\r
+\r
+    void PhoneDirView::DeInit()\r
+    {\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = 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 (image1_ != nullptr)\r
+        {\r
+            delete image1_;\r
+            image1_ = nullptr;\r
+        }\r
+    }\r
+\r
+#endif\r
+    void PhoneDirView::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 ScrollView to App\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);        // widget's left position and top position\r
+        scrollView1_->Resize(466, 466);         // widget's width and height\r
+        scrollView1_->SetViewId("scrollView1"); // Set style\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+\r
+        // Set additional property\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnDragListener *scrollView1Drag = static_cast<UIView::OnDragListener *>(PhoneDirPresenter::GetInstance());\r
+        scrollView1_->SetOnDragListener(scrollView1Drag);\r
+        // Add to rootView\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(158, 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 scrollView1\r
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+\r
+        // Add LabelButtonExt to App\r
+        if (labelButton8_ == nullptr)\r
+        {\r
+            labelButton8_ = new UILabelButtonExt();\r
+        }\r
+        labelButton8_->SetPosition(43, 243);      // widget's left position and top position\r
+        labelButton8_->Resize(380, 100);          // widget's width and height\r
+        labelButton8_->SetViewId("labelButton2"); // Set style\r
+        labelButton8_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+\r
+        // Set additional property\r
+        labelButton8_->SetText("蔡小小");\r
+        labelButton8_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        labelButton8_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *labelButton8Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
+        labelButton8_->SetOnClickListener(labelButton8Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(labelButton8_);\r
+        labelButton8_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image2_ == nullptr)\r
+        {\r
+            image2_ = new UIImageView();\r
+        }\r
+        image2_->SetPosition(82, 260); // widget's left position and top position\r
+        image2_->Resize(89, 80);       // widget's width and height\r
+        image2_->SetViewId("image2");  // Set style\r
+\r
+        // Set additional property\r
+#ifdef _WIN32\r
+        char *image2imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-boy.bin";\r
+#else\r
+        char *image2imagesPath = "/user/res/Phone/little-boy.bin";\r
+#endif\r
+        image2_->SetSrc(image2imagesPath);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image2_);\r
+        image2_->SetVisible(true);\r
+\r
+        // Add LabelButtonExt to App\r
+        if (labelButton9_ == nullptr)\r
+        {\r
+            labelButton9_ = new UILabelButtonExt();\r
+        }\r
+        labelButton9_->SetPosition(43, 363);      // widget's left position and top position\r
+        labelButton9_->Resize(380, 100);          // widget's width and height\r
+        labelButton9_->SetViewId("labelButton3"); // Set style\r
+        labelButton9_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+\r
+        // Set additional property\r
+        labelButton9_->SetText("坤钟");\r
+        labelButton9_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        labelButton9_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *labelButton9Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
+        labelButton9_->SetOnClickListener(labelButton9Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(labelButton9_);\r
+        labelButton9_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image3_ == nullptr)\r
+        {\r
+            image3_ = new UIImageView();\r
+        }\r
+        image3_->SetPosition(86, 381); // widget's left position and top position\r
+        image3_->Resize(100, 100);     // widget's width and height\r
+        image3_->SetViewId("image3");  // Set style\r
+\r
+        // Set additional property\r
+#ifdef _WIN32\r
+        char *image3imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-boy.bin";\r
+#else\r
+        char *image3imagesPath = "/user/res/Phone/little-boy.bin";\r
+#endif\r
+        image3_->SetSrc(image3imagesPath);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image3_);\r
+        image3_->SetVisible(true);\r
+\r
+        // Add LabelButtonExt to App\r
+        if (labelButton10_ == nullptr)\r
+        {\r
+            labelButton10_ = new UILabelButtonExt();\r
+        }\r
+        labelButton10_->SetPosition(43, 483);      // widget's left position and top position\r
+        labelButton10_->Resize(380, 100);          // widget's width and height\r
+        labelButton10_->SetViewId("labelButton4"); // Set style\r
+        labelButton10_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+\r
+        // Set additional property\r
+        labelButton10_->SetText("萧炎");\r
+        labelButton10_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        labelButton10_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *labelButton10Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
+        labelButton10_->SetOnClickListener(labelButton10Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(labelButton10_);\r
+        labelButton10_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image5_ == nullptr)\r
+        {\r
+            image5_ = new UIImageView();\r
+        }\r
+        image5_->SetPosition(92, 499); // widget's left position and top position\r
+        image5_->Resize(100, 100);     // widget's width and height\r
+        image5_->SetViewId("image5");  // Set style\r
+\r
+        // Set additional property\r
+#ifdef _WIN32\r
+        char *image5imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-girl.bin";\r
+#else\r
+        char *image5imagesPath = "/user/res/Phone/little-girl.bin";\r
+#endif\r
+        image5_->SetSrc(image5imagesPath);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image5_);\r
+        image5_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image7_ == nullptr)\r
+        {\r
+            image7_ = new UIImageView();\r
+        }\r
+        image7_->SetPosition(167, -106); // widget's left position and top position\r
+        image7_->Resize(100, 100);       // widget's width and height\r
+        image7_->SetViewId("image7");    // Set style\r
+\r
+        // Set additional property\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image7_);\r
+        image7_->SetVisible(true);\r
+\r
+        // Add LabelButtonExt to App\r
+        if (labelButton13_ == nullptr)\r
+        {\r
+            labelButton13_ = new UILabelButtonExt();\r
+        }\r
+        labelButton13_->SetPosition(43, 723);      // widget's left position and top position\r
+        labelButton13_->Resize(380, 100);          // widget's width and height\r
+        labelButton13_->SetViewId("labelButton6"); // Set style\r
+        labelButton13_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+\r
+        // Set additional property\r
+        labelButton13_->SetText("五月天");\r
+        labelButton13_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        labelButton13_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *labelButton13Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
+        labelButton13_->SetOnClickListener(labelButton13Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(labelButton13_);\r
+        labelButton13_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image9_ == nullptr)\r
+        {\r
+            image9_ = new UIImageView();\r
+        }\r
+        image9_->SetPosition(100, 745); // widget's left position and top position\r
+        image9_->Resize(100, 100);      // widget's width and height\r
+        image9_->SetViewId("image9");   // Set style\r
+\r
+        // Set additional property\r
+#ifdef _WIN32\r
+        char *image9imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-boy.bin";\r
+#else\r
+        char *image9imagesPath = "/user/res/Phone/little-boy.bin";\r
+#endif\r
+        image9_->SetSrc(image9imagesPath);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image9_);\r
+        image9_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image8_ == nullptr)\r
+        {\r
+            image8_ = new UIImageView();\r
+        }\r
+        image8_->SetPosition(183, 874); // widget's left position and top position\r
+        image8_->Resize(100, 100);      // widget's width and height\r
+        image8_->SetViewId("image8");   // Set style\r
+\r
+        // Set additional property\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image8_);\r
+        image8_->SetVisible(true);\r
+\r
+        // Add LabelButtonExt to App\r
+        if (labelButton11_ == nullptr)\r
+        {\r
+            labelButton11_ = new UILabelButtonExt();\r
+        }\r
+        labelButton11_->SetPosition(43, 603);      // widget's left position and top position\r
+        labelButton11_->Resize(380, 100);          // widget's width and height\r
+        labelButton11_->SetViewId("labelButton5"); // Set style\r
+        labelButton11_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+\r
+        // Set additional property\r
+        labelButton11_->SetText("舒芸芸");\r
+        labelButton11_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        labelButton11_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *labelButton11Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
+        labelButton11_->SetOnClickListener(labelButton11Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(labelButton11_);\r
+        labelButton11_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image6_ == nullptr)\r
+        {\r
+            image6_ = new UIImageView();\r
+        }\r
+        image6_->SetPosition(95, 617); // widget's left position and top position\r
+        image6_->Resize(100, 100);     // widget's width and height\r
+        image6_->SetViewId("image6");  // Set style\r
+\r
+        // Set additional property\r
+#ifdef _WIN32\r
+        char *image6imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-girl.bin";\r
+#else\r
+        char *image6imagesPath = "/user/res/Phone/little-girl.bin";\r
+#endif\r
+        image6_->SetSrc(image6imagesPath);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image6_);\r
+        image6_->SetVisible(true);\r
+\r
+        // Add LabelButtonExt to App\r
+        if (labelButton7_ == nullptr)\r
+        {\r
+            labelButton7_ = new UILabelButtonExt();\r
+        }\r
+        labelButton7_->SetPosition(43, 123);      // widget's left position and top position\r
+        labelButton7_->Resize(380, 100);          // widget's width and height\r
+        labelButton7_->SetViewId("labelButton1"); // Set style\r
+        labelButton7_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+\r
+        // Set additional property\r
+        labelButton7_->SetText("小梦同学(客服热线)");\r
+        labelButton7_->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff));\r
+        labelButton7_->SetAlign(TEXT_ALIGNMENT_RIGHT);\r
+        labelButton7_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        labelButton7_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *labelButton7Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
+        labelButton7_->SetOnClickListener(labelButton7Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(labelButton7_);\r
+        labelButton7_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image1_ == nullptr)\r
+        {\r
+            image1_ = new UIImageView();\r
+        }\r
+        image1_->SetPosition(76, 141); // 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/little-girl.bin";\r
+#else\r
+        char *image1imagesPath = "/user/res/Phone/little-girl.bin";\r
+#endif\r
+        image1_->SetSrc(image1imagesPath);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image1_);\r
+        image1_->SetVisible(true);\r
+    }\r
+\r
+    void PhoneDirView::DeInit()\r
+    {\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+        if (label1_ != nullptr)\r
+        {\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        if (labelButton8_ != nullptr)\r
+        {\r
+            delete labelButton8_;\r
+            labelButton8_ = nullptr;\r
+        }\r
+        if (image2_ != nullptr)\r
+        {\r
+            delete image2_;\r
+            image2_ = nullptr;\r
+        }\r
+        if (labelButton9_ != nullptr)\r
+        {\r
+            delete labelButton9_;\r
+            labelButton9_ = nullptr;\r
+        }\r
+        if (image3_ != nullptr)\r
+        {\r
+            delete image3_;\r
+            image3_ = nullptr;\r
+        }\r
+        if (labelButton10_ != nullptr)\r
+        {\r
+            delete labelButton10_;\r
+            labelButton10_ = nullptr;\r
+        }\r
+        if (image5_ != nullptr)\r
+        {\r
+            delete image5_;\r
+            image5_ = nullptr;\r
+        }\r
+        if (image7_ != nullptr)\r
+        {\r
+            delete image7_;\r
+            image7_ = nullptr;\r
+        }\r
+        if (labelButton13_ != nullptr)\r
+        {\r
+            delete labelButton13_;\r
+            labelButton13_ = nullptr;\r
+        }\r
+        if (image9_ != nullptr)\r
+        {\r
+            delete image9_;\r
+            image9_ = nullptr;\r
+        }\r
+        if (image8_ != nullptr)\r
+        {\r
+            delete image8_;\r
+            image8_ = nullptr;\r
+        }\r
+        if (labelButton11_ != nullptr)\r
+        {\r
+            delete labelButton11_;\r
+            labelButton11_ = nullptr;\r
+        }\r
+        if (image6_ != nullptr)\r
+        {\r
+            delete image6_;\r
+            image6_ = nullptr;\r
+        }\r
+        if (labelButton7_ != nullptr)\r
+        {\r
+            delete labelButton7_;\r
+            labelButton7_ = nullptr;\r
+        }\r
+        if (image1_ != nullptr)\r
+        {\r
+            delete image1_;\r
+            image1_ = nullptr;\r
+        }\r
+    }\r
+    UIView *PhoneDirView::GetView()\r
+    {\r
+        Init();\r
+        return container_;\r
+    }\r
+    void PhoneDirView::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 *>(PhoneDirPresenter::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 PhoneDirView::OnSetUpView()\r
+    {\r
+\r
+        View<PhoneDirPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void PhoneDirView::OnTearDownView()\r
+    {\r
+\r
+        View<PhoneDirPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void PhoneDirView::OnStop()\r
+    {\r
+        View<PhoneDirPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhonePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhonePresenter.cpp
new file mode 100644 (file)
index 0000000..67b8432
--- /dev/null
@@ -0,0 +1,81 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+\r
+#include "phone/include/PhonePresenter.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static PhonePresenter *g_pPhonePresenter = nullptr;\r
+\r
+    PhonePresenter::PhonePresenter()\r
+    {\r
+\r
+        g_pPhonePresenter = this;\r
+    }\r
+\r
+    PhonePresenter::~PhonePresenter()\r
+    {\r
+\r
+        g_pPhonePresenter = nullptr;\r
+    }\r
+\r
+    PhonePresenter *PhonePresenter::GetInstance()\r
+    {\r
+\r
+        return g_pPhonePresenter;\r
+    }\r
+\r
+    void PhonePresenter::OnStart()\r
+    {\r
+\r
+        Presenter<PhoneView>::OnStart();\r
+    }\r
+\r
+    void PhonePresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<PhoneView>::OnPause();\r
+    }\r
+\r
+    void PhonePresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<PhoneView>::OnResume();\r
+    }\r
+\r
+    void PhonePresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<PhoneView>::OnStop();\r
+    }\r
+\r
+    bool PhonePresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
+        }\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+\r
+    bool PhonePresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
+        if (strcmp(view.GetViewId(), RINGBUTTON) == 0)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_PHONEDIR);\r
+        }\r
+        if (strcmp(view.GetViewId(), CALLBUTTON) == 0)\r
+        {\r
+            printf("phonecall!\n");\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_PHONECALL);\r
+        }\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneRingPresenter.cpp
new file mode 100644 (file)
index 0000000..0eac680
--- /dev/null
@@ -0,0 +1,75 @@
+#include "AppViewIDs.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_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
new file mode 100644 (file)
index 0000000..75528b7
--- /dev/null
@@ -0,0 +1,278 @@
+\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
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneView.cpp
new file mode 100644 (file)
index 0000000..f195441
--- /dev/null
@@ -0,0 +1,626 @@
+\r
+\r
+#include "phone/include/PhoneView.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 PhoneView *g_pPhoneView{nullptr};\r
+\r
+    PhoneView::PhoneView()\r
+    {\r
+\r
+        g_pPhoneView = this;\r
+    }\r
+\r
+    PhoneView::~PhoneView()\r
+    {\r
+        DeInit();\r
+        g_pPhoneView = nullptr;\r
+    }\r
+\r
+    PhoneView *PhoneView::GetInstance()\r
+    {\r
+\r
+        return g_pPhoneView;\r
+    }\r
+\r
+    void PhoneView::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 ScrollView to App\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);        // widget's left position and top position\r
+        scrollView1_->Resize(466, 466);         // widget's width and height\r
+        scrollView1_->SetViewId("scrollView1"); // Set style\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+\r
+        // Set additional property\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnDragListener *scrollView1Drag = static_cast<UIView::OnDragListener *>(PhonePresenter::GetInstance());\r
+        scrollView1_->SetOnDragListener(scrollView1Drag);\r
+        // Add to rootView\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\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 scrollView1\r
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image1_ == nullptr)\r
+        {\r
+            image1_ = new UIImageView();\r
+        }\r
+        image1_->SetPosition(183, -73); // 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
+\r
+        // Add to scrollView1\r
+        scrollView1_->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(263, 116); // widget's left position and top position\r
+        button2_->Resize(140, 140);      // widget's width and height\r
+        button2_->SetViewId("Call");     // Set style\r
+        button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\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/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 *>(PhonePresenter::GetInstance());\r
+        button2_->SetOnClickListener(button2Click);\r
+        // Add to scrollView1\r
+        scrollView1_->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(63, 116); // widget's left position and top position\r
+        button1_->Resize(140, 140);     // widget's width and height\r
+        button1_->SetViewId("Ring");    // 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/ring.bin";\r
+#else\r
+        char *button1defaultImgSrc = "/user/res/Phone/Phone_Ring.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 *>(PhonePresenter::GetInstance());\r
+        button1_->SetOnClickListener(button1Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(button1_);\r
+        button1_->SetVisible(true);\r
+\r
+        // Add Button to App\r
+        if (button5_ == nullptr)\r
+        {\r
+            button5_ = new UIButton();\r
+        }\r
+        button5_->SetPosition(54, 358); // widget's left position and top position\r
+        button5_->Resize(390, 104);     // widget's width and height\r
+        button5_->SetViewId("test1");   // Set style\r
+        button5_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+\r
+        // Set additional property\r
+        button5_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button5Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
+        button5_->SetOnClickListener(button5Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(button5_);\r
+        button5_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label2_ == nullptr)\r
+        {\r
+            label2_ = new UILabel();\r
+        }\r
+        label2_->SetPosition(173, 290); // widget's left position and top position\r
+        label2_->Resize(200, 60);       // 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_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label2_->SetRollSpeed(0);\r
+        label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label2_);\r
+        label2_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label3_ == nullptr)\r
+        {\r
+            label3_ = new UILabel();\r
+        }\r
+        label3_->SetPosition(83, 379); // widget's left position and top position\r
+        label3_->Resize(200, 60);      // widget's width and height\r
+        label3_->SetViewId("label3");  // Set style\r
+        label3_->SetStyle(STYLE_TEXT_FONT, 35);\r
+\r
+        // Set additional property\r
+        label3_->SetText("138 8888 4270");\r
+        label3_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label3_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label3_->SetRollSpeed(0);\r
+        label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label3_);\r
+        label3_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label4_ == nullptr)\r
+        {\r
+            label4_ = new UILabel();\r
+        }\r
+        label4_->SetPosition(87, 420); // widget's left position and top position\r
+        label4_->Resize(200, 60);      // widget's width and height\r
+        label4_->SetViewId("label4");  // Set style\r
+        label4_->SetStyle(STYLE_TEXT_FONT, 20);\r
+\r
+        // Set additional property\r
+        label4_->SetText("2023-11-11 14:56");\r
+        label4_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label4_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label4_->SetRollSpeed(0);\r
+        label4_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label4_);\r
+        label4_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label9_ == nullptr)\r
+        {\r
+            label9_ = new UILabel();\r
+        }\r
+        label9_->SetPosition(262, 419); // widget's left position and top position\r
+        label9_->Resize(200, 60);       // widget's width and height\r
+        label9_->SetViewId("label5");   // Set style\r
+        label9_->SetStyle(STYLE_TEXT_FONT, 20);\r
+\r
+        // Set additional property\r
+        label9_->SetText("拨入来电");\r
+        label9_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label9_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label9_->SetRollSpeed(0);\r
+        label9_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label9_);\r
+        label9_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label14_ == nullptr)\r
+        {\r
+            label14_ = new UILabel();\r
+        }\r
+        label14_->SetPosition(62, 850); // widget's left position and top position\r
+        label14_->Resize(200, 60);      // widget's width and height\r
+        label14_->SetViewId("label14"); // Set style\r
+        label14_->SetStyle(STYLE_TEXT_FONT, 26);\r
+\r
+        // Set additional property\r
+        label14_->SetText("注:只保留最近20条通话记录");\r
+        label14_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label14_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
+        label14_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label14_->SetRollSpeed(0);\r
+        label14_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label14_);\r
+        label14_->SetVisible(true);\r
+\r
+        // Add Button to App\r
+        if (button3_ == nullptr)\r
+        {\r
+            button3_ = new UIButton();\r
+        }\r
+        button3_->SetPosition(54, 482); // widget's left position and top position\r
+        button3_->Resize(390, 104);     // widget's width and height\r
+        button3_->SetViewId("test2");   // Set style\r
+        button3_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+\r
+        // Set additional property\r
+        button3_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff4266c3, UIButton::PRESSED);\r
+        button3_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button3Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
+        button3_->SetOnClickListener(button3Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(button3_);\r
+        button3_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label13_ == nullptr)\r
+        {\r
+            label13_ = new UILabel();\r
+        }\r
+        label13_->SetPosition(90, 537); // widget's left position and top position\r
+        label13_->Resize(200, 60);      // widget's width and height\r
+        label13_->SetViewId("label4");  // Set style\r
+        label13_->SetStyle(STYLE_TEXT_FONT, 20);\r
+\r
+        // Set additional property\r
+        label13_->SetText("2023-11-10 17:00");\r
+        label13_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label13_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label13_->SetRollSpeed(0);\r
+        label13_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label13_);\r
+        label13_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label12_ == nullptr)\r
+        {\r
+            label12_ = new UILabel();\r
+        }\r
+        label12_->SetPosition(86, 491); // widget's left position and top position\r
+        label12_->Resize(200, 60);      // widget's width and height\r
+        label12_->SetViewId("label3");  // Set style\r
+        label12_->SetStyle(STYLE_TEXT_FONT, 35);\r
+\r
+        // Set additional property\r
+        label12_->SetText("0734 5411 6565");\r
+        label12_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label12_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label12_->SetRollSpeed(0);\r
+        label12_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label12_);\r
+        label12_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label10_ == nullptr)\r
+        {\r
+            label10_ = new UILabel();\r
+        }\r
+        label10_->SetPosition(269, 536); // widget's left position and top position\r
+        label10_->Resize(200, 60);       // widget's width and height\r
+        label10_->SetViewId("lable10");  // Set style\r
+        label10_->SetStyle(STYLE_TEXT_FONT, 20);\r
+\r
+        // Set additional property\r
+        label10_->SetText("未接来电");\r
+        label10_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label10_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));\r
+        label10_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label10_->SetRollSpeed(0);\r
+        label10_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label10_);\r
+        label10_->SetVisible(true);\r
+\r
+        // Add Button to App\r
+        if (button7_ == nullptr)\r
+        {\r
+            button7_ = new UIButton();\r
+        }\r
+        button7_->SetPosition(54, 603); // widget's left position and top position\r
+        button7_->Resize(390, 104);     // widget's width and height\r
+        button7_->SetViewId("test3");   // Set style\r
+        button7_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        button7_->SetStyle(STYLE_BORDER_RADIUS, 52);\r
+\r
+        // Set additional property\r
+        button7_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        button7_->SetStyleForState(STYLE_BORDER_RADIUS, 52, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button7Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
+        button7_->SetOnClickListener(button7Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(button7_);\r
+        button7_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label11_ == nullptr)\r
+        {\r
+            label11_ = new UILabel();\r
+        }\r
+        label11_->SetPosition(89, 650); // widget's left position and top position\r
+        label11_->Resize(200, 60);      // widget's width and height\r
+        label11_->SetViewId("label11"); // Set style\r
+        label11_->SetStyle(STYLE_TEXT_FONT, 20);\r
+\r
+        // Set additional property\r
+        label11_->SetText("2023-11-9 12:00");\r
+        label11_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label11_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label11_->SetRollSpeed(0);\r
+        label11_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label11_);\r
+        label11_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label16_ == nullptr)\r
+        {\r
+            label16_ = new UILabel();\r
+        }\r
+        label16_->SetPosition(86, 613); // widget's left position and top position\r
+        label16_->Resize(200, 60);      // widget's width and height\r
+        label16_->SetViewId("label11"); // Set style\r
+        label16_->SetStyle(STYLE_TEXT_FONT, 26);\r
+\r
+        // Set additional property\r
+        label16_->SetText("小梦同学");\r
+        label16_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label16_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label16_->SetRollSpeed(0);\r
+        label16_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label16_);\r
+        label16_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label15_ == nullptr)\r
+        {\r
+            label15_ = new UILabel();\r
+        }\r
+        label15_->SetPosition(257, 650); // widget's left position and top position\r
+        label15_->Resize(200, 60);       // widget's width and height\r
+        label15_->SetViewId("label11");  // Set style\r
+        label15_->SetStyle(STYLE_TEXT_FONT, 20);\r
+\r
+        // Set additional property\r
+        label15_->SetText("拨出电话");\r
+        label15_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label15_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label15_->SetRollSpeed(0);\r
+        label15_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label15_);\r
+        label15_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image3_ == nullptr)\r
+        {\r
+            image3_ = new UIImageView();\r
+        }\r
+        image3_->SetPosition(183, 927); // widget's left position and top position\r
+        image3_->Resize(100, 100);      // widget's width and height\r
+        image3_->SetViewId("image3");   // Set style\r
+\r
+        // Set additional property\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image3_);\r
+        image3_->SetVisible(true);\r
+    }\r
+\r
+    void PhoneView::DeInit()\r
+    {\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+        if (label1_ != nullptr)\r
+        {\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        if (image1_ != nullptr)\r
+        {\r
+            delete image1_;\r
+            image1_ = nullptr;\r
+        }\r
+        if (button2_ != nullptr)\r
+        {\r
+            delete button2_;\r
+            button2_ = nullptr;\r
+        }\r
+        if (button1_ != nullptr)\r
+        {\r
+            delete button1_;\r
+            button1_ = nullptr;\r
+        }\r
+        if (button5_ != nullptr)\r
+        {\r
+            delete button5_;\r
+            button5_ = nullptr;\r
+        }\r
+        if (label2_ != nullptr)\r
+        {\r
+            delete label2_;\r
+            label2_ = nullptr;\r
+        }\r
+        if (label3_ != nullptr)\r
+        {\r
+            delete label3_;\r
+            label3_ = nullptr;\r
+        }\r
+        if (label4_ != nullptr)\r
+        {\r
+            delete label4_;\r
+            label4_ = nullptr;\r
+        }\r
+        if (label9_ != nullptr)\r
+        {\r
+            delete label9_;\r
+            label9_ = nullptr;\r
+        }\r
+        if (label14_ != nullptr)\r
+        {\r
+            delete label14_;\r
+            label14_ = nullptr;\r
+        }\r
+        if (button3_ != nullptr)\r
+        {\r
+            delete button3_;\r
+            button3_ = nullptr;\r
+        }\r
+        if (label13_ != nullptr)\r
+        {\r
+            delete label13_;\r
+            label13_ = nullptr;\r
+        }\r
+        if (label12_ != nullptr)\r
+        {\r
+            delete label12_;\r
+            label12_ = nullptr;\r
+        }\r
+        if (label10_ != nullptr)\r
+        {\r
+            delete label10_;\r
+            label10_ = nullptr;\r
+        }\r
+        if (button7_ != nullptr)\r
+        {\r
+            delete button7_;\r
+            button7_ = nullptr;\r
+        }\r
+        if (label11_ != nullptr)\r
+        {\r
+            delete label11_;\r
+            label11_ = nullptr;\r
+        }\r
+        if (label16_ != nullptr)\r
+        {\r
+            delete label16_;\r
+            label16_ = nullptr;\r
+        }\r
+        if (label15_ != nullptr)\r
+        {\r
+            delete label15_;\r
+            label15_ = nullptr;\r
+        }\r
+        if (image3_ != nullptr)\r
+        {\r
+            delete image3_;\r
+            image3_ = nullptr;\r
+        }\r
+    }\r
+\r
+    UIView *PhoneView::GetView()\r
+    {\r
+        Init();\r
+        return container_;\r
+    }\r
+    void PhoneView::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 *>(PhonePresenter::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 PhoneView::OnSetUpView()\r
+    {\r
+\r
+        View<PhonePresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void PhoneView::OnTearDownView()\r
+    {\r
+\r
+        View<PhonePresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void PhoneView::OnStop()\r
+    {\r
+        View<PhonePresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}\r
index a62120e..3b6c07b 100755 (executable)
@@ -28,7 +28,8 @@ enum PhoneStatus {
     PHONE_MULTI_STATUS = 0,\r
     PHONE_SINGLE_STATUS\r
 };\r
-\r
+void g_callTimesclean();\r
+void g_callTimesadd();\r
 bool MulitplePhoneTextReplaces();\r
 bool FindCallListInfoAndSetPriorityNumber();\r
 void PhoneScoStatausCallback(hfp_sco_connect_state_t state);\r
@@ -87,6 +88,8 @@ public:
     {\r
         callsrc = source;\r
     }\r
+\r
+    \r
 private:\r
     CallerLogModel();\r
     CallerLogModel(const CallerLogModel &);\r
index df203e0..62f6994 100755 (executable)
@@ -38,6 +38,16 @@ static int g_secondPriority = NO_NUMBER_STATUS;
 static int g_thirdPriority = NO_NUMBER_STATUS;
 static int g_fourthPriority = NO_NUMBER_STATUS;
 
+void g_callTimesclean()
+{
+    g_callTimes=0;
+}
+
+void g_callTimesadd()
+{
+    g_callTimes++;
+}
+
 static void SetPriorityNumber()
 {
     time_t seconds;
index 365ced2..9765a69 100755 (executable)
@@ -31,6 +31,10 @@ public:
     bool SetUpVolume(void);\r
     UIButton *GetIncreaseButton(void);\r
     UIButton *GetDecreaseButton(void);\r
+    int get_progress_vlaue()\r
+    {\r
+        return progress->GetValue();\r
+    }\r
 private:\r
     VolumeSliderEventListener *listener{nullptr};\r
     UISlider *progress{nullptr};\r
index b7889fe..5f5b9c8 100755 (executable)
@@ -60,6 +60,7 @@ typedef enum {
     TOPIC_EVENT_CAT1_INCOMMING,
     TOPIC_EVENT_CAT1_CALLCONNTED,
     TOPIC_EVENT_CAT1_CALLENDED,
+    TOPIC_EVENT_CAT1_CALLDIAL,
     TOPIC_EVENT_CAT1_SIGNAL_UPDATE,
     TOPIC_EVENT_CAT1_POWER_ON,
     TOPIC_EVENT_CAT1_POWER_OFF,
index bd4bac0..5642618 100755 (executable)
@@ -47,6 +47,7 @@ static const TopicToCore topicToCoreArray[] = {
     {TOPIC_EVENT_CAT1_INCOMMING, A_CORE_MASK, 1},
     {TOPIC_EVENT_CAT1_CALLCONNTED, A_CORE_MASK, 1},
     {TOPIC_EVENT_CAT1_CALLENDED, A_CORE_MASK, 1},
+    {TOPIC_EVENT_CAT1_CALLDIAL, A_CORE_MASK, 1},
     {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, A_CORE_MASK, 1},
     {TOPIC_EVENT_CAT1_POWER_ON, A_CORE_MASK, 1},
     {TOPIC_EVENT_CAT1_POWER_OFF, A_CORE_MASK, 1},
index a2b5a9a..824a1db 100755 (executable)
 typedef enum {
     NOTIFY_PHONE_CALLING_DISPLAY = 0,
     NOTIFY_PHONE_CURTIME_DISPLAY = 1,
+    NOTIFY_PHONE_DIAL_DISPLAY = 3,
     NOTIFY_PHONE_UNKNOWN = 10,
 }CallTimerType;
 
 namespace OHOS {
 UIViewGroup* CreatePhoneCallView(void);
 UIViewGroup* CreateCallingView(void);
+UIViewGroup* CreateCalldialView(void);
+void FreeCalldialView(void);
 void HonrsViewChange(void);
 void FreeCallingView(void);
 void FreePhoneCallView(void);
+
 void RefreshMicrophoneImageSrc(const char* src);
 void CallTimerCallBackProc(int data);
 void CallCurTimerCallBack(int data);
@@ -35,10 +39,8 @@ public:
        virtual ~CallViewEventListener();
        static CallViewEventListener *GetInstance(void);
     bool OnClick(OHOS::UIView& view, const OHOS::ClickEvent& event) override;
-    virtual bool OnDrag(UIView& view, const DragEvent& event) override
-    {
-        return true;
-    }
+    bool OnDrag(UIView& view, const DragEvent& event) override;
+    
     virtual bool OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& event) override
     {
         return true;
index 6a96e66..e830dad 100755 (executable)
@@ -31,7 +31,7 @@
 #include "common_def.h"
 #include "PhoneService.h"
 #include "power_display_service.h"
-
+#include "cat1_server.h"
 namespace OHOS {
 
 #ifdef __cplusplus
@@ -56,6 +56,7 @@ const PriorityMapper g_pri_mapper[] = {
     {TOPIC_EVENT_CAT1_INCOMMING, PRIORITY_ONE},
     {TOPIC_EVENT_CAT1_CALLCONNTED, PRIORITY_ONE},
     {TOPIC_EVENT_CAT1_CALLENDED, PRIORITY_ONE},
+    {TOPIC_EVENT_CAT1_CALLDIAL,PRIORITY_ONE},
     {TOPIC_EVENT_CAT1_SIGNAL_UPDATE, PRIORITY_ONE},
     {TOPIC_EVENT_CAT1_POWER_ON, PRIORITY_ONE},
     {TOPIC_EVENT_CAT1_POWER_OFF, PRIORITY_ONE},
@@ -114,6 +115,7 @@ void MsgCenterSubscribe()
     MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_INCOMMING);
     MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLCONNTED);
     MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLENDED);
+    MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_CALLDIAL);
     MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_SIGNAL_UPDATE);
     MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_ON);
     MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_OFF);
@@ -135,6 +137,11 @@ static OHOS::UIViewGroup* showCallingNotify(void)
     return OHOS::CreateCallingView();
 }
 
+static OHOS::UIViewGroup* CalldialNotify(void)
+{
+    return OHOS::CreateCalldialView();
+}
+
 void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
 {
     unused(req);
@@ -339,15 +346,49 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req)
     NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
     CallerLogModel::GetInstance()->SetNotifyFlag(true);
     NotificationManager::GetInstance()->ShowNotify(CreateCallingView, (uint16_t)topic, true);
+    CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
 
 }
-void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
+void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
 {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify MsgCenterNotifyCat1dialProc");
     unused(topic);
     unused(req);
+     if (req == NULL) return ;
+    char* call_data = (char*)malloc(req->len);
+    int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
+    if (ret != EOK) {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!");
+    } else {
+    // Prevent this from happening:
+    // When the incoming call view is displayed, the calling number is not set in CallerLogModel.
+        // const power_display_svr_api_t *display_api = power_display_svr_get_api();
+        // if (display_api->get_screen_state() != SCREEN_ON)
+        //  {   
+        //        display_api->turn_on_screen();  
+        //  }  
+        // display_api->set_screen_set_keepon_timeout(10);
+        
+        //AlarmClockModel::GetInstance()->AlarmPlayerStart();
+        cat1_call_dial(call_data);
+        CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
+        CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+        // hfp_hf_calls_info_t call;
+        // CallChangeIncomePro(&call);
+    }
+    free(call_data);
+
+    NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+    CallerLogModel::GetInstance()->SetNotifyFlag(true);
+    NotificationManager::GetInstance()->ShowNotify(CalldialNotify, (uint16_t)topic, true);
+
 
-     unused(topic);
+}
+void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
+{
+    unused(topic);
     unused(req);
+
     // just stop the notify
     AlarmClockModel::GetInstance()->AlarmPlayerStop();
     if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) {
@@ -396,10 +437,11 @@ static msg_center_notify_table_t g_msg_center_notify_table[] = {
     {TOPIC_EVENT_STOP_SPO2_MONITORING,  MsgCenterNotifyStopSPO2MonitoringProc},
 #endif
 #ifdef SUPPORT_CAT1_MODEM
-    {TOPIC_EVENT_CAT1_INCOMMING,      MsgCenterNotifyCatIncomingCallProc},
+    {TOPIC_EVENT_CAT1_INCOMMING,        MsgCenterNotifyCatIncomingCallProc},
     {TOPIC_EVENT_CAT1_CALLCONNTED,      MsgCenterNotifyCat1CallConnectedProc},
-    {TOPIC_EVENT_CAT1_CALLENDED,      MsgCenterNotifyCat1CallEndedProc},
-    {TOPIC_EVENT_CAT1_SIGNAL_UPDATE,      MsgCenterNotifyCat1SignalUpdateProc},
+    {TOPIC_EVENT_CAT1_CALLENDED,        MsgCenterNotifyCat1CallEndedProc},
+    {TOPIC_EVENT_CAT1_CALLDIAL,         MsgCenterNotifyCat1dialProc},
+    {TOPIC_EVENT_CAT1_SIGNAL_UPDATE,    MsgCenterNotifyCat1SignalUpdateProc},
     {TOPIC_EVENT_CAT1_POWER_ON,      MsgCenterNotifyCat1PowerOnProc},
     {TOPIC_EVENT_CAT1_POWER_OFF,      MsgCenterNotifyCat1PowerOffProc},
 #endif
index 4026a9b..0bade75 100755 (executable)
@@ -13,6 +13,7 @@
 #include "UiConfig.h"
 #include "components/ui_image_view.h"
 #include "components/ui_label.h"
+#include "components/ui_button.h"
 #include "common/image_cache_manager.h"
 #include "VolumeSettingView.h"
 #include "VolumeSettingPresenter.h"
@@ -33,7 +34,7 @@ namespace OHOS {
 int changeImage = 0;
 osTimerId_t g_callDuration = NULL; // timer of call duration
 osTimerId_t g_callCurrentTime = NULL; // timer of current time
-
+osTimerId_t g_calldialTime = NULL;
 static constexpr uint16 MATH_ZERO = 0;
 
 // 来电显示
@@ -65,6 +66,7 @@ static constexpr uint16 FONT_CURRENT_SIZE = 25;
 static constexpr uint16 FONT_CALLER_SIZE = 40;
 UIViewGroup* phoneView = nullptr;
 UIViewGroup* callingView = nullptr;
+UIViewGroup* calldialView = nullptr;
 UIViewGroup* volumeSettingView = nullptr;
 VolumeSettingView *volumeSetting = nullptr;
 UIImageView* imageAgree = nullptr;
@@ -78,6 +80,13 @@ UILabel* callDuration = nullptr;
 UILabel* currentTimes = nullptr;
 UILabel* comingTimes = nullptr;
 
+UILabel *diallabel1 = nullptr;
+UILabel *diallabl2 = nullptr;
+UIButton *button1dial = nullptr;
+    
+     
+        
+
 void CallTimerCallBack(int data)
 {
     GraphicService::GetInstance()->PostGraphicEvent(std::bind(CallTimerCallBackProc, data));
@@ -85,11 +94,22 @@ void CallTimerCallBack(int data)
 
 void CallTimerCallBackProc(int data)
 {
+    g_callTimesadd();
     if (callDuration != nullptr) {
        callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration());
     }
 }
 
+uint16_t dail_falg=0;
+void CalldialTimerCallBackProc(int data)
+{
+    if(dail_falg<=70)
+    dail_falg++;
+    if(dail_falg>=70)
+    NotificationManager::GetInstance()->StopNotify();
+}
+
+
 void CallCurTimerCallBack(int data)
 {
     if (currentTimes != nullptr) {
@@ -130,6 +150,18 @@ void StartCallTimer(CallTimerType type, int32_t interval)
                 return;
             }
             break;
+         case NOTIFY_PHONE_DIAL_DISPLAY:
+            g_calldialTime = osTimerNew((osTimerFunc_t)CallCurTimerCallBack, osTimerPeriodic, NULL, NULL);
+            tick = osMs2Tick(interval);
+            retTimer = osTimerStart(g_calldialTime, tick);
+            if (retTimer != osOK && g_calldialTime != NULL) {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                    "StartCallTimer osTimerStart failed, type = %d ret = %lx!!", type, retTimer);
+                osTimerDelete(g_calldialTime);
+                g_calldialTime = NULL;
+                return;
+            }
+            break;
         default:
             break;
     }
@@ -145,6 +177,7 @@ void DisableCallTimer(CallTimerType type)
     switch (type) {
         case NOTIFY_PHONE_CALLING_DISPLAY:
             if (g_callDuration != NULL) {
+                g_callTimesclean();
                 ret = osTimerDelete(g_callDuration);
                 if (ret != osOK) {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisableCallTimer failed, type= %d ret = %lx!", type, ret);
@@ -163,6 +196,17 @@ void DisableCallTimer(CallTimerType type)
                 g_callCurrentTime = NULL;
             }
             break;
+        case NOTIFY_PHONE_DIAL_DISPLAY:
+            if (g_calldialTime != NULL) {
+                ret = osTimerDelete(g_calldialTime);
+                if (ret != osOK) {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisableCallTimer failed, type= %d ret = %lx!", type, ret);
+                    return;
+                }
+                g_calldialTime = NULL;
+            }
+            dail_falg=0;
+            break;
         default:
             break;
     }
@@ -193,7 +237,8 @@ void HonrsViewChange(void)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "makephone_notification::volumeSliderEventListener nullptr err");
         return;
     }
-
+    UIView::OnDragListener *dragListener = (UIView::OnDragListener *)OHOS::CallViewEventListener::GetInstance();
+    volumeSettingView->SetOnDragListener(dragListener);
     // volumeSliderEventListener->SetPlayerCoefficients(VOLUMEPHONENOTIFY); // 进度条系数
     volumeSettingView->SetVisible(true);
     // 刷新UI
@@ -431,6 +476,127 @@ void FreePhoneCallView(void)
     }
 }
 
+void FreeCalldialView(void)
+{
+    if (calldialView != nullptr) {
+        DisableCallTimer(NOTIFY_PHONE_CALLING_DISPLAY);
+        calldialView->RemoveAll();
+        if(diallabel1!=NULL)
+        {
+            delete diallabel1;
+            diallabel1 =nullptr;
+        }
+
+        if(diallabl2!=NULL)
+        {
+            delete diallabl2;
+            diallabl2 =nullptr;
+        }
+
+        if(button1dial!=NULL)
+        {
+            delete button1dial;
+            button1dial =nullptr;
+        }
+        DisableCallTimer(NOTIFY_PHONE_DIAL_DISPLAY);
+        RootView::GetInstance()->Remove(calldialView);
+        delete calldialView;
+        calldialView = nullptr;
+    }
+}
+
+
+UIViewGroup* CreateCalldialView(void)
+{
+    calldialView = new UIViewGroup();
+    if (calldialView == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!");
+        return nullptr;
+    }
+    calldialView->SetPosition(MATH_ZERO, MATH_ZERO);
+    calldialView->SetWidth(Screen::GetInstance().GetWidth());
+    calldialView->SetHeight(Screen::GetInstance().GetHeight());
+
+    diallabel1 = new UILabel();
+    if (diallabel1 == nullptr)
+    {
+        return NULL;
+    }
+        diallabel1->SetPosition(190, 52); // widget's left position and top position
+        diallabel1->Resize(85, 35);       // widget's width and height
+        diallabel1->SetViewId("label2");  // Set style
+        diallabel1->SetStyle(STYLE_TEXT_FONT, 30);
+
+        // Set additional property
+        diallabel1->SetText("拨号中...");
+        diallabel1->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+        diallabel1->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff));
+        diallabel1->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        diallabel1->SetRollSpeed(0);
+        diallabel1->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+        // Add to rootView
+        calldialView->Add(diallabel1);
+        diallabel1->SetVisible(true);
+
+        // Add Label to App
+        if (diallabl2 == nullptr)
+        {
+            diallabl2 = new UILabel();
+        }
+        diallabl2->SetPosition(109, 104); // widget's left position and top position
+        diallabl2->Resize(249, 40);       // widget's width and height
+        diallabl2->SetViewId("label1");   // Set style
+        diallabl2->SetStyle(STYLE_TEXT_FONT, 40);
+
+        // Set additional property
+        diallabl2->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+        diallabl2->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+        diallabl2->SetAlign(TEXT_ALIGNMENT_CENTER);
+        diallabl2->SetRollSpeed(0);
+        diallabl2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
+
+        // Add to rootView
+        calldialView->Add(diallabl2);
+        diallabl2->SetVisible(true);
+
+
+        // Add Button to App
+        if (button1dial == nullptr)
+        {
+            button1dial = new UIButton();
+        }
+        button1dial->SetPosition(188, 340); // widget's left position and top position
+        button1dial->Resize(90, 90);        // widget's width and height
+        button1dial->SetViewId("dialHandUp");  // Set style
+
+        // Set additional property
+#ifdef _WIN32
+        char *button1defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/phone-off-round.bin";
+#else
+        char *button1defaultImgSrc = "/user/res/Phone/phone-off-round.bin";
+#endif
+        char *button1triggeredImgSrc = nullptr;
+        button1dial->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+        button1dial->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+        // Add the CallBack about events
+        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(CallViewEventListener::GetInstance());
+        button1dial->SetOnClickListener(button1Click);
+        // Add to rootView
+        calldialView->Add(button1dial);
+        button1dial->SetVisible(true);
+
+   
+    UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::CallViewEventListener::GetInstance();
+    calldialView->SetOnClickListener(clickListener);
+   
+    StartCallTimer(NOTIFY_PHONE_DIAL_DISPLAY, (int32_t)NOTIFY_ONE_SECOND);
+
+    return calldialView;
+}
+
+
 UIViewGroup* CreateCallingView(void)
 {
     callingView = new UIViewGroup();
@@ -510,6 +676,18 @@ CallViewEventListener *CallViewEventListener::GetInstance(void)
     static CallViewEventListener callViewEventListener;
     return &callViewEventListener;
 }
+
+bool CallViewEventListener::OnDrag(UIView& view, const DragEvent& event)
+{
+    if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) 
+    {
+        volumeSettingView->SetVisible(false);
+        unsigned char volumeValue;
+        volumeValue = (unsigned char) ((double) (volumeSetting->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换
+        SetSpeakerVolume(volumeValue);
+    }
+           
+}
 //#define SUPPORT_CAT1_SERVICE
 bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event)
 {
@@ -527,7 +705,7 @@ bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event)
                 
                  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] start");
     
-                incomedcall_event_sendmsg_toUI("10086");
+                incomedcall_event_sendmsg_toUI("ok");
     
                 cat1_call_answer();
 
@@ -545,9 +723,9 @@ bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event)
         
         return true;
     } else if (strcmp(view.GetViewId(), "displayHandUp") == 0 ||
-        strcmp(view.GetViewId(), "callingHandUp") == 0) 
+        strcmp(view.GetViewId(), "callingHandUp") == 0 || strcmp(view.GetViewId(), "dialHandUp")==0 ) 
     {
-        if (strcmp(view.GetViewId(), "displayHandUp") == 0) 
+        if (strcmp(view.GetViewId(), "displayHandUp") == 0 || strcmp(view.GetViewId(), "dialHandUp")==0) 
         {
             // The watch rejects the call
             if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
@@ -602,7 +780,7 @@ bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event)
         }
         return true;
     } else if (strcmp(view.GetViewId(), "volumeSwitch") == 0) {
-        //HonrsViewChange();
+        HonrsViewChange();
     }
 // #endif
     return true;
index 3fb982e..ae651d8 100755 (executable)
@@ -25,6 +25,7 @@ void NotificationManager::FreeNotifyViews()
     FreeAlarmRingView();
     FreePhoneCallView();
     FreeCallingView();
+    FreeCalldialView();
 #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION
     //Do Free notification view
 #endif
index 96cbfd8..8d5bc9e 100644 (file)
@@ -319,6 +319,7 @@ int cat1_handle_call_connected(struct tcp_msg_t *msg)
     
     WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 call connected\n");
     //声音处理
+    incomedcall_event_sendmsg_toUI("ok");
     uapi_cat1_start_volte_voice();
     
     return 1;
index 0d5831a..7d9aa7a 100644 (file)
@@ -82,6 +82,11 @@ static void CustomEventPublish(uint16_t topic, uint8_t *data , uint32_t size)
     return;
 }
 
+static errcode_t calldial_event_notify(char* callno)
+{
+    CustomEventPublish(TOPIC_EVENT_CAT1_CALLDIAL,(uint8_t*)callno,strlen(callno));
+    return 0;
+}
 
 
 static errcode_t incomingcall_event_notify(char* callno)
@@ -102,7 +107,7 @@ static errcode_t callend_event_notify(char* callno)
     return 0;
 }
 
-errcode_t callend_event_sendmsg_toUI(char* callno)
+int callend_event_sendmsg_toUI(char* callno)
 {
     /**通过UI事件发送Notify*/
     GraphicService::GetInstance()->PostGraphicEvent(std::bind(callend_event_notify, callno));
@@ -110,7 +115,7 @@ errcode_t callend_event_sendmsg_toUI(char* callno)
 }
 
 
-errcode_t incomedcall_event_sendmsg_toUI(char* callno)
+int incomedcall_event_sendmsg_toUI(char* callno)
 {
     /**通过UI事件发送Notify*/
     GraphicService::GetInstance()->PostGraphicEvent(std::bind(incomed_call_event_notify, callno));
@@ -118,13 +123,19 @@ errcode_t incomedcall_event_sendmsg_toUI(char* callno)
 }
 
 
-errcode_t incomingcall_event_sendmsg_toUI(char* callno)
+int incomingcall_event_sendmsg_toUI(char* callno)
 {
     /**通过UI事件发送Notify*/
     GraphicService::GetInstance()->PostGraphicEvent(std::bind(incomingcall_event_notify, callno));
     return ERRCODE_SUCC;
 }
 
+int calldial_event_sendmsg_toUI(char* callno)
+{
+    /**通过UI事件发送Notify*/
+    GraphicService::GetInstance()->PostGraphicEvent(std::bind(incomingcall_event_notify, callno));
+    return ERRCODE_SUCC;
+}
 
 #ifdef __cplusplus
 
index 0e3716b..35d803d 100644 (file)
@@ -14,9 +14,10 @@ extern "C" {
 #endif /* __cplusplus */
 #endif /* __cplusplus */
 
-errcode_t incomedcall_event_sendmsg_toUI(char* callno);
-errcode_t callend_event_sendmsg_toUI(char* callno);
-errcode_t incomingcall_event_sendmsg_toUI(char* callno);
+int incomedcall_event_sendmsg_toUI(char* callno);
+int callend_event_sendmsg_toUI(char* callno);
+int incomingcall_event_sendmsg_toUI(char* callno);
+int calldial_event_sendmsg_toUI(char* callno);
 
 #ifdef __cplusplus
 #if __cplusplus