From 1126b57bd194d24d1951274af66ca49b314c5446 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sat, 26 Oct 2024 15:02:27 +0800 Subject: [PATCH] =?utf8?q?=E6=81=A2=E5=A4=8D=E5=87=BA=E5=8E=82=E8=AE=BE?= =?utf8?q?=E7=BD=AE=E8=A7=86=E5=9B=BE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/FactoryResetView.h | 3 +- .../src/FactoryResetView.cpp | 27 ++++++++++++++-- .../system/include/SystemFactoryResetView.h | 3 +- .../system/src/SystemFactoryResetView.cpp | 32 +++++++++++++++---- 4 files changed, 55 insertions(+), 10 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h index 7663dcf56..1e514d577 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-20 14:12:16 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-22 09:33:26 + * @LastEditTime: 2024-10-26 14:51:09 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetVIew.h * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -43,6 +43,7 @@ namespace OHOS UILabelExt *FactoryResetNote{nullptr}; UIButton *FactoryResetButtonCheckOn{nullptr}; // 重置确认 UIButton *FactoryResetButtonCheckOff{nullptr}; // 重置否定 + UIImageView *temp{nullptr}; bool initViewStatus{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp index 8fbdb4d74..f13850f8a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp @@ -62,6 +62,11 @@ namespace OHOS delete FactoryResetButtonCheckOff; FactoryResetButtonCheckOff = nullptr; } + if (temp != nullptr) + { + delete temp; + temp = nullptr; + } group->Remove(scrollView); delete scrollView; scrollView = nullptr; @@ -104,8 +109,8 @@ namespace OHOS } scrollView->SetPosition(0, 0, 466, 466); scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - scrollView->SetScrollBlankSize(50); - scrollView->SetReboundSize(35); + // scrollView->SetScrollBlankSize(30); + // scrollView->SetReboundSize(30); scrollView->SetMaxScrollDistance(1000); scrollView->SetThrowDrag(true); scrollView->RequestFocus(); @@ -193,6 +198,24 @@ namespace OHOS return nullptr; } FactoryResetButtonCheckOn->SetOnClickListener(FactoryResetButtonCheckOnClick); + /* -------------------------------------------------------------------------- */ + if ((FactoryResetButtonCheckOn->GetY() + FactoryResetButtonCheckOn->GetHeight() > Screen::GetInstance().GetHeight())) + { + if (temp == nullptr) + { + temp = new UIImageView(); + if (temp == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemFactoryResetView::new temp fail!"); + return nullptr; + } + temp->SetPosition(43, FactoryResetButtonCheckOn->GetY() + FactoryResetButtonCheckOn->GetHeight(), 380, 40); + temp->SetVisible(false); + scrollView->Add(temp); + scrollView->SetScrollBlankSize(30); + scrollView->SetReboundSize(30); + } + } /* ----------------------------- Add to scroView ---------------------------- */ scrollView->Add(Title); diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemFactoryResetView.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemFactoryResetView.h index 9a6d0d9d3..7b1c93a2f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemFactoryResetView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemFactoryResetView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-01-29 15:37:44 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-05-07 09:39:01 + * @LastEditTime: 2024-10-26 11:47:49 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemFactoryResetView.h */ #ifndef SYSTEM_FACTORYRESET_VIEW_H @@ -35,6 +35,7 @@ namespace OHOS UILabelExt *FactoryResetNote{nullptr}; UIButton *FactoryResetButtonCheckOn{nullptr}; // 重置确认 UIButton *FactoryResetButtonCheckOff{nullptr}; // 重置否定 + UIImageView *temp{nullptr}; bool initViewStatus{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemFactoryResetView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemFactoryResetView.cpp index 47e63d3a3..cfbe5c79a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemFactoryResetView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemFactoryResetView.cpp @@ -48,6 +48,9 @@ namespace OHOS delete FactoryResetButtonCheckOff; FactoryResetButtonCheckOff = nullptr; + delete temp; + temp = nullptr; + delete scrollView; scrollView = nullptr; } @@ -64,8 +67,8 @@ namespace OHOS scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); scrollView->SetStyle(STYLE_BORDER_RADIUS, 100); - scrollView->SetScrollBlankSize(50); - scrollView->SetReboundSize(35); + // scrollView->SetScrollBlankSize(30); + // scrollView->SetReboundSize(30); scrollView->SetMaxScrollDistance(1000); scrollView->SetThrowDrag(true); scrollView->RequestFocus(); @@ -87,7 +90,7 @@ namespace OHOS Title->SetPosition(83, 52, 300, 35); Title->SetStyle(STYLE_TEXT_FONT, 30); Title->SetStyle(STYLE_LINE_HEIGHT, 35); - Title->SetTextId(STR_FACTORY_RESET);/*恢复出厂*/ + Title->SetTextId(STR_FACTORY_RESET); /*恢复出厂*/ Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); Title->SetRollSpeed(70); Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); @@ -132,7 +135,7 @@ namespace OHOS FactoryResetButtonCheckOff->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); FactoryResetButtonCheckOff->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, PNG_SYSTEM_CHECK_OFF_IMAGE); UIView::OnClickListener *FactoryResetButtonCheckOffClick = static_cast(SystemPresenter::GetInstance()); - if(FactoryResetButtonCheckOffClick == nullptr) + if (FactoryResetButtonCheckOffClick == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemFactoryResetView::FactoryResetButtonCheckOffClick is nullptr!"); return nullptr; @@ -154,13 +157,30 @@ namespace OHOS FactoryResetButtonCheckOn->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); FactoryResetButtonCheckOn->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, PNG_SYSTEM_CHECK_ON_IMAGE); UIView::OnClickListener *FactoryResetButtonCheckOnClick = static_cast(SystemPresenter::GetInstance()); - if(FactoryResetButtonCheckOnClick == nullptr) + if (FactoryResetButtonCheckOnClick == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemFactoryResetView::FactoryResetButtonCheckOnClick is nullptr!"); return nullptr; } FactoryResetButtonCheckOn->SetOnClickListener(FactoryResetButtonCheckOnClick); - + /* -------------------------------------------------------------------------- */ + if ((FactoryResetButtonCheckOn->GetY() + FactoryResetButtonCheckOn->GetHeight() > Screen::GetInstance().GetHeight())) + { + if (temp == nullptr) + { + temp = new UIImageView(); + if (temp == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemFactoryResetView::new temp fail!"); + return nullptr; + } + temp->SetPosition(43, FactoryResetButtonCheckOn->GetY() + FactoryResetButtonCheckOn->GetHeight(), 380, 40); + temp->SetVisible(false); + scrollView->Add(temp); + scrollView->SetScrollBlankSize(30); + scrollView->SetReboundSize(30); + } + } /* ----------------------------- Add to scroView ---------------------------- */ scrollView->Add(Title); scrollView->Add(FactoryResetImage); -- 2.17.1