From: luozheng <1732036298@qq.com> Date: Tue, 23 Apr 2024 07:12:52 +0000 (+0800) Subject: VoLTE,移动数据按钮增加点击监听 X-Git-Tag: release_V1.2.70_20241020_135402~1025^2~80 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=fce1d62767fc8f0907d0ed513f00c974a9896cc8;p=mirrors%2FFD230.git VoLTE,移动数据按钮增加点击监听 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallPresenter.h index 930f37e08..2524b1eef 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 09:59:18 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-23 11:26:26 + * @LastEditTime: 2024-04-23 14:44:56 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallPresenter.h */ diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h index 0701d825f..b96e62785 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 09:57:53 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-23 11:25:36 + * @LastEditTime: 2024-04-23 14:51:33 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h */ @@ -25,6 +25,8 @@ namespace OHOS NetworkAndCallView(); virtual ~NetworkAndCallView(); static NetworkAndCallView *GetInstance(void); + UIToggleButton *GetVoLTEToggleButton(void); + UIToggleButton *GetMobileDataToggleButton(void); void OnStart() override; void OnSetUpView() override; diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp index 2bad7b454..b1a83a70c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 09:59:32 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-23 11:27:53 + * @LastEditTime: 2024-04-23 15:05:02 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp */ #include "AppViewIDs.h" @@ -10,6 +10,8 @@ #include "networkandcall/include/NetworkAndCallPresenter.h" #include "common/key_code.h" #include +#include "networkandcall/include/NetworkAndCallView.h" + namespace OHOS { @@ -53,6 +55,37 @@ namespace OHOS bool NetworkAndCallPresenter::OnClick(UIView &view, const ClickEvent &event) { + UNUSED(event); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NetworkAndCallPresenter::OnClick"); + NetworkAndCallView *p_NetworkAndCallView = NetworkAndCallView::GetInstance(); + if (p_NetworkAndCallView == nullptr) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NetworkAndCallView::GetInstance fail!!"); + return false; + } + + if (&view == p_NetworkAndCallView->GetVoLTEToggleButton()) // 如果点击的是VOLTE按钮 + { + if (p_NetworkAndCallView->GetVoLTEToggleButton()->GetState() == true) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoLTE is enable!"); + } + else + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoLTE is disable!"); + } + } + else if (&view == p_NetworkAndCallView->GetMobileDataToggleButton()) // 如果点击的是移动数据按钮 + { + if (p_NetworkAndCallView->GetMobileDataToggleButton()->GetState() == true) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MobileData is enable!"); + } + else + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MobileData is disable!"); + } + } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp index 7808f65b7..4783f70bd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp @@ -31,7 +31,7 @@ namespace OHOS if (NetworkAndCallScrollView != nullptr) { NetworkAndCallScrollView->RemoveAll(); - + delete Title; Title = nullptr; @@ -123,7 +123,7 @@ namespace OHOS NetworkAndCallLabel[i]->SetStyle(STYLE_LINE_HEIGHT, 35); NetworkAndCallLabel[i]->SetText(text[i]); NetworkAndCallLabel[i]->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); - NetworkAndCallLabel[i]->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + // NetworkAndCallLabel[i]->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); NetworkAndCallLabel[i]->SetRollSpeed(40); NetworkAndCallLabel[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); } @@ -149,6 +149,10 @@ namespace OHOS MobileData_toggleButton->SetPosition(298, 265, 100, 50); MobileData_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); MobileData_toggleButton->SetImages(selectedImg, unSelectedImg); + /* ----------------------------- onclickListener ---------------------------- */ + UIView::OnClickListener *toggleButtonClick = static_cast(NetworkAndCallPresenter::GetInstance()); + VoLTE_toggleButton->SetOnClickListener(toggleButtonClick); + MobileData_toggleButton->SetOnClickListener(toggleButtonClick); /* -------------------------------------------------------------------------- */ NextImage = new UIImageView(); if (NextImage == nullptr) @@ -201,4 +205,16 @@ namespace OHOS RootView::GetInstance()->ClearOnKeyActListener(); return; } + + //获取VOLTE button + UIToggleButton * NetworkAndCallView::GetVoLTEToggleButton(void) + { + return VoLTE_toggleButton; + } + + //获取移动数据 button + UIToggleButton * NetworkAndCallView::GetMobileDataToggleButton(void) + { + return MobileData_toggleButton; + } } \ No newline at end of file