【makephone]意义不明 Slice
authorCaisking <Casiking@zhihuishixun.com>
Mon, 28 Apr 2025 09:59:15 +0000 (17:59 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Mon, 28 Apr 2025 09:59:15 +0000 (17:59 +0800)
12 files changed:
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/CallerDisplayView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/CallingView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/DialingScreenView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/WaitingHintsView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/CallerDisplayView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/CallingView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/DialingScreenView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/WaitingHintsView.cpp

index ef56172..bf15948 100644 (file)
@@ -1,38 +1,46 @@
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: CallerDisplayView.h\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-#ifndef CALLER_DISPLAY_VIEW_H\r
-#define CALLER_DISPLAY_VIEW_H\r
-\r
-#include "View.h"\r
-#include "components/ui_label.h"\r
-#include "components/ui_image_animator.h"\r
-#include "components/ui_view_group.h"\r
-#include "ohos_types.h"\r
-\r
-namespace OHOS {\r
-class CallerDisplayView {\r
-public:\r
-    CallerDisplayView();\r
-    ~CallerDisplayView();\r
-    UIViewGroup *CreateUIViewGroup();\r
-\r
-    static CallerDisplayView *GetInstance();\r
-private:\r
-    bool InitAddOnclickevent(void);\r
-    bool InitImageViewDisplay(void);\r
-    bool InitUILabelDisplay(void);\r
-\r
-    UIViewGroup *group{nullptr};\r
-    UIView::OnClickListener* clickLeftListener{nullptr};\r
-    UIImageView *imageAgreeing{nullptr};\r
-    UIImageView *imageDissgree{nullptr};\r
-    UILabel *callerDisplay{nullptr};\r
-    UILabel *currentTimes{nullptr};\r
-};\r
-}\r
-\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: CallerDisplayView.h
+ * Author:
+ * Create: 2021-10-12
+ */
+#ifndef CALLER_DISPLAY_VIEW_H
+#define CALLER_DISPLAY_VIEW_H
+
+#include "View.h"
+
+#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_view_group.h"
+#include "ohos_types.h"
+
+namespace OHOS {
+class CallerDisplayView {
+public:
+    CallerDisplayView();
+    ~CallerDisplayView();
+    UIViewGroup *CreateUIViewGroup();
+
+    static CallerDisplayView *GetInstance();
+    void updataCallingname();
+private:
+    bool InitAddOnclickevent(void);
+    bool InitImageViewDisplay(void);
+    bool InitUILabelDisplay(void);
+
+    UIViewGroup *group{nullptr};
+    UIView::OnClickListener* clickLeftListener{nullptr};
+    UIImageView *imageAgreeing{nullptr};
+    UIImageView *imageDissgree{nullptr};
+    UIImageView *imageperson{nullptr};
+    
+    UILabelExt *callerDisplay{nullptr};
+    UILabelExt *currentTimes{nullptr};
+
+    UILabelExt *label_call_source{nullptr};
+    UILabelExt *label_call_hint{nullptr};
+};
+}
+
 #endif
\ No newline at end of file
index 6ee0de1..e457e3b 100644 (file)
@@ -1,45 +1,69 @@
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: CallingView.h\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-#ifndef CALLING_VIEW_H\r
-#define CALLING_VIEW_H\r
-\r
-#include "View.h"\r
-#include "components/ui_label.h"\r
-#include "components/ui_image_animator.h"\r
-#include "components/ui_view_group.h"\r
-#include "ohos_types.h"\r
-#include "UiConfig.h"\r
-#include "ChangeSliceListener.h"\r
-\r
-\r
-namespace OHOS {\r
-class CallingView {\r
-public:\r
-    CallingView();\r
-    ~CallingView();\r
-    UIViewGroup *CreateUIViewGroup();\r
-    UIImageView *GetImageMicrophone();\r
-    static CallingView *GetInstance();\r
-    UILabel *GetCallingDisplayLabel();\r
-    UILabel *GetCallingDurationLabel();\r
-private:\r
-    bool InitAddOnclickevent(void);\r
-    bool InitImageViewDisplay(void);\r
-    bool InitUILabelDisplay(void);\r
-\r
-    UIImageView *imageMicrophone{nullptr};\r
-    UIViewGroup *group{nullptr};\r
-    UIView::OnClickListener* clickLeftListener{nullptr};\r
-    UIImageView *imageHandUp{nullptr};\r
-    UIImageView *imageHorns{nullptr};\r
-    UILabel *callerDisplay{nullptr};\r
-    UILabel *currentTimes{nullptr};\r
-    UILabel *callDuration{nullptr};\r
-};\r
-}\r
-\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: CallingView.h
+ * Author:
+ * Create: 2021-10-12
+ */
+#ifndef CALLING_VIEW_H
+#define CALLING_VIEW_H
+
+#include "View.h"
+
+#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_view_group.h"
+#include "ohos_types.h"
+#include "UiConfig.h"
+#include "ChangeSliceListener.h"
+#include "components/ui_label_button.h"
+#include "BluetoothEarListView.h"
+
+namespace OHOS {
+class CallingView {
+public:
+    CallingView();
+    ~CallingView();
+    UIViewGroup *CreateUIViewGroup();
+    UIViewGroup *CreateUIViewGroup(uint8_t);
+    UIImageView *GetImageMicrophone();
+    static CallingView *GetInstance();
+    UILabel *GetCallingDisplayLabel();
+    UILabel *GetCallingDurationLabel();
+    void showdial(bool);
+    void text_updata_buf(const char *buf);
+    void updataCallingname(void);
+    void update_headset_state(uint8_t state);
+
+    private:
+    bool InitAddOnclickevent(void);
+    bool InitImageViewDisplay(void);
+    bool InitUILabelDisplay(void);
+    bool Initshowdial(void);
+   
+    
+    UIViewGroup *group{nullptr};
+    UIView::OnClickListener* clickLeftListener{nullptr};
+    UIView:: OnDragListener* dragListener{nullptr};
+
+    UIImageView *imageMicrophone{nullptr};
+
+    UIImageView *imageHandUp{nullptr};
+    UIImageView *imageHorns{nullptr};
+
+    UIImageView *imagedial{nullptr};
+    UIImageView *imageheadset{nullptr};
+
+    UIImageView *imageperson{nullptr};
+    UILabel *callerDisplay{nullptr};
+    UILabelExt *currentTimes{nullptr};
+    UILabel *callDuration{nullptr};
+
+    UIViewGroup *dial_group{nullptr};
+    UILabelButton* labelButton[12]={nullptr};
+    UIImageView *image_line{nullptr};
+    UILabel * label_number{nullptr};
+};
+}
+
 #endif
\ No newline at end of file
index 2b827c7..3917e91 100644 (file)
@@ -1,36 +1,38 @@
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: DialingScreenView.h\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-#ifndef DIALING_SCREEN_VIEW_H\r
-#define DIALING_SCREEN_VIEW_H\r
-\r
-#include "View.h"\r
-#include "components/ui_label.h"\r
-#include "components/ui_image_animator.h"\r
-#include "components/ui_view_group.h"\r
-#include "ohos_types.h"\r
-\r
-namespace OHOS {\r
-class DialingScreenView {\r
-public:\r
-    DialingScreenView();\r
-    ~DialingScreenView();\r
-    UIViewGroup *CreateUIViewGroup();\r
-\r
-    static DialingScreenView *GetInstance();\r
-private:\r
-    bool InitUILabelDisplay();\r
-\r
-    UIViewGroup *group{nullptr};\r
-    UIView::OnClickListener* clickLeftListener{nullptr};\r
-    UILabel *dialingId{nullptr};\r
-    UILabel *dialingTime{nullptr};\r
-    UILabel *currentTimes{nullptr};\r
-    UIImageView *handup{nullptr};\r
-};\r
-}\r
-\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: DialingScreenView.h
+ * Author:
+ * Create: 2021-10-12
+ */
+#ifndef DIALING_SCREEN_VIEW_H
+#define DIALING_SCREEN_VIEW_H
+
+#include "View.h"
+
+#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_view_group.h"
+#include "ohos_types.h"
+
+namespace OHOS {
+class DialingScreenView {
+public:
+    DialingScreenView();
+    ~DialingScreenView();
+    UIViewGroup *CreateUIViewGroup();
+
+    static DialingScreenView *GetInstance();
+private:
+    bool InitUILabelDisplay();
+
+    UIViewGroup *group{nullptr};
+    UIView::OnClickListener* clickLeftListener{nullptr};
+    UILabel *dialingId{nullptr};
+    UILabel *dialingTime{nullptr};
+    UILabel *currentTimes{nullptr};
+    UIImageView *handup{nullptr};
+};
+}
+
 #endif
\ No newline at end of file
index a9b800f..ecae951 100644 (file)
@@ -1,36 +1,50 @@
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: MainCallingPresenter.h\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-#ifndef MAIN_CALLING_PRESENTER_H\r
-#define MAIN_CALLING_PRESENTER_H\r
-\r
-#include "Presenter.h"\r
-#include "ohos_types.h"\r
-#include "CallerLogModel.h"\r
-#include "VolumeSettingView.h"\r
-#include "VolumeSettingPresenter.h"\r
-\r
-namespace OHOS {\r
-class MainCallingView;\r
-class MainCallingPresenter : public Presenter<MainCallingView>, public UIView::OnClickListener {\r
-public:\r
-    MainCallingPresenter();\r
-    ~MainCallingPresenter() override;\r
-    static MainCallingPresenter *GetInstance();\r
-\r
-    void HonrsViewChange();\r
-    bool CallingViewDisplay();\r
-    bool InitPointerValue();\r
-    bool OnClick(UIView& view, const ClickEvent& event) override;\r
-    VolumeSettingView *GetvolumeSetting();\r
-private:\r
-    int changeImage{0};\r
-    bool HintsHandupClick();\r
-    VolumeSettingView *volumeSetting{nullptr};\r
-};\r
-}\r
-\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: MainCallingPresenter.h
+ * Author:
+ * Create: 2021-10-12
+ */
+#ifndef MAIN_CALLING_PRESENTER_H
+#define MAIN_CALLING_PRESENTER_H
+
+#include "Presenter.h"
+#include "ohos_types.h"
+#include "CallerLogModel.h"
+#include "VolumeSettingView.h"
+#include "VolumeSettingPresenter.h"
+#include "KeyInputListener.h"
+
+namespace OHOS {
+class MainCallingView;
+class MainCallingPresenter : public Presenter<MainCallingView>,
+                             public RootView::OnKeyActListener,
+                             public UIView::OnClickListener ,
+                             public UIView::OnDragListener{
+public:
+    MainCallingPresenter();
+    ~MainCallingPresenter() override;
+
+    void OnStart() override;
+    void OnPause() override;
+    void OnResume() override;
+    void OnStop() override;
+    static MainCallingPresenter *GetInstance();
+
+    void HonrsViewChange();
+    bool CallingViewDisplay();
+    bool InitPointerValue();
+    bool OnClick(UIView& view, const ClickEvent& event) override;
+    bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
+    
+    bool OnDragEnd(UIView &view, const DragEvent &event) override;
+    VolumeSettingView *GetvolumeSetting();
+private:
+    int changeImage{0};
+    bool HintsHandupClick();
+    KeyInputListener *keyActListenr{nullptr};
+    VolumeSettingView *volumeSetting{nullptr};
+    
+};
+}
+
 #endif
\ No newline at end of file
index e4bf8dd..d16f41c 100644 (file)
@@ -1,46 +1,52 @@
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: MainCallingView.h\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-#ifndef MAIN_CALLING_VIEW_H\r
-#define MAIN_CALLING_VIEW_H\r
-\r
-#include "View.h"\r
-#include "components/ui_view_group.h"\r
-#include "ohos_types.h"\r
-#include "CallerDisplayView.h"\r
-#include "CallingView.h"\r
-#include "DialingScreenView.h"\r
-#include "WaitingHintsView.h"\r
-\r
-namespace OHOS {\r
-class MainCallingPresenter;\r
-class MainCallingView : public View<MainCallingPresenter> {\r
-public:\r
-    MainCallingView();\r
-    ~MainCallingView() override;\r
-\r
-    void OnStart() override;\r
-\r
-    static MainCallingView *GetInstance();\r
-    UIViewGroup *GetDisplayGroup();\r
-    UIViewGroup *GetCallingGroup();\r
-    UIViewGroup *GetScreenGroup();\r
-    UIViewGroup *GetWaitingGroup();\r
-    CallingView *GetCallingView();\r
-private:\r
-    bool InitPointerValue();\r
-    UIViewGroup *displayGroup{nullptr};\r
-    UIViewGroup *callingGroup{nullptr};\r
-    UIViewGroup *screenGroup{nullptr};\r
-    UIViewGroup *waitingGroup{nullptr};\r
-    CallerDisplayView *displayView{nullptr};\r
-    CallingView *callView{nullptr};\r
-    DialingScreenView *screenView{nullptr};\r
-    WaitingHintsView *waitingView{nullptr};\r
-};\r
-}\r
-\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: MainCallingView.h
+ * Author:
+ * Create: 2021-10-12
+ */
+#ifndef MAIN_CALLING_VIEW_H
+#define MAIN_CALLING_VIEW_H
+
+#include "View.h"
+
+#include "components/ui_view_group.h"
+#include "ohos_types.h"
+#include "CallerDisplayView.h"
+#include "CallingView.h"
+#include "DialingScreenView.h"
+#include "WaitingHintsView.h"
+
+namespace OHOS {
+class MainCallingPresenter;
+class MainCallingView : public View<MainCallingPresenter> {
+public:
+    MainCallingView();
+    ~MainCallingView();
+
+
+    void OnStart() override;
+
+    static MainCallingView *GetInstance();
+    UIViewGroup *GetDisplayGroup();
+    UIViewGroup *GetCallingGroup();
+    UIViewGroup *GetScreenGroup();
+    UIViewGroup *GetWaitingGroup();
+    CallingView *GetCallingView();
+    CallingView *GetScreenView();
+
+    void updataCallingname(void);
+    void update_headset_state(uint8_t data);
+private:
+    bool InitPointerValue();
+    UIViewGroup *displayGroup{nullptr};
+    UIViewGroup *callingGroup{nullptr};
+    UIViewGroup *screenGroup{nullptr};
+    UIViewGroup *waitingGroup{nullptr};
+    CallerDisplayView *displayView{nullptr};
+    CallingView *callView{nullptr};
+    CallingView *screenView{nullptr};
+    WaitingHintsView *waitingView{nullptr};
+};
+}
+
 #endif
\ No newline at end of file
index 85e93c9..b6c5e33 100644 (file)
@@ -1,36 +1,50 @@
-/*\r
- * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved.\r
- * Description: WaitingHintsView.h\r
- * Author:\r
- * Create: 2022-03-14\r
- */\r
-#ifndef WAITING_HINTS_VIEW_H\r
-#define WAITING_HINTS_VIEW_H\r
-\r
-#include "View.h"\r
-#include "components/ui_label.h"\r
-#include "components/ui_image_animator.h"\r
-#include "components/ui_view_group.h"\r
-#include "ohos_types.h"\r
-\r
-namespace OHOS {\r
-class WaitingHintsView {\r
-public:\r
-    WaitingHintsView();\r
-    ~WaitingHintsView();\r
-    UIViewGroup *CreateUIViewGroup();\r
-\r
-    static WaitingHintsView *GetInstance();\r
-private:\r
-    bool InitImageViewDisplay(void);\r
-    bool InitUILabelDisplay(void);\r
-\r
-    UIViewGroup *group{nullptr};\r
-    UIView::OnClickListener* clickLeftListener{nullptr};\r
-    UIImageView *imageDissgree{nullptr};\r
-    UILabel *callerDisplay{nullptr};\r
-    UILabel *newcallHints{nullptr};\r
-};\r
-}\r
-\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved.
+ * Description: WaitingHintsView.h
+ * Author:
+ * Create: 2022-03-14
+ */
+#ifndef WAITING_HINTS_VIEW_H
+#define WAITING_HINTS_VIEW_H
+
+#include "View.h"
+
+#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_view_group.h"
+#include "ohos_types.h"
+#include "UiConfig.h"
+#include "ChangeSliceListener.h"
+#include "components/ui_label_button.h"
+
+namespace OHOS {
+class WaitingHintsView {
+public:
+    WaitingHintsView();
+    ~WaitingHintsView();
+    UIViewGroup *CreateUIViewGroup();
+
+    static WaitingHintsView *GetInstance();
+    void updataCallingname();
+private:
+    bool InitImageViewDisplay(void);
+    bool InitUILabelDisplay(void);
+    bool InitAddOnclickevent(void);
+
+    UIViewGroup *group{nullptr};
+    UIView::OnClickListener* clickLeftListener{nullptr};
+     
+    UIImageView *imageDissgree{nullptr};
+
+    UILabel *callerDisplay{nullptr};
+    UIImageView *imageAgreeing{nullptr};
+    UIImageView *imageperson{nullptr};
+    
+    UILabelExt *currentTimes{nullptr};
+    UILabelExt *label_call_source{nullptr};
+    UILabelExt *label_call_hint{nullptr};
+};
+}
+
 #endif
\ No newline at end of file
index 2426ea2..beb1d83 100644 (file)
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: CallerDisplayView.cpp\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-#include "CallerDisplayView.h"\r
-#include "MainCallingPresenter.h"\r
-#include "UiConfig.h"\r
-\r
-namespace OHOS {\r
-static constexpr uint16 MATH_ZERO = 0;\r
-\r
-// 来电显示\r
-static constexpr uint16 LABEL_PERCENT_POSITION_X = 0;\r
-static constexpr uint16 LABEL_PERCENT_POSITION_Y = 80;\r
-static constexpr uint16 VIEW_DISTANCE_TO_LEFT_SIDE = HORIZONTAL_RESOLUTION;\r
-static constexpr uint16 TITLE_LABEL_DEFAULT_HEIGHT = 80;\r
-\r
-// 当前时间\r
-static constexpr uint16 LABEL_CURREMTTIME_POSITION_X = 0;\r
-static constexpr uint16 LABEL_CURREMTTIME_POSITION_Y = 340;\r
-\r
-// 图片坐标\r
-static constexpr uint16 IMAGE_DISSGREE_POSITION_X = 80;\r
-static constexpr uint16 IMAGE_AGREEING_POSITION_X = 270;\r
-static constexpr uint16 IMAGE_ALL_POSITION_Y = 240;\r
-\r
-// 字体大小\r
-static constexpr uint16 FONT_CURRENT_SIZE = 25;\r
-static constexpr uint16 FONT_CALLER_SIZE = 40;\r
-static CallerDisplayView *g_pMainView = nullptr;\r
-CallerDisplayView::CallerDisplayView()\r
-{\r
-    g_pMainView = this;\r
-}\r
-\r
-CallerDisplayView::~CallerDisplayView()\r
-{\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::~CallerDisplayView");\r
-    group->RemoveAll();\r
-\r
-    delete imageAgreeing;\r
-    imageAgreeing = nullptr;\r
-\r
-    delete imageDissgree;\r
-    imageDissgree = nullptr;\r
-\r
-    delete callerDisplay;\r
-    callerDisplay = nullptr;\r
-\r
-    delete currentTimes;\r
-    currentTimes = nullptr;\r
-\r
-    delete group;\r
-    group = nullptr;\r
-\r
-    g_pMainView = nullptr;\r
-}\r
-\r
-CallerDisplayView *CallerDisplayView::GetInstance()\r
-{\r
-    return g_pMainView;\r
-}\r
-\r
-bool CallerDisplayView::InitAddOnclickevent()\r
-{\r
-    clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();\r
-    if (clickLeftListener == nullptr) {\r
-        return false;\r
-    }\r
-    imageAgreeing->SetOnClickListener(clickLeftListener);\r
-    imageDissgree->SetOnClickListener(clickLeftListener);\r
-    return true;\r
-}\r
-\r
-bool CallerDisplayView::InitImageViewDisplay()\r
-{\r
-    imageAgreeing = new UIImageView();\r
-    if (imageAgreeing == nullptr) {\r
-        return false;\r
-    }\r
-    imageAgreeing->SetPosition(IMAGE_AGREEING_POSITION_X, IMAGE_ALL_POSITION_Y); // 30 :  offset\r
-    imageAgreeing->SetSrc(PNG_AGREEING_IMAGE_PATH);\r
-    imageAgreeing->SetTouchable(true);\r
-    imageAgreeing->SetViewId("answer");\r
-    group->Add(imageAgreeing);\r
-\r
-    imageDissgree = new UIImageView();\r
-    if (imageDissgree == nullptr) {\r
-        return false;\r
-    }\r
-    imageDissgree->SetPosition(IMAGE_DISSGREE_POSITION_X, IMAGE_ALL_POSITION_Y); // 30 :  offset\r
-    imageDissgree->SetSrc(PNG_DISSGREE_IMAGE_PATH);\r
-    imageDissgree->SetTouchable(true);\r
-    imageDissgree->SetViewId("displayHandUp");\r
-    group->Add(imageDissgree);\r
-\r
-    return true;\r
-}\r
-\r
-bool CallerDisplayView::InitUILabelDisplay()\r
-{\r
-    callerDisplay = new UILabel();\r
-    if (callerDisplay == nullptr) {\r
-        return false;\r
-    }\r
-    callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y, VIEW_DISTANCE_TO_LEFT_SIDE,\r
-        TITLE_LABEL_DEFAULT_HEIGHT);\r
-    callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());\r
-    callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE);\r
-    callerDisplay->SetTextColor(Color::White());\r
-    group->Add(callerDisplay);\r
-\r
-    currentTimes = new UILabel();\r
-    if (currentTimes == nullptr) {\r
-        return false;\r
-    }\r
-    currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y,\r
-        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);\r
-    currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str());\r
-    currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE);\r
-    currentTimes->SetTextColor(Color::White());\r
-    group->Add(currentTimes);\r
-    return true;\r
-}\r
-\r
-UIViewGroup *CallerDisplayView::CreateUIViewGroup()\r
-{\r
-    group = new UIViewGroup();\r
-    if (group == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::UIViewGroup::new group error");\r
-        return nullptr;\r
-    }\r
-    group->SetPosition(MATH_ZERO, MATH_ZERO);\r
-    group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value\r
-\r
-    if (!InitImageViewDisplay()) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::InitImageViewDisplay error");\r
-        return nullptr;\r
-    }\r
-\r
-    if (!InitAddOnclickevent()) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::InitAddOnclickevent error");\r
-        return nullptr;\r
-    }\r
-\r
-    if (!InitUILabelDisplay()) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::InitUILabelDisplay error");\r
-        return nullptr;\r
-    }\r
-\r
-    return group;\r
-}\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: CallerDisplayView.cpp
+ * Author:
+ * Create: 2021-10-12
+ */
+#include "CallerDisplayView.h"
+#include "MainCallingPresenter.h"
+#include "UiConfig.h"
+
+#include "phone/include/phoneaddressmodel.h"
+
+#include "ui_resource_string.h"
+
+namespace OHOS {
+static constexpr uint16 MATH_ZERO = 0;
+
+// 来电显示
+static constexpr uint16 LABEL_PERCENT_POSITION_X = 93;
+static constexpr uint16 LABEL_PERCENT_POSITION_Y = 80;
+static constexpr uint16 VIEW_DISTANCE_TO_LEFT_SIDE = 280;
+static constexpr uint16 TITLE_LABEL_DEFAULT_HEIGHT = 80;
+
+// 当前时间
+static constexpr uint16 LABEL_CURREMTTIME_POSITION_X = 0;
+static constexpr uint16 LABEL_CURREMTTIME_POSITION_Y = 340;
+
+// 图片坐标
+static constexpr uint16 IMAGE_DISSGREE_POSITION_X = 80;
+static constexpr uint16 IMAGE_AGREEING_POSITION_X = 270;
+static constexpr uint16 IMAGE_ALL_POSITION_Y = 240;
+
+// 字体大小
+static constexpr uint16 FONT_CURRENT_SIZE = 25;
+static constexpr uint16 FONT_CALLER_SIZE = 40;
+static CallerDisplayView *g_pMainView = nullptr;
+
+#define PHONE_DIR_GIRL_1 "/user/res/Phone/girl.bin"
+#define PHONE_DIR_BOY_1 "/user/res/Phone/boy.bin"
+
+CallerDisplayView::CallerDisplayView()
+{
+    g_pMainView = this;
+}
+
+CallerDisplayView::~CallerDisplayView()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::~CallerDisplayView");
+    group->RemoveAll();
+
+    delete imageAgreeing;
+    imageAgreeing = nullptr;
+
+    delete imageDissgree;
+    imageDissgree = nullptr;
+
+    
+    delete imageperson;
+    imageperson = nullptr;
+
+    delete callerDisplay;
+    callerDisplay = nullptr;
+
+    delete label_call_source;
+    label_call_source = nullptr;
+
+    delete currentTimes;
+    currentTimes = nullptr;
+
+    delete label_call_hint;
+    label_call_hint = nullptr;
+
+    delete group;
+    group = nullptr;
+
+    g_pMainView = nullptr;
+}
+
+CallerDisplayView *CallerDisplayView::GetInstance()
+{
+    return g_pMainView;
+}
+
+bool CallerDisplayView::InitAddOnclickevent()
+{
+    clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();
+    if (clickLeftListener == nullptr) {
+        return false;
+    }
+    imageAgreeing->SetOnClickListener(clickLeftListener);
+    imageDissgree->SetOnClickListener(clickLeftListener);
+    return true;
+}
+
+bool CallerDisplayView::InitImageViewDisplay()
+{
+    imageAgreeing = new UIImageView();
+    if (imageAgreeing == nullptr) {
+        return false;
+    }
+    imageAgreeing->SetPosition(369-24, 207-24); // 30 :  offset
+    imageAgreeing->Resize(100, 100);
+    imageAgreeing->SetAutoEnable (false);
+    imageAgreeing->SetResizeMode(UIImageView::CENTER);
+    imageAgreeing->SetSrc(PNG_ANSWER_230_TMAGE_PATH);
+    imageAgreeing->SetTouchable(true);
+    imageAgreeing->SetViewId("answer");
+    group->Add(imageAgreeing);
+
+    imageDissgree = new UIImageView();
+    if (imageDissgree == nullptr) {
+        return false;
+    }
+    imageDissgree->SetPosition(46-24, 207-24); // 30 :  offset
+    imageDissgree->Resize(100, 100);
+    imageDissgree->SetAutoEnable (false);
+    imageDissgree->SetResizeMode(UIImageView::CENTER);
+    imageDissgree->SetSrc(PNG_HANDUP_230_IMAGE_PATH);
+    imageDissgree->SetTouchable(true);
+    imageDissgree->SetViewId("displayHandUp");
+    group->Add(imageDissgree);
+
+    imageperson = new UIImageView();
+    if (imageperson == nullptr) {
+        return false;
+    }
+    imageperson->SetPosition(158, 158); // 30 :  offset
+    imageperson->SetSrc(PNG_230_PERSON_IMAGE_PATH);
+    imageperson->SetTouchable(true);
+    imageperson->SetViewId("headset");
+
+    char name_buf[NAME_LEN+1]={0};
+    uint8_t sex;
+    if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),&sex))
+    {
+        if(sex==1)
+        imageperson->SetSrc(PHONE_DIR_BOY_1);
+        else
+        imageperson->SetSrc(PHONE_DIR_GIRL_1);
+    }
+
+    group->Add(imageperson);
+
+
+
+    return true;
+}
+
+void CallerDisplayView::updataCallingname(void)
+{
+    //if(CallerLogModel::GetInstance()->Getphonename().length()>5)
+    if(strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),CallerLogModel::GetInstance()->Getphonenumberpbap().c_str())==0)
+    {
+        if(CallerLogModel::GetInstance()->Getphonename().length()!=0)
+        callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str());
+    } 
+}
+
+
+
+bool CallerDisplayView::InitUILabelDisplay()
+{
+    callerDisplay = new UILabelExt();
+    if (callerDisplay == nullptr) {
+        return false;
+    }
+    callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y, VIEW_DISTANCE_TO_LEFT_SIDE,
+        TITLE_LABEL_DEFAULT_HEIGHT);
+    callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+
+    char name_buf[NAME_LEN+1]={0};
+    if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL))
+    {
+        callerDisplay->SetText(name_buf);
+    }
+    else
+    {
+       callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+    }
+    // if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourcePhone)
+    updataCallingname();
+
+    callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER);
+    callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE);
+    callerDisplay->SetTextColor(Color::White());
+    callerDisplay->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+    group->Add(callerDisplay);
+
+    if (label_call_hint == nullptr) {
+        label_call_hint = new UILabelExt();
+    }
+
+    label_call_hint->SetPosition(133, 353);         // widget's left position and top position
+    label_call_hint->Resize(200, 35);          // widget's width and height
+    label_call_hint->SetViewId("label3");// Set style
+    label_call_hint->SetStyle(STYLE_TEXT_FONT, 30);
+
+    // Set additional property
+    // label_call_hint->SetText("挂断/接听");
+    label_call_hint->SetTextId(STR_HANG_UP_OR_ANSWER);
+    
+    label_call_hint->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+    label_call_hint->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff));
+    label_call_hint->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    label_call_hint->SetRollSpeed(0);
+    label_call_hint->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+    //group->Add(label_call_hint);
+
+
+    if (label_call_source == nullptr) {
+        label_call_source = new UILabelExt();
+    }
+    label_call_source->SetPosition(133, 34);         // widget's left position and top position
+    label_call_source->Resize(200, 60);          // widget's width and height
+    label_call_source->SetViewId("label1");// Set style
+    label_call_source->SetStyle(STYLE_TEXT_FONT, 30);
+
+    // Set additional property
+    if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) 
+    {   
+        label_call_source->SetText("手表来电");
+        label_call_source->SetTextId(STR_WATCH_CALL);
+    }
+    else
+    {
+        label_call_source->SetText("手机来电");
+        label_call_source->SetTextId(STR_PHONE_CALL);
+    }
+   
+    
+    label_call_source->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+    label_call_source->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff));
+    label_call_source->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    label_call_source->SetRollSpeed(0);
+    label_call_source->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+    group->Add(label_call_source);
+
+
+
+    // currentTimes = new UILabel();
+    // if (currentTimes == nullptr) {
+    //     return false;
+    // }
+    // currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y,
+    //     VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);
+    // currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+    // currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER);
+    // currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str());
+    // currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE);
+    // currentTimes->SetTextColor(Color::White());
+    // group->Add(currentTimes);
+
+
+    return true;
+}
+
+UIViewGroup *CallerDisplayView::CreateUIViewGroup()
+{
+    group = new UIViewGroup();
+    if (group == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::UIViewGroup::new group error");
+        return nullptr;
+    }
+    group->SetPosition(MATH_ZERO, MATH_ZERO);
+    group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value
+
+    if (!InitImageViewDisplay()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::InitImageViewDisplay error");
+        return nullptr;
+    }
+
+    if (!InitAddOnclickevent()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::InitAddOnclickevent error");
+        return nullptr;
+    }
+
+    if (!InitUILabelDisplay()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::InitUILabelDisplay error");
+        return nullptr;
+    }
+
+    return group;
+}
 }
