From dcfd327c7371a482767116e321d293e33e675ee9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Tue, 20 Aug 2024 08:10:05 +0000 Subject: [PATCH] Merge #737 into sdk602patch0626 from refs/changes/737/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 胡传军 * refs/changes/737/head: (2 commits squashed) - 电话单例修改 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/737 --- .../makephone/include/MainCallingView.h | 1 + .../makephone/src/MainCallingPresenter.cpp | 75 +++++++++++++++---- .../makephone/src/MainCallingView.cpp | 5 ++ 3 files changed, 67 insertions(+), 14 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h index 9845b3e28..5e0db7b3a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h @@ -34,6 +34,7 @@ public: UIViewGroup *GetScreenGroup(); UIViewGroup *GetWaitingGroup(); CallingView *GetCallingView(); + CallingView *GetScreenView(); private: bool InitPointerValue(); UIViewGroup *displayGroup{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp index c0490bbdc..a698d3a2f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp @@ -299,55 +299,95 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) } else if ((strcmp(view.GetViewId(), "dial") == 0)) { - CallingView::GetInstance()->showdial(true); + if(view_->GetScreenGroup()->IsVisible()) + view_->GetScreenView()->showdial(true); + else + view_->GetCallingView()->showdial(true); } if (strcmp(view.GetViewId(), "0") == 0) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); /* code */ + 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) { - CallingView::GetInstance()->text_updata_buf(view.GetViewId()); + if(view_->GetScreenGroup()->IsVisible()) + view_->GetScreenView()->text_updata_buf(view.GetViewId()); + else + view_->GetCallingView()->text_updata_buf(view.GetViewId()); } @@ -360,8 +400,15 @@ bool MainCallingPresenter::OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter OnDragEnd"); if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { + if((strcmp(view.GetViewId(), "dialing") == 0)) - CallingView::GetInstance()->showdial(false); + { + if(view_->GetScreenGroup()->IsVisible()) + view_->GetScreenView()->showdial(false); + else + view_->GetCallingView()->showdial(false); + } + } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp index 80a727740..bac26155a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp @@ -63,6 +63,11 @@ CallingView *MainCallingView::GetCallingView() return callView; } +CallingView *MainCallingView::GetScreenView() +{ + return screenView; +} + bool MainCallingView::InitPointerValue() { displayView = new CallerDisplayView(); -- 2.17.1