电话解决屏蔽4G相关代码 3082/target/2 3086/1 3086/head 3087/target/1
authorluozheng <1732036298@qq.com>
Wed, 14 Jan 2026 03:41:55 +0000 (11:41 +0800)
committerluozheng <1732036298@qq.com>
Wed, 14 Jan 2026 03:41:55 +0000 (11:41 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/DialingMethodPresenter.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhonePresenter.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhoneView.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodView.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhonePresenter.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhoneView.cpp

index e6d7a51..709b795 100644 (file)
@@ -26,6 +26,7 @@ namespace OHOS
         virtual ~DialingMethodPresenter();
 
         void OnStart() override;
+        void OnResume() override;
         static DialingMethodPresenter *GetInstance();
 
     private:
index bd64969..77a0078 100644 (file)
@@ -30,6 +30,7 @@ namespace OHOS
         virtual ~MainPhonePresenter();
 
         void OnStart() override;
+        void OnResume() override;
         
         static MainPhonePresenter *GetInstance();
 
index c96f521..252bbc1 100644 (file)
@@ -81,7 +81,7 @@ namespace OHOS
         UIScrollView *MainPhoneViewScrollView{nullptr};
         UILabelExt *MainPhoneViewTitleLabel{nullptr}; // 标题
         UIButton *DialingMethodButton{nullptr};       // 拨号方式
-        UIButton *FrequentlyContactedButton{nullptr}; // 常用联系人
+        // UIButton *FrequentlyContactedButton{nullptr}; // 常用联系人
         UILabelExt *RecentCallLabel{nullptr};         //"最近通话"
         UIImageView *TelephoneLineImageView{nullptr}; // 线
         UILabelExt *NoCallsLabel{nullptr};            // 暂无通话
index a20992c..261b5ac 100644 (file)
@@ -49,6 +49,11 @@ namespace OHOS
     {
     }
 
+    void DialingMethodPresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
+
     bool DialingMethodPresenter::OnClick(UIView &view, const ClickEvent &event)
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingMethodPresenter::OnClick");
index 086433a..49aa675 100644 (file)
@@ -736,10 +736,11 @@ namespace OHOS
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::UsingWatchSimButton new fail!");
                 return;
             }