\ No newline at end of file
index 2c19d75..1414afe 100644 (file)
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: CallingView.cpp\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-#include "CallingView.h"\r
-#include "MainCallingPresenter.h"\r
-#include "wearable_log.h"\r
-#include "UiConfig.h"\r
-\r
-\r
-namespace OHOS {\r
-static constexpr uint16 MATH_ZERO = 0;\r
-\r
-// 来电显示\r
-static constexpr uint16 LABEL_PERCENT_POSITION_X = 0;\r
-static constexpr uint16 LABEL_PERCENT_POSITION_Y = 100;\r
-\r
-static constexpr uint16 VIEW_DISTANCE_TO_LEFT_SIDE = HORIZONTAL_RESOLUTION;\r
-static constexpr uint16 TITLE_LABEL_DEFAULT_HEIGHT = 80;\r
-\r
-// 当前时间\r
-static constexpr uint16 LABEL_CURREMTTIME_POSITION_X = 0;\r
-static constexpr uint16 LABEL_CURREMTTIME_POSITION_Y = 360;\r
-\r
-// 图片坐标\r
-static constexpr uint16 LABEL_CALLERD_POSITION_X = 0;\r
-static constexpr uint16 LABEL_CALLERD_POSITION_Y = 160;\r
-static constexpr uint16 IMAGE_HONRS_POSITION_X = 185;\r
-static constexpr uint16 IMAGE_HONRS_POSITION_Y = 10;\r
-static constexpr uint16 IMAGE_DISSGREE_POSITION_X = 70;\r
-static constexpr uint16 IMAGE_AGREEING_POSITION_X = 280;\r
-static constexpr uint16 IMAGE_ALL_POSITION_Y = 240;\r
-\r
-// 字体大小\r
-static constexpr uint16 LABEL_TIME_FONT_SIZE = 25;\r
-static constexpr uint16 LABEL_DISPLAY_FONE_SIZE = 40;\r
-static CallingView *g_pMainView = nullptr;\r
-\r
-CallingView::CallingView()\r
-{\r
-    g_pMainView = this;\r
-}\r
-\r
-CallingView::~CallingView()\r
-{\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallingView::~CallingView");\r
-    group->RemoveAll();\r
-    delete imageMicrophone;\r
-    imageMicrophone = nullptr;\r
-\r
-    delete imageHandUp;\r
-    imageHandUp = nullptr;\r
-\r
-    delete imageHorns;\r
-    imageHorns = nullptr;\r
-\r
-    delete callerDisplay;\r
-    callerDisplay = nullptr;\r
-\r
-    delete currentTimes;\r
-    currentTimes = nullptr;\r
-\r
-    delete callDuration;\r
-    callDuration = nullptr;\r
-\r
-    delete group;\r
-    group = nullptr;\r
-\r
-    g_pMainView = nullptr;\r
-}\r
-\r
-CallingView *CallingView::GetInstance()\r
-{\r
-    return g_pMainView;\r
-}\r
-\r
-bool CallingView::InitAddOnclickevent()\r
-{\r
-    clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();\r
-    if (clickLeftListener == nullptr) {\r
-        return false;\r
-    }\r
-\r
-    imageMicrophone->SetOnClickListener(clickLeftListener);\r
-    imageHandUp->SetOnClickListener(clickLeftListener);\r
-    imageHorns->SetOnClickListener(clickLeftListener);\r
-\r
-    return true;\r
-}\r
-\r
-\r
-UILabel *CallingView::GetCallingDurationLabel()\r
-{\r
-    return callDuration;\r
-}\r
-\r
-bool CallingView::InitImageViewDisplay()\r
-{\r
-    imageMicrophone = new UIImageView();\r
-    if (imageMicrophone == nullptr) {\r
-        return false;\r
-    }\r
-    imageMicrophone->SetPosition(IMAGE_AGREEING_POSITION_X, IMAGE_ALL_POSITION_Y); // 30 :  offset\r
-    imageMicrophone->SetSrc(PNG_MICROPHONE_OPEN_IMAGE_PATH);\r
-    imageMicrophone->SetTouchable(true);\r
-    imageMicrophone->SetViewId("microphoneChange");\r
-    group->Add(imageMicrophone);\r
-\r
-    imageHandUp = new UIImageView();\r
-    if (imageHandUp == nullptr) {\r
-        return false;\r
-    }\r
-    imageHandUp->SetPosition(IMAGE_DISSGREE_POSITION_X, IMAGE_ALL_POSITION_Y); // 30 :  offset\r
-    imageHandUp->SetSrc(PNG_DISSGREE_IMAGE_PATH);\r
-    imageHandUp->SetTouchable(true);\r
-    imageHandUp->SetViewId("callingHandUp");\r
-    group->Add(imageHandUp);\r
-\r
-    imageHorns = new UIImageView();\r
-    if (imageHorns == nullptr) {\r
-        return false;\r
-    }\r
-    imageHorns->SetPosition(IMAGE_HONRS_POSITION_X, IMAGE_HONRS_POSITION_Y); // 30 :  offset\r
-    imageHorns->SetSrc(PNG_SOUNDBUTTON2);\r
-    imageHorns->SetTouchable(true);\r
-    imageHorns->SetViewId("volumeSwitch");\r
-\r
-    group->Add(imageHorns);\r
-    return true;\r
-}\r
-\r
-UIImageView *CallingView::GetImageMicrophone()\r
-{\r
-    return imageMicrophone;\r
-}\r
-\r
-UILabel *CallingView::GetCallingDisplayLabel()\r
-{\r
-    return callerDisplay;\r
-}\r
-\r
-bool CallingView::InitUILabelDisplay()\r
-{\r
-    callerDisplay = new UILabel();\r
-    if (callerDisplay == nullptr) {\r
-        return false;\r
-    }\r
-    callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y,\r
-        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);\r
-    callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());\r
-    callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_DISPLAY_FONE_SIZE);\r
-    callerDisplay->SetTextColor(Color::White());\r
-    group->Add(callerDisplay);\r
-\r
-    callDuration = new UILabel();\r
-    if (callDuration == nullptr) {\r
-        return false;\r
-    }\r
-    callDuration->SetPosition(LABEL_CALLERD_POSITION_X, LABEL_CALLERD_POSITION_Y,\r
-        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);\r
-    callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    callDuration->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str());\r
-    callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_TIME_FONT_SIZE);\r
-    callDuration->SetTextColor(Color::White());\r
-    group->Add(callDuration);\r
-\r
-    currentTimes = new UILabel();\r
-    if (currentTimes == nullptr) {\r
-        return false;\r
-    }\r
-    currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y,\r
-        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);\r
-    currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str());\r
-    currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_TIME_FONT_SIZE);\r
-    currentTimes->SetTextColor(Color::White());\r
-\r
-    group->Add(currentTimes);\r
-    return true;\r
-}\r
-\r
-UIViewGroup *CallingView::CreateUIViewGroup()\r
-{\r
-    group = new UIViewGroup();\r
-    if (group == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::UIViewGroup::new group error");\r
-        return nullptr;\r
-    }\r
-    group->SetPosition(MATH_ZERO, MATH_ZERO);\r
-    group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value\r
-\r
-    if (!InitImageViewDisplay()) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitImageViewDisplay error");\r
-        return nullptr;\r
-    }\r
-\r
-    if (!InitAddOnclickevent()) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitAddOnclickevent error");\r
-        return nullptr;\r
-    }\r
-\r
-    if (!InitUILabelDisplay()) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitUILabelDisplay error");\r
-        return nullptr;\r
-    }\r
-\r
-    return group;\r
-}\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: CallingView.cpp
+ * Author:
+ * Create: 2021-10-12
+ */
+#include "CallingView.h"
+#include "MainCallingPresenter.h"
+#include "wearable_log.h"
+#include "UiConfig.h"
+#include "PhoneService.h"
+#include "cat1_server.h"
+#include "cat1_server_hal.h"
+#include "custom_utils.h"
+
+#include "phone/include/phoneaddressmodel.h"
+
+
+#ifdef SUPPORT_BLE_SERVICE
+#include <bleEvent.h>
+#include "bleService.h"
+#include "bletest.h"
+#endif
+
+#include "ui_resource_string.h"
+
+#ifdef SUPPORT_PHONE_SERVICE
+#include "PhoneAGService.h"
+#endif
+
+namespace OHOS {
+static constexpr uint16 MATH_ZERO = 0;
+
+// 来电显示
+static constexpr uint16 LABEL_PERCENT_POSITION_X = 0;
+static constexpr uint16 LABEL_PERCENT_POSITION_Y = 100;
+
+static constexpr uint16 VIEW_DISTANCE_TO_LEFT_SIDE = HORIZONTAL_RESOLUTION;
+static constexpr uint16 TITLE_LABEL_DEFAULT_HEIGHT = 80;
+
+// 当前时间
+static constexpr uint16 LABEL_CURREMTTIME_POSITION_X = 0;
+static constexpr uint16 LABEL_CURREMTTIME_POSITION_Y = 360;
+
+// 图片坐标
+static constexpr uint16 LABEL_CALLERD_POSITION_X = 0;
+static constexpr uint16 LABEL_CALLERD_POSITION_Y = 160;
+static constexpr uint16 IMAGE_HONRS_POSITION_X = 185;
+static constexpr uint16 IMAGE_HONRS_POSITION_Y = 10;
+static constexpr uint16 IMAGE_DISSGREE_POSITION_X = 70;
+static constexpr uint16 IMAGE_AGREEING_POSITION_X = 280;
+static constexpr uint16 IMAGE_ALL_POSITION_Y = 240;
+
+// 字体大小
+static constexpr uint16 LABEL_TIME_FONT_SIZE = 25;
+static constexpr uint16 LABEL_DISPLAY_FONE_SIZE = 40;
+static CallingView *g_pMainView = nullptr;
+
+#define PHONE_DIR_GIRL_1 "/user/res/Phone/girl.bin"
+#define PHONE_DIR_BOY_1 "/user/res/Phone/boy.bin"
+
+CallingView::CallingView()
+{
+    g_pMainView = this;
+}
+
+
+CallingView::~CallingView()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallingView::~CallingView");
+    group->RemoveAll();
+    delete imageMicrophone;
+    imageMicrophone = nullptr;
+
+    delete imageHandUp;
+    imageHandUp = nullptr;
+
+    delete imageHorns;
+    imageHorns = nullptr;
+
+    delete callerDisplay;
+    callerDisplay = nullptr;
+
+    delete currentTimes;
+    currentTimes = nullptr;
+
+    delete callDuration;
+    callDuration = nullptr;
+
+    delete group;
+    group = nullptr;
+
+    delete imagedial;
+    imagedial = nullptr;
+
+    
+    delete imageheadset;
+    imageheadset = nullptr;
+
+    delete imageperson;
+    imageperson = nullptr;
+    
+
+    if(dial_group)
+    {
+       dial_group->RemoveAll();
+        for( int i=0;i<12;i++)
+        {
+            delete labelButton[i];
+            labelButton[i]=nullptr;
+        }
+        delete image_line;
+        image_line= nullptr;
+
+        
+        delete label_number;
+        label_number= nullptr;
+        
+        delete dial_group;
+        dial_group = nullptr;
+    }
+    
+    
+    g_pMainView = nullptr;
+}
+
+CallingView *CallingView::GetInstance()
+{
+    return g_pMainView;
+}
+
+bool CallingView::InitAddOnclickevent()
+{
+    clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();
+    if (clickLeftListener == nullptr) {
+        return false;
+    }
+
+    imageMicrophone->SetOnClickListener(clickLeftListener);
+    imageHandUp->SetOnClickListener(clickLeftListener);
+    imageHorns->SetOnClickListener(clickLeftListener);
+    imagedial->SetOnClickListener(clickLeftListener);
+    imageheadset->SetOnClickListener(clickLeftListener);
+
+    for( int i=0;i<12;i++)
+    {
+        labelButton[i]->SetOnClickListener(clickLeftListener);
+    }
+    return true;
+}
+
+
+UILabel *CallingView::GetCallingDurationLabel()
+{
+    return currentTimes;
+}
+
+void CallingView::updataCallingname(void)
+{
+    if(strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),CallerLogModel::GetInstance()->Getphonenumberpbap().c_str())==0)
+    {
+        if(CallerLogModel::GetInstance()->Getphonename().length()!=0)
+        callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str());
+    } 
+}
+
+bool CallingView::InitImageViewDisplay()
+{
+    imageMicrophone = new UIImageView();
+    if (imageMicrophone == nullptr) {
+        return false;
+    }
+    imageMicrophone->SetPosition(46, 207); // 30 :  offset
+    imageMicrophone->SetSrc(PNG_230_MICROPHONE_OPEN_IMAGE_PATH);
+    imageMicrophone->SetTouchable(true);
+    imageMicrophone->SetViewId("microphoneChange");
+
+   
+
+    group->Add(imageMicrophone);
+
+    imageHandUp = new UIImageView();
+    if (imageHandUp == nullptr) {
+        return false;
+    }
+    imageHandUp->SetPosition(188, 340); // 30 :  offset
+    imageHandUp->SetSrc(PNG_230_VECTOR_IMAGE_PATH);
+    imageHandUp->SetTouchable(true);
+    imageHandUp->SetViewId("callingHandUp");
+    group->Add(imageHandUp);
+
+    imageHorns = new UIImageView();
+    if (imageHorns == nullptr) {
+        return false;
+    }
+    imageHorns->SetPosition(369, 207); // 30 :  offset
+    imageHorns->SetSrc(PNG_230_VOICE_OPEN_IMAGE_PATH);
+    imageHorns->SetTouchable(true);
+    imageHorns->SetViewId("volumeSwitch");
+     group->Add(imageHorns);
+    
+    imagedial = new UIImageView();
+    if (imagedial == nullptr) {
+        return false;
+    }
+    imagedial->SetPosition(80, 296); // 30 :  offset
+    imagedial->SetSrc(PNG_230_DIAL_IMAGE_PATH);
+    imagedial->SetTouchable(true);
+    imagedial->SetViewId("dial");
+    group->Add(imagedial);
+
+    
+    imageheadset = new UIImageView();
+    if (imagedial == nullptr) {
+        return false;
+    }
+    imageheadset->SetPosition(296, 296); // 30 :  offset
+
+    #ifdef SUPPORT_CAT1_HFP_AG_SERV
+        if(headset_SCO_Is_connect())
+        {
+            imageheadset->SetSrc(PNG_230_HEADSET_2_IIMAGE_PATH);
+            imageheadset->SetViewId("callingheadset");
+        }
+        else if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+        {
+            imageheadset->SetSrc(PNG_230_HEADSET_3_IIMAGE_PATH);
+            imageheadset->SetViewId("callingheadset");
+        }
+        else
+    #endif
+
+    {
+        imageheadset->SetSrc(PNG_230_HEADSET_1_IIMAGE_PATH);
+        imageheadset->SetViewId("headset");
+    }
+    
+    
+    imageheadset->SetTouchable(true);
+   
+    group->Add(imageheadset);
+
+    imageperson = new UIImageView();
+    if (imagedial == nullptr) {
+        return false;
+    }
+    imageperson->SetPosition(158, 158); // 30 :  offset
+    imageperson->SetSrc(PNG_230_PERSON_IMAGE_PATH);
+    imageperson->SetTouchable(true);
+    imageperson->SetViewId("imageperson");
+    group->Add(imageperson);
+
+    char name_buf[NAME_LEN+1]={0};
+    uint8_t sex;
+    if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),&sex))
+    {
+        if(sex==1)
+        imageperson->SetSrc(PHONE_DIR_BOY_1);
+        else
+        imageperson->SetSrc(PHONE_DIR_GIRL_1);
+    }
+    
+    return true;
+}
+
+void CallingView::update_headset_state(uint8_t state)
+{
+    if(imageheadset)
+    {
+        if(state)
+        {
+            imageheadset->SetSrc(PNG_230_HEADSET_2_IIMAGE_PATH);
+        }
+        else
+        {
+            imageheadset->SetSrc(PNG_230_HEADSET_3_IIMAGE_PATH);
+        }
+    }
+    
+}
+
+
+
+
+UIImageView *CallingView::GetImageMicrophone()
+{
+    return imageMicrophone;
+}
+
+UILabel *CallingView::GetCallingDisplayLabel()
+{
+    return callerDisplay;
+}
+
+bool CallingView::InitUILabelDisplay()
+{
+    callerDisplay = new UILabel();
+    if (callerDisplay == nullptr) {
+        return false;
+    }
+    callerDisplay->SetPosition(88, 81,
+        289, 40);
+    callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+
+    char name_buf[NAME_LEN+1]={0};
+    if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL))
+    {
+        callerDisplay->SetText(name_buf);
+    }
+    else
+    {
+       callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+    }
+    
+    // if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourcePhone)
+    updataCallingname();
+
+    callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER);
+    callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_DISPLAY_FONE_SIZE);
+    callerDisplay->SetTextColor(Color::White());
+    callerDisplay->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+    group->Add(callerDisplay);
+
+    // callDuration = new UILabel();
+    // if (callDuration == nullptr) {
+    //     return false;
+    // }
+    // callDuration->SetPosition(194, 38,
+    //     79, 35);
+    // callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+    // callDuration->SetAlign(TEXT_ALIGNMENT_CENTER);
+    // callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str());
+    // callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+    // callDuration->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff));
+    // group->Add(callDuration);
+
+
+    currentTimes = new UILabelExt();
+    if (currentTimes == nullptr) {
+        return false;
+    }
+    currentTimes->SetPosition(133, 38,
+         200, 35);
+    currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+    currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER);
+    currentTimes->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+    currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str());
+   
+  
+    
+    
+    currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+    currentTimes->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff));
+
+    group->Add(currentTimes);
+    return true;
+}
+
+static char *dial_id_str[]={"1","2","3","4","5","6","7","8","9","*","0","#"};
+void CallingView::showdial(bool flag)
+{
+    if(flag)
+    {
+        label_number->SetText("");
+        dial_group->SetVisible(true);  
+    }
+    else
+    {
+        dial_group->SetVisible(false); 
+    }
+   return;
+}
+
+void CallingView::text_updata_buf(const char *buf)
+{
+    #ifdef FD230_650
+    if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1){
+    SendDtfmStrNumberToCat1(buf[0]);
+    }
+    else{
+    uapi_hfp_send_DTMF_CODE(buf[0]);
+    }
+    #endif
+    
+    char new_buf[16]={0};
+    const char*text_buf=label_number->GetText();
+    sprintf_s(new_buf,16,"%s%s",text_buf,buf);
+    label_number->SetText(new_buf);
+   RootView::GetInstance()->Invalidate();
+
+    return;
+}
+
+
+bool CallingView::Initshowdial()
+{
+    dial_group = new UIViewGroup();
+    if (dial_group == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::UIViewGroup::new group error");
+        return false;
+    }
+    dial_group->SetPosition(MATH_ZERO, MATH_ZERO);
+    dial_group->Resize(466, 466); // 454 : value
+    dial_group->SetViewId("dialing");
+    dial_group->SetTouchable(true);
+    dial_group->SetDraggable(true);
+    
+    dragListener = (UIView::OnDragListener*)OHOS::MainCallingPresenter::GetInstance();
+    if (dragListener == nullptr) {
+
+        return false;
+    }
+    dial_group->SetOnDragListener(dragListener);
+    
+    uint8_t showdial_i=0;
+    for(int i=0;i<4;i++)
+    {
+        for(int j=0;j<3;j++)
+        {
+            if (labelButton[showdial_i] == nullptr) {
+                labelButton[showdial_i] = new UILabelButton();
+            }
+            if(labelButton[showdial_i]==nullptr)
+            {
+                    return false;
+            }
+            labelButton[showdial_i]->SetPosition(69+(j*111), 107+(i*78));         // widget's left position and top position
+
+            labelButton[showdial_i]->Resize(107, 70);          // widget's width and height
+            labelButton[showdial_i]->SetViewId(dial_id_str[showdial_i]);// Set style
+            labelButton[showdial_i]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+
+            labelButton[showdial_i]->SetText(dial_id_str[showdial_i]);
+            labelButton[showdial_i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
+            labelButton[showdial_i]->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+
+            dial_group->Add(labelButton[showdial_i]);
+            labelButton[showdial_i]->SetVisible(true);
+            showdial_i++;
+        }
+    }
+
+    if (image_line == nullptr) {
+        image_line = new UIImageView();
+    }
+    if(image_line == nullptr)
+    {
+            return false;
+    }
+    image_line->SetPosition(193, 25);         // widget's left position and top position
+    image_line->Resize(80, 8);          // widget's width and height
+    image_line->SetViewId("image1");// Set style
+    image_line->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+    image_line->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+    image_line->SetStyle(STYLE_BORDER_RADIUS, 100);
+
+    dial_group->Add(image_line);
+    image_line->SetVisible(true);
+
+    // Add Label to App
+    if (label_number == nullptr) {
+        label_number = new UILabel();
+    }
+    if(label_number == nullptr)
+    {
+            return false;
+    }
+    label_number->SetPosition(100, 43);         // widget's left position and top position
+    label_number->Resize(265, 60);          // widget's width and height
+    label_number->SetViewId("label3");// Set style
+    label_number->SetStyle(STYLE_TEXT_FONT, 40);
+
+    // Set additional property
+    label_number->SetText("");
+    label_number->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
+    label_number->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    label_number->SetRollSpeed(0);
+    label_number->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
+    dial_group->Add(label_number);
+    
+    group->Add(dial_group);
+    dial_group->SetVisible(false);
+    return true;
+    
+}
+
+UIViewGroup *CallingView::CreateUIViewGroup()
+{
+    group = new UIViewGroup();
+    if (group == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::UIViewGroup::new group error");
+        return nullptr;
+    }
+    group->SetPosition(MATH_ZERO, MATH_ZERO);
+    group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value
+
+    if (!InitImageViewDisplay()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitImageViewDisplay error");
+        return nullptr;
+    }
+    if (!InitUILabelDisplay()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitUILabelDisplay error");
+        return nullptr;
+    }
+
+    if(!Initshowdial())
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitUILabelDisplay error");
+        return nullptr;
+    }
+    if (!InitAddOnclickevent()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitAddOnclickevent error");
+        return nullptr;
+    }
+    return group;
+}
+
+UIViewGroup *CallingView::CreateUIViewGroup(uint8_t type)
+{
+    group = new UIViewGroup();
+    if (group == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::UIViewGroup::new group error");
+        return nullptr;
+    }
+    group->SetPosition(MATH_ZERO, MATH_ZERO);
+    group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value
+
+    if (!InitImageViewDisplay()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitImageViewDisplay error");
+        return nullptr;
+    }
+    if (!InitUILabelDisplay()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitUILabelDisplay error");
+        return nullptr;
+    }
+    currentTimes->SetTextId(STR_CALLING);    /* code */
+    imageMicrophone->SetStyle(STYLE_IMAGE_OPA, 97);
+    
+    if(!Initshowdial())
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitUILabelDisplay error");
+        return nullptr;
+    }
+    if (!InitAddOnclickevent()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitAddOnclickevent error");
+        return nullptr;
+    }
+    return group;
+}
+
 }
