From 4d7534cfc3b1f46ad8a43e9780083844b22133b0 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Wed, 14 Jan 2026 11:41:55 +0800 Subject: [PATCH] =?utf8?q?=E7=94=B5=E8=AF=9D=E8=A7=A3=E5=86=B3=E5=B1=8F?= =?utf8?q?=E8=94=BD4G=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../phone/include/DialingMethodPresenter.h | 1 + .../phone/include/MainPhonePresenter.h | 1 + .../nativeui/phone/include/MainPhoneView.h | 2 +- .../phone/src/DialingMethodPresenter.cpp | 5 +++ .../nativeui/phone/src/DialingMethodView.cpp | 6 ++-- .../nativeui/phone/src/MainPhonePresenter.cpp | 7 +++- .../nativeui/phone/src/MainPhoneView.cpp | 32 +++++++++---------- 7 files changed, 34 insertions(+), 20 deletions(-) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/DialingMethodPresenter.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/DialingMethodPresenter.h index e6d7a51ad..709b795ee 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/DialingMethodPresenter.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/DialingMethodPresenter.h @@ -26,6 +26,7 @@ namespace OHOS virtual ~DialingMethodPresenter(); void OnStart() override; + void OnResume() override; static DialingMethodPresenter *GetInstance(); private: diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhonePresenter.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhonePresenter.h index bd64969cb..77a007858 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhonePresenter.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhonePresenter.h @@ -30,6 +30,7 @@ namespace OHOS virtual ~MainPhonePresenter(); void OnStart() override; + void OnResume() override; static MainPhonePresenter *GetInstance(); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhoneView.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhoneView.h index c96f521d6..252bbc1fd 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhoneView.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/include/MainPhoneView.h @@ -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}; // 暂无通话 diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp index a20992c53..261b5ac9e 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp @@ -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"); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodView.cpp index 086433ab2..49aa675be 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/DialingMethodView.cpp @@ -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, diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhonePresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhonePresenter.cpp index dde55b50a..62784557d 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhonePresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhonePresenter.cpp @@ -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) { diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhoneView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhoneView.cpp index 29dd1f133..1924429a5 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhoneView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/phone/src/MainPhoneView.cpp @@ -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(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::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); -- 2.17.1