电话单例修改
authorhcj <1224667075@qq.com>
Tue, 20 Aug 2024 07:58:05 +0000 (15:58 +0800)
committerhcj <1224667075@qq.com>
Tue, 20 Aug 2024 07:58:05 +0000 (15:58 +0800)
code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h
code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp

index 9845b3e..5e0db7b 100644 (file)
@@ -34,6 +34,7 @@ public:
     UIViewGroup *GetScreenGroup();
     UIViewGroup *GetWaitingGroup();
     CallingView *GetCallingView();
+    CallingView *GetScreenView();
 private:
     bool InitPointerValue();
     UIViewGroup *displayGroup{nullptr};
index c0490bb..a698d3a 100644 (file)
@@ -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;
 }
index 80a7277..bac2615 100644 (file)
@@ -63,6 +63,11 @@ CallingView *MainCallingView::GetCallingView()
     return callView;
 }
 
+CallingView *MainCallingView::GetScreenView()
+{
+    return screenView;
+}
+
 bool MainCallingView::InitPointerValue()
 {
     displayView = new CallerDisplayView();