\ No newline at end of file
index 99808b2..1c11fc2 100644 (file)
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: DialingScreenView.cpp\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-#include "wearable_log.h"\r
-#include "UiConfig.h"\r
-#include "DialingScreenView.h"\r
-#include "MainCallingPresenter.h"\r
-\r
-namespace OHOS {\r
-static constexpr uint16 MATH_ZERO = 0;\r
-\r
-// 图片显示\r
-static constexpr uint16 IMAGE_HANDUP_POSITION_X = 177;\r
-static constexpr uint16 IMAGE_HANDUP_POSITION_Y = 210;\r
-\r
-// 来电显示\r
-static constexpr uint16 LABEL_ADRESS_POSITION_X = 0;\r
-static constexpr uint16 LABEL_ADRESS_POSITION_Y = 90;\r
-static constexpr uint16 VIEW_DISTANCE_TO_LEFT_SIDE = HORIZONTAL_RESOLUTION;\r
-static constexpr uint16 TITLE_LABEL_DEFAULT_HEIGHT = 60;\r
-\r
-// 拨出时间\r
-static constexpr uint16   LABEL_DIALING_POSITION_X = 0;\r
-static constexpr uint16 LABEL_DIALING_POSITION_Y = 150;\r
-\r
-// 当前时间\r
-static constexpr uint16 LABEL_CURRENT_POSITION_X = 0;\r
-static constexpr uint16 LABEL_CURRENT_POSITION_Y = 340;\r
-\r
-// 字体大小\r
-static constexpr uint16 FONT_TIME_SIZE = 25;\r
-static constexpr uint16 FONT_AIALING_SIZE = 40;\r
-static constexpr uint16 FONT_CURRENT_SIZE = 20;\r
-static DialingScreenView *g_pMainView = nullptr;\r
-DialingScreenView::DialingScreenView()\r
-{\r
-    g_pMainView = this;\r
-}\r
-\r
-DialingScreenView::~DialingScreenView()\r
-{\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DialingScreenView::~DialingScreenView");\r
-    group->RemoveAll();\r
-    delete dialingId;\r
-    dialingId = nullptr;\r
-\r
-    delete dialingTime;\r
-    dialingTime = nullptr;\r
-\r
-    delete currentTimes;\r
-    currentTimes = nullptr;\r
-\r
-    delete handup;\r
-    handup = nullptr;\r
-\r
-    delete group;\r
-    group = nullptr;\r
-\r
-    g_pMainView = nullptr;\r
-}\r
-\r
-DialingScreenView *DialingScreenView::GetInstance()\r
-{\r
-    return g_pMainView;\r
-}\r
-\r
-bool DialingScreenView::InitUILabelDisplay()\r
-{\r
-    dialingId = new UILabel();\r
-    if (dialingId == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new UILabel fail");\r
-        return false;\r
-    }\r
-    dialingId->SetPosition(LABEL_ADRESS_POSITION_X, LABEL_ADRESS_POSITION_Y,\r
-        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);\r
-    dialingId->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    dialingId->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());\r
-    dialingId->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    dialingId->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_AIALING_SIZE);\r
-    dialingId->SetTextColor(Color::White());\r
-    group->Add(dialingId);\r
-\r
-    dialingTime = new UILabel();\r
-    if (dialingTime == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new Label fail");\r
-        return false;\r
-    }\r
-    dialingTime->SetPosition(LABEL_DIALING_POSITION_X, LABEL_DIALING_POSITION_Y,\r
-        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);\r
-    dialingTime->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    dialingTime->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    dialingTime->SetText(CallerLogModel::GetInstance()->GetDialingStatus().c_str());\r
-    dialingTime->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_TIME_SIZE);\r
-    dialingTime->SetTextColor(Color::White());\r
-    group->Add(dialingTime);\r
-\r
-    currentTimes = new UILabel();\r
-    if (currentTimes == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::new Label fail");\r
-        return false;\r
-    }\r
-    currentTimes->SetPosition(LABEL_CURRENT_POSITION_X, LABEL_CURRENT_POSITION_Y,\r
-        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);\r
-    currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str());\r
-    currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE);\r
-    currentTimes->SetTextColor(Color::White());\r
-    group->Add(currentTimes);\r
-\r
-    return true;\r
-}\r
-\r
-UIViewGroup *DialingScreenView::CreateUIViewGroup()\r
-{\r
-    group = new UIViewGroup();\r
-    if (group == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new group error");\r
-        return nullptr;\r
-    }\r
-    group->SetPosition(MATH_ZERO, MATH_ZERO);\r
-    group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value\r
-\r
-    if (!InitUILabelDisplay()) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::InitImageViewDisplay error");\r
-        return nullptr;\r
-    }\r
-\r
-    handup = new UIImageView();\r
-    if (handup == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new UIImageView error");\r
-        return nullptr;\r
-    }\r
-    handup->SetPosition(IMAGE_HANDUP_POSITION_X, IMAGE_HANDUP_POSITION_Y); // 30 :  offset\r
-    handup->SetSrc(PNG_DISSGREE_IMAGE_PATH);\r
-    handup->SetTouchable(true);\r
-    handup->SetViewId("dialingHandUp");\r
-\r
-    clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();\r
-    if (clickLeftListener == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new clickLeftListener error");\r
-        return nullptr;\r
-    }\r
-    handup->SetOnClickListener(clickLeftListener);\r
-    group->Add(handup);\r
-\r
-    return group;\r
-}\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: DialingScreenView.cpp
+ * Author:
+ * Create: 2021-10-12
+ */
+#include "wearable_log.h"
+#include "UiConfig.h"
+#include "DialingScreenView.h"
+#include "MainCallingPresenter.h"
+
+namespace OHOS {
+static constexpr uint16 MATH_ZERO = 0;
+
+// 图片显示
+static constexpr uint16 IMAGE_HANDUP_POSITION_X = 177;
+static constexpr uint16 IMAGE_HANDUP_POSITION_Y = 210;
+
+// 来电显示
+static constexpr uint16 LABEL_ADRESS_POSITION_X = 0;
+static constexpr uint16 LABEL_ADRESS_POSITION_Y = 90;
+static constexpr uint16 VIEW_DISTANCE_TO_LEFT_SIDE = HORIZONTAL_RESOLUTION;
+static constexpr uint16 TITLE_LABEL_DEFAULT_HEIGHT = 60;
+
+// 拨出时间
+static constexpr uint16   LABEL_DIALING_POSITION_X = 0;
+static constexpr uint16 LABEL_DIALING_POSITION_Y = 150;
+
+// 当前时间
+static constexpr uint16 LABEL_CURRENT_POSITION_X = 0;
+static constexpr uint16 LABEL_CURRENT_POSITION_Y = 340;
+
+// 字体大小
+static constexpr uint16 FONT_TIME_SIZE = 25;
+static constexpr uint16 FONT_AIALING_SIZE = 40;
+static constexpr uint16 FONT_CURRENT_SIZE = 20;
+static DialingScreenView *g_pMainView = nullptr;
+DialingScreenView::DialingScreenView()
+{
+    g_pMainView = this;
+}
+
+DialingScreenView::~DialingScreenView()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DialingScreenView::~DialingScreenView");
+    group->RemoveAll();
+    delete dialingId;
+    dialingId = nullptr;
+
+    delete dialingTime;
+    dialingTime = nullptr;
+
+    delete currentTimes;
+    currentTimes = nullptr;
+
+    delete handup;
+    handup = nullptr;
+
+    delete group;
+    group = nullptr;
+
+    g_pMainView = nullptr;
+}
+
+DialingScreenView *DialingScreenView::GetInstance()
+{
+    return g_pMainView;
+}
+
+bool DialingScreenView::InitUILabelDisplay()
+{
+    dialingId = new UILabel();
+    if (dialingId == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new UILabel fail");
+        return false;
+    }
+    dialingId->SetPosition(LABEL_ADRESS_POSITION_X, LABEL_ADRESS_POSITION_Y,
+        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);
+    dialingId->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+
+    dialingId->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+    
+    dialingId->SetAlign(TEXT_ALIGNMENT_CENTER);
+    dialingId->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_AIALING_SIZE);
+    dialingId->SetTextColor(Color::White());
+    group->Add(dialingId);
+
+    dialingTime = new UILabel();
+    if (dialingTime == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new Label fail");
+        return false;
+    }
+    dialingTime->SetPosition(LABEL_DIALING_POSITION_X, LABEL_DIALING_POSITION_Y,
+        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);
+    dialingTime->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+    dialingTime->SetAlign(TEXT_ALIGNMENT_CENTER);
+    dialingTime->SetText(CallerLogModel::GetInstance()->GetDialingStatus().c_str());
+    dialingTime->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_TIME_SIZE);
+    dialingTime->SetTextColor(Color::White());
+    group->Add(dialingTime);
+
+    currentTimes = new UILabel();
+    if (currentTimes == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::new Label fail");
+        return false;
+    }
+    currentTimes->SetPosition(LABEL_CURRENT_POSITION_X, LABEL_CURRENT_POSITION_Y,
+        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);
+    currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+    currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER);
+    currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str());
+    currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE);
+    currentTimes->SetTextColor(Color::White());
+    group->Add(currentTimes);
+
+    return true;
+}
+
+UIViewGroup *DialingScreenView::CreateUIViewGroup()
+{
+    group = new UIViewGroup();
+    if (group == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new group error");
+        return nullptr;
+    }
+    group->SetPosition(MATH_ZERO, MATH_ZERO);
+    group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value
+
+    if (!InitUILabelDisplay()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::InitImageViewDisplay error");
+        return nullptr;
+    }
+
+    handup = new UIImageView();
+    if (handup == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new UIImageView error");
+        return nullptr;
+    }
+    handup->SetPosition(IMAGE_HANDUP_POSITION_X, IMAGE_HANDUP_POSITION_Y); // 30 :  offset
+    handup->SetSrc(PNG_DISSGREE_IMAGE_PATH);
+    handup->SetTouchable(true);
+    handup->SetViewId("dialingHandUp");
+
+    clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();
+    if (clickLeftListener == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::new clickLeftListener error");
+        return nullptr;
+    }
+    handup->SetOnClickListener(clickLeftListener);
+    group->Add(handup);
+
+    return group;
+}
 }
