From bd8f939e72f2485f4fc9f73631a76fa7ad04c132 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Sat, 7 Mar 2026 16:01:26 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E5=93=84=E7=9D=A1=E5=AD=97?= =?utf8?q?=E5=B9=95=E6=98=BE=E7=A4=BA=E5=8C=BA=E5=9F=9F=E5=BC=82=E5=B8=B8b?= =?utf8?q?ug=EF=BC=88=F0=9F=99=85=E8=A1=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../thunderbird/include/ThunderBirdMainView.h | 2 ++ .../thunderbird/src/ThunderBirdMainView.cpp | 33 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h index 6e60cb370..871231305 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h @@ -64,6 +64,8 @@ namespace OHOS void ChangeView(int16_t hideView, int16_t showView, int16_t subView = -1); /** 将指定 view 的 group 置于 ScrollView 最上层,避免被其他 group 遮挡(如对话界面按音量键时音量条被 RemindButton 盖住) */ void BringGroupToFront(int16_t viewId); + /** 刷新指定 view 的 group 和 ScrollView(用于同 view 切 subView 后下一帧再刷一次,解决偶现不刷新) */ + void InvalidateGroupAndScroll(int16_t viewId); int16_t GetPrevViewId() const { return prevView_; } int16_t GetPrevSubViewId() const { return prevSubView_; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp index 3d24679b0..3a6694ab5 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp @@ -1069,6 +1069,19 @@ namespace OHOS ScrollView_->Add(group[viewId]); } + void ThunderBirdMainView::InvalidateGroupAndScroll(int16_t viewId) + { + if (viewId < 0 || viewId >= MAXVIEW) { + return; + } + if (group[viewId] != nullptr) { + group[viewId]->Invalidate(); + } + if (ScrollView_ != nullptr) { + ScrollView_->Invalidate(); + } + } + bool ThunderBirdMainView::ChangeThunderBirdAdjustView(int16_t thisView) // 切换调整界面接口 { if (group[thisView] == nullptr) @@ -1296,7 +1309,10 @@ namespace OHOS default: break; } - group[hideView]->SetVisible(false); + // 同 view 仅切 subView 时不隐藏 group,避免偶现“组件不刷新”;只做子视图 Show 和 Invalidate + if (hideView != showView) { + group[hideView]->SetVisible(false); + } } // 同用遮罩,部分界面在内部自行开启,其余界面关闭 if(GetIsOpenScreenImageModel() == false) @@ -1358,7 +1374,21 @@ namespace OHOS } currentView_ = showView; // 更新当前视图 currentSubView_ = subView; // 更新当前子视图 + // 显式刷新当前 group,避免同 view 切 subView 时偶现组件不刷新(仅 ScrollView_ Invalidate 可能不触发子 group 重绘) + if (group[showView] != nullptr) { + group[showView]->Invalidate(); + } ScrollView_->Invalidate(); + // 同 view 仅切 subView 时,下一帧再刷一次;息屏再亮屏会恢复说明是首帧绘制未触发,延迟一帧 Invalidate 可复现“亮屏重绘”效果 + if (hideView == showView && subView != -1) { + int16_t capView = showView; + GraphicService::GetInstance()->PostGraphicEvent([capView]() { + ThunderBirdMainView* mv = ThunderBirdMainView::GetInstance(); + if (mv != nullptr) { + mv->InvalidateGroupAndScroll(capView); + } + }); + } } void ThunderBirdMainView::OpenBackGround(void)//打开遮罩 @@ -1366,6 +1396,7 @@ namespace OHOS if(iconView->IsVisible() == false) { iconView->SetVisible(true); + iconView->Invalidate(); } if(backGroundView->IsVisible() == false) { -- 2.17.1