!48556 修复调整系统字体大小后跑马灯不运行

Merge pull request !48556 from LuckClover/MarqueeNot
This commit is contained in:
openharmony_ci 2024-11-15 11:54:02 +00:00 committed by Gitee
commit 3493d149b2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 62 additions and 19 deletions

View File

@ -704,4 +704,25 @@ void MarqueePattern::ResumeAnimation()
playStatus_ = true;
AnimationUtils::ResumeAnimation(animation_);
}
void MarqueePattern::OnFontScaleConfigurationUpdate()
{
if (!AnimationUtils::IsImplicitAnimationOpen()) {
return;
}
auto host = GetHost();
CHECK_NULL_VOID(host);
auto pipeline = host->GetContext();
CHECK_NULL_VOID(pipeline);
pipeline->AddAfterReloadAnimationTask([weak = WeakClaim(this)]() {
auto pattern = weak.Upgrade();
CHECK_NULL_VOID(pattern);
auto host = pattern->GetHost();
CHECK_NULL_VOID(host);
auto paintProperty = host->GetPaintProperty<MarqueePaintProperty>();
CHECK_NULL_VOID(paintProperty);
auto playStatus = paintProperty->GetPlayerStatus().value_or(false);
pattern->StopMarqueeAnimation(playStatus);
});
}
} // namespace OHOS::Ace::NG

View File

@ -92,6 +92,7 @@ public:
frameRateRange_[type] = rateRange;
}
TextDirection GetTextDirection(const std::string& content, TextDirection direction);
void OnFontScaleConfigurationUpdate() override;
protected:
void OnDetachFromFrameNode(FrameNode* frameNode) override;

View File

@ -3918,26 +3918,33 @@ void PipelineContext::FlushReload(const ConfigurationChange& configurationChange
option.SetDuration(duration);
option.SetCurve(Curves::FRICTION);
RecycleManager::Notify(configurationChange);
AnimationUtils::Animate(option, [weak = WeakClaim(this), configurationChange,
weakOverlayManager = AceType::WeakClaim(AceType::RawPtr(overlayManager_)), fullUpdate]() {
auto pipeline = weak.Upgrade();
CHECK_NULL_VOID(pipeline);
if (configurationChange.IsNeedUpdate()) {
auto rootNode = pipeline->GetRootElement();
rootNode->UpdateConfigurationUpdate(configurationChange);
auto overlay = weakOverlayManager.Upgrade();
if (overlay) {
overlay->ReloadBuilderNodeConfig();
AnimationUtils::Animate(
option,
[weak = WeakClaim(this), configurationChange,
weakOverlayManager = AceType::WeakClaim(AceType::RawPtr(overlayManager_)), fullUpdate]() {
auto pipeline = weak.Upgrade();
CHECK_NULL_VOID(pipeline);
if (configurationChange.IsNeedUpdate()) {
auto rootNode = pipeline->GetRootElement();
rootNode->UpdateConfigurationUpdate(configurationChange);
auto overlay = weakOverlayManager.Upgrade();
if (overlay) {
overlay->ReloadBuilderNodeConfig();
}
}
}
if (fullUpdate) {
CHECK_NULL_VOID(pipeline->stageManager_);
pipeline->SetIsReloading(true);
pipeline->stageManager_->ReloadStage();
pipeline->SetIsReloading(false);
pipeline->FlushUITasks();
}
});
if (fullUpdate) {
CHECK_NULL_VOID(pipeline->stageManager_);
pipeline->SetIsReloading(true);
pipeline->stageManager_->ReloadStage();
pipeline->SetIsReloading(false);
pipeline->FlushUITasks();
}
},
[weak = WeakClaim(this)]() {
auto pipeline = weak.Upgrade();
CHECK_NULL_VOID(pipeline);
pipeline->OnFlushReloadFinish();
});
auto stage = stageManager_->GetStageNode();
CHECK_NULL_VOID(stage);
auto renderContext = stage->GetRenderContext();

View File

@ -540,6 +540,19 @@ public:
}
void FlushReload(const ConfigurationChange& configurationChange, bool fullUpdate = true) override;
void OnFlushReloadFinish()
{
auto tasks = std::move(afterReloadAnimationTasks_);
for (const auto& task : tasks) {
if (task) {
task();
}
}
}
void AddAfterReloadAnimationTask(std::function<void()>&& task)
{
afterReloadAnimationTasks_.emplace_back(std::move(task));
}
int32_t RegisterSurfaceChangedCallback(
std::function<void(int32_t, int32_t, int32_t, int32_t, WindowSizeChangeReason)>&& callback)
@ -1270,6 +1283,7 @@ private:
static std::unordered_set<int32_t> aliveInstanceSet_;
AxisEventChecker axisEventChecker_;
std::unordered_set<UINode*> attachedNodeSet_;
std::list<std::function<void()>> afterReloadAnimationTasks_;
friend class ScopedLayout;
};