\ No newline at end of file
index ba2b91c..a6dd3d1 100644 (file)
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: MainCallingPresenter.cpp\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-\r
-#include "wearable_log.h"\r
-#include "common/image_cache_manager.h"\r
-#include "UiConfig.h"\r
-#include "ui_resource_image.h"\r
-#include "MainCallingPresenter.h"\r
-#include "CallingView.h"\r
-#include "CallerDisplayView.h"\r
-#include "DialingScreenView.h"\r
-#include "MainCallingView.h"\r
-#include "NativeRegisterManager.h"\r
-#include "PhoneService.h"\r
-#include "WaitingHintsView.h"\r
-\r
-namespace OHOS {\r
-\r
-REGIST_SLICE(VIEW_MAEKPHONE_SAMPLE, MainCallingView, MainCallingPresenter);\r
-\r
-static MainCallingPresenter *g_pMainView = nullptr;\r
-static constexpr int32 NUM_10 = 10;\r
-MainCallingPresenter::MainCallingPresenter()\r
-{\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::MainCallingPresenter");\r
-    g_pMainView = this;\r
-}\r
-\r
-MainCallingPresenter::~MainCallingPresenter()\r
-{\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::~MainCallingPresenter");\r
-    RootView::GetInstance()->RemoveAll();\r
-    if (volumeSetting != nullptr) {\r
-        delete volumeSetting;\r
-        volumeSetting = nullptr;\r
-    }\r
-    g_pMainView = nullptr;\r
-}\r
-\r
-MainCallingPresenter *MainCallingPresenter::GetInstance()\r
-{\r
-    return g_pMainView;\r
-}\r
-\r
-void MainCallingPresenter::HonrsViewChange()\r
-{\r
-    if (volumeSetting == nullptr) {\r
-        volumeSetting = new VolumeSettingView();\r
-        if (volumeSetting == nullptr) {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::volumeSetting nullptr err");\r
-            return;\r
-        }\r
-        if (!volumeSetting->SetUpVolume()) {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::volumeSetting SetUpVolume fail");\r
-            return;\r
-        }\r
-        volumeSetting->GetProgress()->SetValue(AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO));\r
-        if (AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO) == 0) {\r
-            ImageInfo *image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_MUTE_BUTTON, PLAYER_IAMGES);\r
-            volumeSetting->GetDecreaseButton()->SetImageSrc(image, image);\r
-        }\r
-        view_->AddViewToRootContainer(volumeSetting);\r
-    }\r
-    VolumeSliderEventListener *volumeSliderEventListener = volumeSetting->GetVolumeEventListener();\r
-    if (volumeSliderEventListener == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::volumeSliderEventListener nullptr err");\r
-        return;\r
-    }\r
-\r
-    volumeSliderEventListener->SetPlayerCoefficients(VOLUMEPHONE); // 进度条系数\r
-\r
-    if (!InitPointerValue()) {\r
-        return;\r
-    }\r
-\r
-    view_->GetScreenGroup()->SetVisible(false);\r
-    view_->GetDisplayGroup()->SetVisible(false);\r
-    view_->GetCallingGroup()->SetVisible(false);\r
-    view_->GetWaitingGroup()->SetVisible(false);\r
-\r
-    volumeSetting->SetVisible(true);\r
-    // 刷新UI\r
-    RootView::GetInstance()->Invalidate();\r
-}\r
-\r
-bool MainCallingPresenter::CallingViewDisplay()\r
-{\r
-    if (!InitPointerValue()) {\r
-        return false;\r
-    }\r
-    view_->GetScreenGroup()->SetVisible(false);\r
-    view_->GetDisplayGroup()->SetVisible(false);\r
-    view_->GetCallingGroup()->SetVisible(true);\r
-    view_->GetWaitingGroup()->SetVisible(false);\r
-    return true;\r
-}\r
-\r
-bool MainCallingPresenter::InitPointerValue()\r
-{\r
-    if (CallerDisplayView::GetInstance() == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] CallerDisplayView error");\r
-        return false;\r
-    }\r
-\r
-    if (DialingScreenView::GetInstance() == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] DialingScreenView error");\r
-        return false;\r
-    }\r
-\r
-    if (CallingView::GetInstance() == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] CallingView error");\r
-        return false;\r
-    }\r
-\r
-    if (WaitingHintsView::GetInstance() == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] WaitingHintsView error");\r
-        return false;\r
-    }\r
-\r
-    if (view_->GetScreenGroup() == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] view_ GetScreenGroup error");\r
-        return false;\r
-    }\r
-\r
-    if (view_->GetDisplayGroup() == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] view_ GetDisplayGroup error");\r
-        return false;\r
-    }\r
-\r
-    if (view_->GetCallingGroup() == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] view_ GetCallingGroup error");\r
-        return false;\r
-    }\r
-\r
-    if (view_->GetWaitingGroup() == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] view_ GetWaitingGroup error");\r
-        return false;\r
-    }\r
-    return true;\r
-}\r
-\r
-bool MainCallingPresenter::HintsHandupClick()\r
-{\r
-    if (RejectIncomingCall() != 0) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error");\r
-        return false;\r
-    }\r
-    CallerLogModel::GetInstance()->SetWaitingStatus(false);\r
-    CallerLogModel::GetInstance()->SetCallStatus(true);\r
-    NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, PRIORITY_ONE);\r
-    return true;\r
-}\r
-\r
-bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event)\r
-{\r
-    UNUSED(event);\r
-\r
-    if (!InitPointerValue()) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::InitPointerValue error");\r
-        return false;\r
-    }\r
-\r
-    if (strcmp(view.GetViewId(), "microphoneChange") == 0) {\r
-        if (changeImage == 0) {\r
-            changeImage = 1;\r
-            view_->GetCallingView()->GetImageMicrophone()->SetSrc(PNG_MICROPHONE_CLOSE_IMAGE_PATH);\r
-            SetMicMute(true);\r
-        } else {\r
-            changeImage = 0;\r
-            view_->GetCallingView()->GetImageMicrophone()->SetSrc(PNG_MICROPHONE_OPEN_IMAGE_PATH);\r
-            SetMicMute(false);\r
-        }\r
-        return true;\r
-    } else if (strcmp(view.GetViewId(), "displayHandUp") == 0 || strcmp(view.GetViewId(), "callingHandUp") == 0||\r
-        strcmp(view.GetViewId(), "dialingHandUp") == 0) {\r
-        if (strcmp(view.GetViewId(), "displayHandUp") == 0) {\r
-            // 手表拒接呼入来电\r
-            if (RejectIncomingCall() != 0) {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::RejectIncomingCall() fail");\r
-                return false;\r
-            }\r
-        }\r
-        if (FinishCall() != 0) {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::FinishCall() fail");\r
-            return false;\r
-        }\r
-        return true;\r
-    } else if (strcmp(view.GetViewId(), "volumeSwitch") == 0) {\r
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::honrs show");\r
-        HonrsViewChange();\r
-    } else if (strcmp(view.GetViewId(), "hintsHandup") == 0) {\r
-        if (!HintsHandupClick()) {\r
-            return false;\r
-        }\r
-    } else if (strcmp(view.GetViewId(), "answer") == 0) {\r
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::phone calling");\r
-        // 界面的显示和隐藏\r
-        SetMicMute(false);\r
-        // 手表接听呼入来电\r
-        if (AcceptIncomingCall() != 0) {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::AcceptIncomingCall() fail");\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-    return true;\r
-}\r
-\r
-VolumeSettingView *MainCallingPresenter::GetvolumeSetting()\r
-{\r
-    return volumeSetting;\r
-}\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: MainCallingPresenter.cpp
+ * Author:
+ * Create: 2021-10-12
+ */
+
+#include "wearable_log.h"
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include "MainCallingPresenter.h"
+#include "CallingView.h"
+#include "CallerDisplayView.h"
+#include "DialingScreenView.h"
+#include "MainCallingView.h"
+#include "PhoneService.h"
+#include "WaitingHintsView.h"
+#include "cat1_server.h"
+#include "cat1_server_hal.h"
+#include "custom_utils.h"
+
+
+#include "phone/include/phoneaddressmodel.h"
+
+
+#ifdef SUPPORT_BLE_SERVICE
+#include <bleEvent.h>
+#include "bleService.h"
+#include "bletest.h"
+#endif
+
+#include "NativeAbility.h"
+
+#ifdef FD230_650
+#include "dial_sos_c.h"
+#endif
+
+#include "soundandvibration/include/SoundAndVibrationVolumeSettingC.h"
+namespace OHOS {
+static MainCallingPresenter *g_pMainView = nullptr;
+static constexpr int32 NUM_10 = 10;
+MainCallingPresenter::MainCallingPresenter()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::MainCallingPresenter");
+    g_pMainView = this;
+}
+
+MainCallingPresenter::~MainCallingPresenter()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::~MainCallingPresenter");
+   RootView::GetInstance()->RemoveAll();
+    if (volumeSetting != nullptr) {
+        delete volumeSetting;
+        volumeSetting = nullptr;
+    }
+    g_pMainView = nullptr;
+}
+
+MainCallingPresenter *MainCallingPresenter::GetInstance()
+{
+    return g_pMainView;
+}
+
+void MainCallingPresenter::OnStart()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::OnStart");
+
+   
+}
+
+void MainCallingPresenter::OnPause(void) {}
+
+void MainCallingPresenter::OnResume(void) {}
+
+void MainCallingPresenter::OnStop(void)
+{
+   RootView::GetInstance()->ClearOnKeyActListener();
+   
+}
+
+void MainCallingPresenter::HonrsViewChange()
+{
+    if (volumeSetting == nullptr) {
+        volumeSetting = new VolumeSettingView();
+        if (volumeSetting == nullptr) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::volumeSetting nullptr err");
+            return;
+        }
+        if (!volumeSetting->SetUpVolume()) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::volumeSetting SetUpVolume fail");
+            return;
+        }
+        volumeSetting->GetProgress()->SetValue(CallVolumeGet());
+        // volumeSetting->GetProgress()->SetValue(AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO));
+        // if (AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO) == 0) {
+        //     ImageInfo *image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_MUTE_BUTTON, PLAYER_IAMGES);
+        //     volumeSetting->GetDecreaseButton()->SetImageSrc(image, image);
+        // }
+       RootView::GetInstance()->Add(volumeSetting);
+    }
+    VolumeSliderEventListener *volumeSliderEventListener = volumeSetting->GetVolumeEventListener();
+    if (volumeSliderEventListener == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::volumeSliderEventListener nullptr err");
+        return;
+    }
+
+    volumeSliderEventListener->SetPlayerCoefficients(VOLUMEPHONE); // 进度条系数
+
+    if (!InitPointerValue()) {
+        return;
+    }
+
+    view_->GetScreenGroup()->SetVisible(false);
+    view_->GetDisplayGroup()->SetVisible(false);
+    view_->GetCallingGroup()->SetVisible(false);
+    view_->GetWaitingGroup()->SetVisible(false);
+
+    volumeSetting->SetVisible(true);
+    // 刷新UI
+   RootView::GetInstance()->Invalidate();
+}
+
+bool MainCallingPresenter::CallingViewDisplay()
+{
+    if (!InitPointerValue()) {
+        return false;
+    }
+    view_->GetScreenGroup()->SetVisible(false);
+    view_->GetDisplayGroup()->SetVisible(false);
+    view_->GetCallingGroup()->SetVisible(true);
+    view_->GetWaitingGroup()->SetVisible(false);
+    return true;
+}
+
+bool MainCallingPresenter::InitPointerValue()
+{
+    if (CallerDisplayView::GetInstance() == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] CallerDisplayView error");
+        return false;
+    }
+
+    // if (DialingScreenView::GetInstance() == nullptr) {
+    //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] DialingScreenView error");
+    //     return false;
+    // }
+
+    if (CallingView::GetInstance() == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] CallingView error");
+        return false;
+    }
+
+    if (WaitingHintsView::GetInstance() == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] WaitingHintsView error");
+        return false;
+    }
+
+    if (view_->GetScreenGroup() == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] view_ GetScreenGroup error");
+        return false;
+    }
+
+    if (view_->GetDisplayGroup() == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] view_ GetDisplayGroup error");
+        return false;
+    }
+
+    if (view_->GetCallingGroup() == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] view_ GetCallingGroup error");
+        return false;
+    }
+
+    if (view_->GetWaitingGroup() == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] view_ GetWaitingGroup error");
+        return false;
+    }
+    return true;
+}
+
+bool MainCallingPresenter::HintsHandupClick()
+{
+    if (RejectIncomingCall() != 0) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error");
+        return false;
+    }
+    CallerLogModel::GetInstance()->SetWaitingStatus(false);
+    CallerLogModel::GetInstance()->SetCallStatus(true);
+    NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, PRIORITY_ONE);
+    return true;
+}
+
+bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event)
+{
+    #ifdef FD230_650
+    UNUSED(event);
+     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",view.GetViewId());
+    if (!InitPointerValue()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::InitPointerValue error");
+        return false;
+    }
+     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",view.GetViewId());
+    if (strcmp(view.GetViewId(), "microphoneChange") == 0) {
+        if (changeImage == 0) {
+            changeImage = 1;
+            if(CallerLogModel::GetInstance()->GetCallStatus())
+            {
+                view_->GetCallingView()->GetImageMicrophone()->SetSrc(PNG_230_MICROPHONE_CLOSE_IMAGE_PATH);
+               
+            }
+            else
+            {
+                return false;
+                view_->GetScreenView()->GetImageMicrophone()->SetSrc(PNG_230_MICROPHONE_CLOSE_IMAGE_PATH);
+            }
+            if(CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+            {
+                SetMicMutecat1(true);
+            }
+            else
+            {
+                 SetMicMute(true);
+            }
+           
+            
+        } else {
+            changeImage = 0;
+             if(CallerLogModel::GetInstance()->GetCallStatus())
+            {
+                view_->GetCallingView()->GetImageMicrophone()->SetSrc(PNG_230_MICROPHONE_OPEN_IMAGE_PATH);
+               
+            }
+            else
+            {
+                return false;
+                view_->GetScreenView()->GetImageMicrophone()->SetSrc(PNG_230_MICROPHONE_OPEN_IMAGE_PATH);
+            }
+            if(CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+            {
+                SetMicMutecat1(false);
+            }
+            else
+            {
+                 SetMicMute(false);
+            }
+        }
+        return true;
+    } else if (strcmp(view.GetViewId(), "displayHandUp") == 0 || strcmp(view.GetViewId(), "callingHandUp") == 0||
+        strcmp(view.GetViewId(), "dialingHandUp") == 0) {
+        if(strcmp(view.GetViewId(), "callingHandUp") == 0 ||  strcmp(view.GetViewId(), "dialingHandUp") == 0) 
+        {
+            if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+            {
+
+                {
+                    sos_falg_clean();
+                }
+
+                //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+
+                cat1_call_hungup_timer();
+                
+
+            }
+            else
+            {
+                if (FinishCall() != 0) {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::FinishCall() fail");
+                return false;
+                }
+            }
+            return true;
+        }
+        if (strcmp(view.GetViewId(), "displayHandUp") == 0) 
+        {
+            if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+            {
+                    //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+                    cat1_call_hungup_timer();
+                    return true;
+                //#endif
+
+            }
+            else
+            {
+                // 手表拒接呼入来电
+                if (RejectIncomingCall() != 0) {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::RejectIncomingCall() fail");
+                    return false;
+                }
+            }
+        }
+        if (FinishCall() != 0) {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::FinishCall() fail");
+                return false;
+        }
+        return true;
+       
+    } else if (strcmp(view.GetViewId(), "volumeSwitch") == 0) {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::honrs show");
+        HonrsViewChange();
+    } else if (strcmp(view.GetViewId(), "hintsHandup") == 0) 
+    {
+
+            if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+            {
+                    //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+                    cat1_call_hungup_timer();
+                    
+                    return true;
+                //#endif
+
+            }else
+            {
+                if (!HintsHandupClick())
+                {
+                    return false;
+                }
+            }
+       
+           
+        
+       
+    } else if (strcmp(view.GetViewId(), "answer") == 0) {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::phone calling");
+        if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 ");
+            cat1_call_answer();
+            //incomedcall_event_sendmsg_toUI("ok");
+
+            return true;
+
+            //#endif
+        }
+        else
+        {
+              // 界面的显示和隐藏
+            SetMicMute(false);
+
+            // 手表接听呼入来电
+            if (AcceptIncomingCall() != 0) {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::AcceptIncomingCall() fail");
+                return false;
+            }
+            return true;
+
+        }
+      
+        
+    }
+    else if ((strcmp(view.GetViewId(), "dial") == 0))
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->showdial(true);
+        else
+        view_->GetCallingView()->showdial(true);
+    }
+
+    if (strcmp(view.GetViewId(), "0") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+       view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "1") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "2") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "3") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "4") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "5") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "6") == 0)
+    {   
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "7") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "8") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "9") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId());
+
+    }else if (strcmp(view.GetViewId(), "*") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+        view_->GetCallingView()->text_updata_buf(view.GetViewId());  /* code */
+    }
+    else if (strcmp(view.GetViewId(), "#") == 0)
+    {
+        if(view_->GetScreenGroup()->IsVisible())
+        view_->GetScreenView()->text_updata_buf(view.GetViewId()); 
+        else
+       view_->GetCallingView()->text_updata_buf(view.GetViewId()); 
+    }
+    else if (strcmp(view.GetViewId(), "callingheadset") == 0)
+    {
+       NativeAbility::GetInstance().EnterSlice(VIEW_BLUETOOTH_EARPHONE);
+    }
+
+#endif
+    return true;
+}
+
+bool MainCallingPresenter::OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& event)
+{
+
+     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter OnDragEnd");
+    if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) 
+    {
+
+        if((strcmp(view.GetViewId(), "dialing") == 0))
+        {
+            if(view_->GetScreenGroup()->IsVisible())
+            view_->GetScreenView()->showdial(false);
+            else
+            view_->GetCallingView()->showdial(false);
+        }
+       
+    }
+    return true;
+}
+
+bool MainCallingPresenter::OnKeyAct(UIView &view, const KeyEvent &event) // 增加按键事件
+{
+    return true;
+}
+
+VolumeSettingView *MainCallingPresenter::GetvolumeSetting()
+{
+    return volumeSetting;
+}
 }
