From: luozheng <1732036298@qq.com> Date: Sat, 14 Sep 2024 07:54:11 +0000 (+0800) Subject: 4G界面添加“注:启用4G,可能会加速消耗电量”提醒 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=17161700dfbaab0741327e39c5e8d28b1abc8b05;p=mirrors%2FFD230.git 4G界面添加“注:启用4G,可能会加速消耗电量”提醒 --- 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 9fa161cb9..30db15352 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 09:57:53 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-08-24 06:05:58 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-09-14 14:30:20 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallView.h */ @@ -67,6 +67,7 @@ namespace OHOS UILabelExt *NetworkAndCallLabel[ITEM_NUM]{nullptr}; UIToggleButton *VoLTE_toggleButton{nullptr}; // VoLTE通话开关 UIToggleButton *MobileData_toggleButton{nullptr}; // 移动数据开关 + UILabelExt *note{nullptr}; // UIImageView *NextImage{nullptr}; }; } 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 94530d17c..9b2ac3a69 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp @@ -62,8 +62,11 @@ namespace OHOS MobileData_toggleButton = nullptr; } - // delete NextImage; - // NextImage = nullptr; + if (note != nullptr) + { + delete note; + note = nullptr; + } delete NetworkAndCallScrollView[NETWORKANDCALLVIEW]; NetworkAndCallScrollView[NETWORKANDCALLVIEW] = nullptr; @@ -80,10 +83,11 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::NetworkAndCallScrollView[NETWORKANDCALLVIEW] new fail!"); return; } - NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()-30); NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetOnDragListener(presenter_); NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetReboundSize(35); - NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetHorizontalScrollState(false); + NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetScrollBlankSize(30); + // NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetHorizontalScrollState(false); NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetTouchable(true); NetworkAndCallScrollView[NETWORKANDCALLVIEW]->SetDraggable(true); /* ---------------------------------- Title --------------------------------- */ @@ -134,6 +138,22 @@ namespace OHOS NetworkAndCallLabel[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); } /* -------------------------------------------------------------------------- */ +#if defined(SUPPORT_CHINA_MOBILE_DMP) + if (VoLTE_toggleButton == nullptr) + { + VoLTE_toggleButton = new UIToggleButton(); + if (VoLTE_toggleButton == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::VoLTE_toggleButton is nullptr!"); + return; + } + } + VoLTE_toggleButton->SetPosition(298, 145, 100, 50); + VoLTE_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + VoLTE_toggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE); + VoLTE_toggleButton->SetOnClickListener(presenter_); +#endif + /* --------------------------------- 移动数据开关 --------------------------------- */ if (MobileData_toggleButton == nullptr) { MobileData_toggleButton = new UIToggleButton(); @@ -143,37 +163,43 @@ namespace OHOS return; } } - MobileData_toggleButton->SetPosition(298, 145, 100, 50); + if (VoLTE_toggleButton != nullptr) + { + MobileData_toggleButton->SetPosition(298, VoLTE_toggleButton->GetY() + 120, 100, 50); + } + else + { + MobileData_toggleButton->SetPosition(298, 145, 100, 50); + } MobileData_toggleButton->SetState(uapi_cat1_get_power_stat()); MobileData_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); MobileData_toggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE); MobileData_toggleButton->SetOnClickListener(presenter_); -/* -------------------------------------------------------------------------- */ -#if defined(SUPPORT_CHINA_MOBILE_DMP) - if (VoLTE_toggleButton == nullptr) + /* -------------------------------------------------------------------------- */ + if (note == nullptr) { - VoLTE_toggleButton = new UIToggleButton(); - if (VoLTE_toggleButton == nullptr) + note = new UILabelExt(); // Create a new UILabel for each iteration + if (note == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::VoLTE_toggleButton is nullptr!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "note is nullptr!"); return; } } - VoLTE_toggleButton->SetPosition(298, 265, 100, 50); - VoLTE_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); - VoLTE_toggleButton->SetState(MobileData_toggleButton->GetState() == true && ConfigModel::GetInstance()->GetVoLTE_Call()); - VoLTE_toggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE); - VoLTE_toggleButton->SetOnClickListener(presenter_); -#endif - /* -------------------------------------------------------------------------- */ - // NextImage = new UIImageView(); - // if (NextImage == nullptr) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::NextImage is nullptr!"); - // return; - // } - // NextImage->SetPosition(369, 397); - // NextImage->SetSrc(PNG_SETTING_NEXT_IMAGE); + if (VoLTE_toggleButton != nullptr) + { + note->SetPosition(63, NetworkAndCallImage[1]->GetY() + NetworkAndCallImage[1]->GetHeight() + 20, 340, 80); + } + else + { + note->SetPosition(63, NetworkAndCallImage[0]->GetY() + NetworkAndCallImage[0]->GetHeight() + 20, 340, 80); + } + note->SetStyle(STYLE_TEXT_FONT, 26); + note->SetStyle(STYLE_LINE_HEIGHT, 40); + note->SetText("注:启用4G,可能会加速消耗电量"); + note->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); + note->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + note->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); + note->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); } } @@ -194,10 +220,14 @@ namespace OHOS NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(NetworkAndCallLabel[i]); } #if defined(SUPPORT_CHINA_MOBILE_DMP) + if (MobileData_toggleButton != nullptr) + { + VoLTE_toggleButton->SetState(MobileData_toggleButton->GetState() == true && ConfigModel::GetInstance()->GetVoLTE_Call()); + } NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(VoLTE_toggleButton); #endif NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(MobileData_toggleButton); - // NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(NextImage); + NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(note); RootView::GetInstance()->Add(NetworkAndCallScrollView[NETWORKANDCALLVIEW]); Draw(); }