+            UsingWatchSimButton->SetVisible(false);
             /* ------------------------ UsingPhoneButton ----------------------- */
             buttonParam = {
                 .x = 43,
-                .y = 240,
+                .y = 120,
                 .width = 380,
                 .height = 100,
                 .viewId = USINGPHONEBUTTON_VIEWID,
@@ -780,10 +781,11 @@ namespace OHOS
                 return;
             }
             UsingWatchSimLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            UsingWatchSimLabel->SetVisible(false);
             /* --------------------------- UsingPhoneLabel --------------------------- */
             labelParam = {
                 .x = 83,
-                .y = 273,
+                .y = 153,
                 .width = 300,
                 .height = 35,
                 .fontSize = 30,
index dde55b5..6278455 100644 (file)
@@ -51,6 +51,11 @@ namespace OHOS
     void MainPhonePresenter::OnStart()
     {
     }
+    
+    void MainPhonePresenter::OnResume()
+    {
+        RootView::GetInstance()->SetOnKeyActListener(this);
+    }
 
     static uint8_t MainPhonePresenter_atoi(const char* buf)
     {
@@ -78,7 +83,7 @@ namespace OHOS
         else if (curViewId == FREQUENTLYCONTACTEDBUTTON_VIEWID)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s OnClick", curViewId.c_str());
-            NativeAbility::GetInstance().EnterSlice(VIEW_PHONEDIR);
+            // NativeAbility::GetInstance().EnterSlice(VIEW_PHONEDIR);
         }
         else if (curViewId==DELETE_ALL_VIEWID)
         {
index 29dd1f1..1924429 100644 (file)
@@ -80,8 +80,8 @@ namespace OHOS
             delete DialingMethodButton;
             DialingMethodButton = nullptr;
 
-            delete FrequentlyContactedButton;
-            FrequentlyContactedButton = nullptr;
+            // delete FrequentlyContactedButton;
+            // FrequentlyContactedButton = nullptr;
 
             delete RecentCallLabel;
             RecentCallLabel = nullptr;
@@ -591,17 +591,18 @@ namespace OHOS
             }
             DialingMethodButton->SetImagePosition(46, 46);
             DialingMethodButton->SetImageSrc(PNG_DIALINGMETHODBUTTON_IMAGE, PNG_DIALINGMETHODBUTTON_IMAGE);
+            DialingMethodButton->SetX((466-DialingMethodButton->GetWidth())/2);
             /* ------------------------ FrequentlyContactedButton ----------------------- */
-            buttonParam.x = 263;
-            buttonParam.viewId = FREQUENTLYCONTACTEDBUTTON_VIEWID;
-            FrequentlyContactedButton = TelephonyInitInterface::ButtonViewInit(buttonParam);
-            if (FrequentlyContactedButton == nullptr)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::FrequentlyContactedButton new fail!");
-                return;
-            }
-            FrequentlyContactedButton->SetImagePosition(46, 46);
-            FrequentlyContactedButton->SetImageSrc(PNG_FREQUENTLYCONTACTEDBUTTON_IMAGE, PNG_FREQUENTLYCONTACTEDBUTTON_IMAGE);
+            // buttonParam.x = 263;
+            // buttonParam.viewId = FREQUENTLYCONTACTEDBUTTON_VIEWID;
+            // FrequentlyContactedButton = TelephonyInitInterface::ButtonViewInit(buttonParam);
+            // if (FrequentlyContactedButton == nullptr)
+            // {
+            //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::FrequentlyContactedButton new fail!");
+            //     return;
+            // }
+            // FrequentlyContactedButton->SetImagePosition(46, 46);
+            // FrequentlyContactedButton->SetImageSrc(PNG_FREQUENTLYCONTACTEDBUTTON_IMAGE, PNG_FREQUENTLYCONTACTEDBUTTON_IMAGE);
             /* --------------------------- ButtonOnclickListen -------------------------- */
             UIView::OnClickListener *ButtonOnclickListen = static_cast<UIView::OnClickListener *>(MainPhonePresenter::GetInstance());
             if (ButtonOnclickListen == nullptr)
@@ -610,7 +611,7 @@ namespace OHOS
                 return;
             }
             DialingMethodButton->SetOnClickListener(ButtonOnclickListen);
-            FrequentlyContactedButton->SetOnClickListener(ButtonOnclickListen);
+            // FrequentlyContactedButton->SetOnClickListener(ButtonOnclickListen);
             /* ----------------------------- RecentCallLabel ---------------------------- */
             labelParam = {
                 .x = 83,
@@ -645,7 +646,7 @@ namespace OHOS
 
             MainPhoneViewScrollView->Add(MainPhoneViewTitleLabel);
             MainPhoneViewScrollView->Add(DialingMethodButton);
-            MainPhoneViewScrollView->Add(FrequentlyContactedButton);
+            // MainPhoneViewScrollView->Add(FrequentlyContactedButton);
             MainPhoneViewScrollView->Add(RecentCallLabel);
             MainPhoneViewScrollView->Add(TelephoneLineImageView);
 
@@ -744,11 +745,10 @@ namespace OHOS
 
     void MainPhoneView::OnStart()
     {
-        View<MainPhonePresenter>::OnStart();
         MainPhoneViewInit();
         // 增加按键监听
         RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainPhonePresenter::GetInstance();
-       RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+        RootView::GetInstance()->SetOnKeyActListener(keyactListener);
         AddViewToRootContainer(MainPhoneViewScrollView);
         if(delete_log_view)
         AddViewToRootContainer(delete_log_view);