\ No newline at end of file
index c4e6af6..a7fe868 100644 (file)
-/*\r
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
- * Description: MainCallingView.cpp\r
- * Author:\r
- * Create: 2021-10-12\r
- */\r
-#include "wearable_log.h"\r
-#include "UiConfig.h"\r
-#include "MainCallingView.h"\r
-#include "MainCallingPresenter.h"\r
-#include "CallerLogModel.h"\r
-\r
-namespace OHOS {\r
-static MainCallingView *g_pMainView = nullptr;\r
-MainCallingView::MainCallingView()\r
-{\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingView::MainCallingView");\r
-    g_pMainView = this;\r
-}\r
-\r
-MainCallingView::~MainCallingView()\r
-{\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingView::~MainCallingView");\r
-    delete displayView;\r
-    displayView = nullptr;\r
-\r
-    delete callView;\r
-    callView = nullptr;\r
-\r
-    delete screenView;\r
-    screenView = nullptr;\r
-\r
-    g_pMainView = nullptr;\r
-}\r
-\r
-MainCallingView *MainCallingView::GetInstance()\r
-{\r
-    return g_pMainView;\r
-}\r
-\r
-UIViewGroup *MainCallingView::GetDisplayGroup()\r
-{\r
-    return displayGroup;\r
-}\r
-\r
-UIViewGroup *MainCallingView::GetCallingGroup()\r
-{\r
-    return callingGroup;\r
-}\r
-\r
-UIViewGroup *MainCallingView::GetScreenGroup()\r
-{\r
-    return screenGroup;\r
-}\r
-\r
-UIViewGroup *MainCallingView::GetWaitingGroup()\r
-{\r
-    return waitingGroup;\r
-}\r
-\r
-CallingView *MainCallingView::GetCallingView()\r
-{\r
-    return callView;\r
-}\r
-\r
-bool MainCallingView::InitPointerValue()\r
-{\r
-    displayView = new CallerDisplayView();\r
-    if (displayView == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::displayView");\r
-        return false;\r
-    }\r
-\r
-    displayGroup = displayView->CreateUIViewGroup();\r
-    if (displayGroup == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::displayGroup");\r
-        return false;\r
-    }\r
-\r
-    callView = new CallingView();\r
-    if (callView == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::callView");\r
-        return false;\r
-    }\r
-\r
-    callingGroup = callView->CreateUIViewGroup();\r
-    if (callingGroup == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::callingGroup");\r
-        return false;\r
-    }\r
-\r
-    screenView = new DialingScreenView();\r
-    if (screenView == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::screenView");\r
-        return false;\r
-    }\r
-\r
-    screenGroup = screenView->CreateUIViewGroup();\r
-    if (screenGroup == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::screenGroup");\r
-        return false;\r
-    }\r
-\r
-    waitingView = new WaitingHintsView();\r
-    if (waitingView == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::WaitingHintsView");\r
-        return false;\r
-    }\r
-\r
-    waitingGroup = waitingView->CreateUIViewGroup();\r
-    if (waitingGroup == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::waitingGroup");\r
-        return false;\r
-    }\r
-    return true;\r
-}\r
-\r
-void MainCallingView::OnStart()\r
-{\r
-\r
-    if (!InitPointerValue()) {\r
-        return;\r
-    }\r
-\r
-    AddViewToRootContainer(displayGroup);\r
-    AddViewToRootContainer(callingGroup);\r
-    AddViewToRootContainer(screenGroup);\r
-    AddViewToRootContainer(waitingGroup);\r
-\r
-    waitingGroup->SetVisible(false);\r
-    callingGroup->SetVisible(false);\r
-    if (CallerLogModel::GetInstance()->GetCallStatus()) {\r
-        displayGroup->SetVisible(false);\r
-        callingGroup->SetVisible(true);\r
-        screenGroup->SetVisible(false);\r
-    } else if (CallerLogModel::GetInstance()->GetWaitingStatus()) {\r
-        screenGroup->SetVisible(false);\r
-        displayGroup->SetVisible(false);\r
-        waitingGroup->SetVisible(true);\r
-    } else if (CallerLogModel::GetInstance()->GetPhoneStatus()) {\r
-        displayGroup->SetVisible(false);\r
-    } else {\r
-        screenGroup->SetVisible(false);\r
-    }\r
-    CallerLogModel::GetInstance()->SetVolumeScreenStatus(false);\r
-    if (CallerLogModel::GetInstance()->GetMulitplePhoneStatus()) {\r
-        MulitplePhoneTextReplaces();\r
-        CallerLogModel::GetInstance()->SetMulitplePhoneStatus(false);\r
-    }\r
-    return;\r
-}\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: MainCallingView.cpp
+ * Author:
+ * Create: 2021-10-12
+ */
+#include "wearable_log.h"
+#include "UiConfig.h"
+#include "MainCallingView.h"
+#include "MainCallingPresenter.h"
+#include "CallerLogModel.h"
+
+namespace OHOS {
+static MainCallingView *g_pMainView = nullptr;
+MainCallingView::MainCallingView()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingView::MainCallingView");
+    g_pMainView = this;
+}
+
+MainCallingView::~MainCallingView()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingView::~MainCallingView");
+    delete displayView;
+    displayView = nullptr;
+
+    delete callView;
+    callView = nullptr;
+
+    delete screenView;
+    screenView = nullptr;
+
+    delete waitingView;
+    waitingView = nullptr;
+
+    
+
+    g_pMainView = nullptr;
+}
+
+MainCallingView *MainCallingView::GetInstance()
+{
+    return g_pMainView;
+}
+
+UIViewGroup *MainCallingView::GetDisplayGroup()
+{
+    return displayGroup;
+}
+
+UIViewGroup *MainCallingView::GetCallingGroup()
+{
+    return callingGroup;
+}
+
+UIViewGroup *MainCallingView::GetScreenGroup()
+{
+    return screenGroup;
+}
+
+UIViewGroup *MainCallingView::GetWaitingGroup()
+{
+    return waitingGroup;
+}
+
+CallingView *MainCallingView::GetCallingView()
+{
+    return callView;
+}
+
+CallingView *MainCallingView::GetScreenView()
+{
+    return screenView;
+}
+
+bool MainCallingView::InitPointerValue()
+{
+    displayView = new CallerDisplayView();
+    if (displayView == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::displayView");
+        return false;
+    }
+
+    displayGroup = displayView->CreateUIViewGroup();
+    if (displayGroup == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::displayGroup");
+        return false;
+    }
+
+
+    screenView = new CallingView();
+    if (screenView == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::screenView");
+        return false;
+    }
+
+    callView = new CallingView();
+    if (callView == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::callView");
+        return false;
+    }
+
+    callingGroup = callView->CreateUIViewGroup();
+    if (callingGroup == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::callingGroup");
+        return false;
+    }
+
+
+    screenGroup = screenView->CreateUIViewGroup(0);
+    if (screenGroup == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::screenGroup");
+        return false;
+    }
+
+    waitingView = new WaitingHintsView();
+    if (waitingView == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::WaitingHintsView");
+        return false;
+    }
+
+    waitingGroup = waitingView->CreateUIViewGroup();
+    if (waitingGroup == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::waitingGroup");
+        return false;
+    }
+    return true;
+}
+
+void MainCallingView::updataCallingname(void)
+{
+    //if(CallerLogModel::GetInstance()->Getphonename().length()>5)
+    if(strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),CallerLogModel::GetInstance()->Getphonenumberpbap().c_str())==0)
+    {
+        if(CallerLogModel::GetInstance()->Getphonename().length()!=0)
+        {
+            if(screenView)
+            screenView->updataCallingname();
+            if(callView)
+            callView->updataCallingname();
+            if(displayView)
+            displayView->updataCallingname();
+
+           RootView::GetInstance()->Invalidate();
+
+            //callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str());
+        }
+       
+        
+    } 
+}
+
+void MainCallingView::update_headset_state(uint8_t data)
+{
+     if(callView)
+     {
+         callView->update_headset_state(data);
+        RootView::GetInstance()->Invalidate();
+     }
+        
+}
+
+
+
+void MainCallingView::OnStart()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingView::OnStart");
+   
+
+    if (InitPointerValue() == false) {
+        return;
+    }
+    
+    RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainCallingPresenter::GetInstance();
+   RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+
+   RootView::GetInstance()->Add(displayGroup);
+   RootView::GetInstance()->Add(callingGroup);
+   RootView::GetInstance()->Add(screenGroup);
+   RootView::GetInstance()->Add(waitingGroup);
+
+    waitingGroup->SetVisible(false);
+    callingGroup->SetVisible(false);
+    if (CallerLogModel::GetInstance()->GetCallStatus()) {
+        displayGroup->SetVisible(false);
+        callingGroup->SetVisible(true);
+        screenGroup->SetVisible(false);
+    } else if (CallerLogModel::GetInstance()->GetWaitingStatus()) {
+        screenGroup->SetVisible(false);
+        displayGroup->SetVisible(false);
+        waitingGroup->SetVisible(true);
+    } else if (CallerLogModel::GetInstance()->GetPhoneStatus()) {
+        displayGroup->SetVisible(false);
+    } else {
+        screenGroup->SetVisible(false);
+    }
+    CallerLogModel::GetInstance()->SetVolumeScreenStatus(false);
+
+    if (CallerLogModel::GetInstance()->GetMulitplePhoneStatus()) {
+        MulitplePhoneTextReplaces();
+        CallerLogModel::GetInstance()->SetMulitplePhoneStatus(false);
+    }
+
+    return;
+}
+
 }
\ No newline at end of file
index e27e55d..580011a 100644 (file)
-/*\r
- * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved.\r
- * Description: WaitingHintsView.cpp\r
- * Author:\r
- * Create: 2022-03-14\r
- */\r
-#include "WaitingHintsView.h"\r
-#include "UiConfig.h"\r
-#include "CallerLogModel.h"\r
-#include "MainCallingPresenter.h"\r
-\r
-namespace OHOS {\r
-static constexpr uint16 MATH_ZERO = 0;\r
-// 挂断按钮位置\r
-static constexpr uint16 IMAGE_HANDUP_POSITION_X = 177;\r
-static constexpr uint16 IMAGE_HANDUP_POSITION_Y = 270;\r
-\r
-// 新来电显示\r
-static constexpr uint16 LABEL_PERCENT_POSITION_X = 0;\r
-static constexpr uint16 LABEL_PERCENT_POSITION_Y = 100;\r
-\r
-static constexpr uint16 VIEW_DISTANCE_TO_LEFT_SIDE = HORIZONTAL_RESOLUTION;\r
-static constexpr uint16 TITLE_LABEL_DEFAULT_HEIGHT = 80;\r
-\r
-// 字体大小\r
-static constexpr uint16 LABEL_DISPLAY_FONE_SIZE = 40;\r
-\r
-// 标签坐标\r
-static constexpr uint16 LABEL_CALLERD_POSITION_X = 0;\r
-static constexpr uint16 LABEL_CALLERD_POSITION_Y = 180;\r
-\r
-static WaitingHintsView *g_pMainView = nullptr;\r
-WaitingHintsView::WaitingHintsView()\r
-{\r
-    g_pMainView = this;\r
-}\r
-\r
-WaitingHintsView::~WaitingHintsView()\r
-{\r
-    g_pMainView = nullptr;\r
-}\r
-\r
-UIViewGroup *WaitingHintsView::CreateUIViewGroup()\r
-{\r
-    group = new UIViewGroup();\r
-    if (group == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new group error");\r
-        return nullptr;\r
-    }\r
-    group->SetPosition(MATH_ZERO, MATH_ZERO);\r
-    group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value\r
-\r
-    if (!InitImageViewDisplay()) {\r
-        return nullptr;\r
-    }\r
-    if (!InitUILabelDisplay()) {\r
-        return nullptr;\r
-    }\r
-    return group;\r
-}\r
-\r
-WaitingHintsView *WaitingHintsView::GetInstance()\r
-{\r
-    return g_pMainView;\r
-}\r
-\r
-bool WaitingHintsView::InitImageViewDisplay()\r
-{\r
-    imageDissgree = new UIImageView();\r
-    if (imageDissgree == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new imageDissgree error");\r
-        return false;\r
-    }\r
-    imageDissgree->SetPosition(IMAGE_HANDUP_POSITION_X, IMAGE_HANDUP_POSITION_Y); // 30 :  offset\r
-    imageDissgree->SetSrc(PNG_DISSGREE_IMAGE_PATH);\r
-    imageDissgree->SetTouchable(true);\r
-    imageDissgree->SetViewId("hintsHandup");\r
-\r
-    clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();\r
-    if (clickLeftListener == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new clickLeftListener error");\r
-        return false;\r
-    }\r
-    imageDissgree->SetOnClickListener(clickLeftListener);\r
-    group->Add(imageDissgree);\r
-    return true;\r
-}\r
-\r
-bool WaitingHintsView::InitUILabelDisplay()\r
-{\r
-    callerDisplay = new UILabel();\r
-    if (callerDisplay == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new callerDisplay error");\r
-        return false;\r
-    }\r
-    callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y,\r
-        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);\r
-    callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());\r
-    callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_DISPLAY_FONE_SIZE);\r
-    callerDisplay->SetTextColor(Color::White());\r
-    group->Add(callerDisplay);\r
-\r
-    newcallHints = new UILabel();\r
-    if (newcallHints == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new newcallHints error");\r
-        return false;\r
-    }\r
-    newcallHints->SetPosition(LABEL_CALLERD_POSITION_X, LABEL_CALLERD_POSITION_Y,\r
-        VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);\r
-    newcallHints->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);\r
-    newcallHints->SetText("新来电");\r
-    newcallHints->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-    newcallHints->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_DISPLAY_FONE_SIZE);\r
-    newcallHints->SetTextColor(Color::White());\r
-    group->Add(newcallHints);\r
-    return true;\r
-}\r
+/*
+ * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved.
+ * Description: WaitingHintsView.cpp
+ * Author:
+ * Create: 2022-03-14
+ */
+#include "WaitingHintsView.h"
+#include "UiConfig.h"
+#include "CallerLogModel.h"
+#include "MainCallingPresenter.h"
+#include "ui_resource_string.h"
+
+#ifdef SUPPORT_BLE_SERVICE
+#include <bleEvent.h>
+#include "bleService.h"
+#include "bletest.h"
+#endif
+
+#include "custom_utils.h"
+
+#include "wearable_log.h"
+#include "PhoneService.h"
+#include "cat1_server.h"
+#include "cat1_server_hal.h"
+
+#include "phone/include/phoneaddressmodel.h"
+
+
+
+
+
+#define PHONE_DIR_GIRL_1 "/user/res/Phone/girl.bin"
+#define PHONE_DIR_BOY_1 "/user/res/Phone/boy.bin"
+namespace OHOS {
+static constexpr uint16 MATH_ZERO = 0;
+// 挂断按钮位置
+static constexpr uint16 IMAGE_HANDUP_POSITION_X = 177;
+static constexpr uint16 IMAGE_HANDUP_POSITION_Y = 270;
+
+// 新来电显示
+static constexpr uint16 LABEL_PERCENT_POSITION_X = 0;
+static constexpr uint16 LABEL_PERCENT_POSITION_Y = 100;
+
+static constexpr uint16 VIEW_DISTANCE_TO_LEFT_SIDE = HORIZONTAL_RESOLUTION;
+static constexpr uint16 TITLE_LABEL_DEFAULT_HEIGHT = 80;
+
+// 字体大小
+static constexpr uint16 LABEL_DISPLAY_FONE_SIZE = 40;
+
+// 标签坐标
+static constexpr uint16 LABEL_CALLERD_POSITION_X = 0;
+static constexpr uint16 LABEL_CALLERD_POSITION_Y = 180;
+
+static WaitingHintsView *g_pMainView = nullptr;
+
+// 字体大小
+static constexpr uint16 LABEL_TIME_FONT_SIZE = 25;
+
+
+WaitingHintsView::WaitingHintsView()
+{
+    g_pMainView = this;
+}
+
+WaitingHintsView::~WaitingHintsView()
+{
+    group->RemoveAll();
+
+    delete imageAgreeing;
+    imageAgreeing = nullptr;
+
+    delete imageDissgree;
+    imageDissgree = nullptr;
+
+    
+    delete imageperson;
+    imageperson = nullptr;
+
+    delete callerDisplay;
+    callerDisplay = nullptr;
+
+    delete label_call_source;
+    label_call_source = nullptr;
+
+    delete currentTimes;
+    currentTimes = nullptr;
+
+    delete label_call_hint;
+    label_call_hint = nullptr;
+
+    delete group;
+    group = nullptr;
+
+    g_pMainView = nullptr;
+
+}
+
+void WaitingHintsView::updataCallingname(void)
+{
+    if(strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),CallerLogModel::GetInstance()->Getphonenumberpbap().c_str())==0)
+    {
+        if(CallerLogModel::GetInstance()->Getphonename().length()!=0)
+        callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str());
+    }
+    else
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "updataCallingname  000000000000");
+    }
+}
+
+
+
+UIViewGroup *WaitingHintsView::CreateUIViewGroup()
+{
+    group = new UIViewGroup();
+    if (group == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new group error");
+        return nullptr;
+    }
+    group->SetPosition(MATH_ZERO, MATH_ZERO);
+    group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value
+
+    if (!InitImageViewDisplay()) {
+        return nullptr;
+    }
+    if (!InitUILabelDisplay()) {
+        return nullptr;
+    }
+    return group;
+}
+
+bool WaitingHintsView::InitAddOnclickevent()
+{
+    clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();
+    if (clickLeftListener == nullptr) {
+        return false;
+    }
+    imageAgreeing->SetOnClickListener(clickLeftListener);
+    imageDissgree->SetOnClickListener(clickLeftListener);
+    return true;
+}
+
+WaitingHintsView *WaitingHintsView::GetInstance()
+{
+    return g_pMainView;
+}
+
+bool WaitingHintsView::InitImageViewDisplay()
+{
+   imageAgreeing = new UIImageView();
+    if (imageAgreeing == nullptr) {
+        return false;
+    }
+    imageAgreeing->SetPosition(369, 207); // 30 :  offset
+    imageAgreeing->SetSrc(PNG_ANSWER_230_TMAGE_PATH);
+    imageAgreeing->SetTouchable(true);
+    imageAgreeing->SetViewId("answer");
+    //group->Add(imageAgreeing);
+
+    imageDissgree = new UIImageView();
+    if (imageDissgree == nullptr) {
+        return false;
+    }
+    imageDissgree->SetPosition(46, 207); // 30 :  offset
+    imageDissgree->SetSrc(PNG_HANDUP_230_IMAGE_PATH);
+    imageDissgree->SetTouchable(true);
+    imageDissgree->SetViewId("hintsHandup");
+    //group->Add(imageDissgree);
+
+    imageperson = new UIImageView();
+    if (imageperson == nullptr) {
+        return false;
+    }
+    imageperson->SetPosition(158, 158); // 30 :  offset
+    imageperson->SetSrc(PNG_230_PERSON_IMAGE_PATH);
+    imageperson->SetTouchable(true);
+    imageperson->SetViewId("headset");
+
+    char name_buf[NAME_LEN+1]={0};
+    uint8_t sex;
+    if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),&sex))
+    {
+        if(sex==1)
+        imageperson->SetSrc(PHONE_DIR_BOY_1);
+        else
+        imageperson->SetSrc(PHONE_DIR_GIRL_1);
+    }
+
+    group->Add(imageperson);
+    InitAddOnclickevent();
+    return true;
+}
+
+bool WaitingHintsView::InitUILabelDisplay()
+{
+    callerDisplay = new UILabelExt();
+    if (callerDisplay == nullptr) {
+        return false;
+    }
+    callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y, VIEW_DISTANCE_TO_LEFT_SIDE,
+        TITLE_LABEL_DEFAULT_HEIGHT);
+    callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+
+    char name_buf[NAME_LEN+1]={0};
+    if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL))
+    {
+        callerDisplay->SetText(name_buf);
+    }
+    else
+    {
+       callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+    }
+    // if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourcePhone)
+    updataCallingname();
+
+    callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER);
+    callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
+    callerDisplay->SetTextColor(Color::White());
+    callerDisplay->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
+    group->Add(callerDisplay);
+
+    if (label_call_hint == nullptr) {
+        label_call_hint = new UILabelExt();
+    }
+
+    label_call_hint->SetPosition(133, 353);         // widget's left position and top position
+    label_call_hint->Resize(200, 35);          // widget's width and height
+    label_call_hint->SetViewId("label3");// Set style
+    label_call_hint->SetStyle(STYLE_TEXT_FONT, 30);
+
+    // Set additional property
+    // label_call_hint->SetText("挂断/接听");
+    label_call_hint->SetTextId(STR_HANG_UP_OR_ANSWER);
+    
+    label_call_hint->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+    label_call_hint->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff));
+    label_call_hint->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    label_call_hint->SetRollSpeed(0);
+    label_call_hint->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+    group->Add(label_call_hint);
+
+
+    if (label_call_source == nullptr) {
+        label_call_source = new UILabelExt();
+    }
+    label_call_source->SetPosition(133, 34);         // widget's left position and top position
+    label_call_source->Resize(200, 60);          // widget's width and height
+    label_call_source->SetViewId("label1");// Set style
+    label_call_source->SetStyle(STYLE_TEXT_FONT, 30);
+
+    // Set additional property
+    if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) 
+    {   
+        // label_call_source->SetText("手表来电");
+        label_call_source->SetTextId(STR_WATCH_CALL);
+    }
+    else
+    {
+        // label_call_source->SetText("手机来电");
+        label_call_source->SetTextId(STR_PHONE_CALL);
+    }
+   
+    
+    label_call_source->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+    label_call_source->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff));
+    label_call_source->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    label_call_source->SetRollSpeed(0);
+    label_call_source->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+    group->Add(label_call_source);
+
+    return true;
+
+}
 }
\ No newline at end of file