!48076 kill frs后卡片中心卡片透明-DEV

Merge pull request !48076 from hui1015/master
This commit is contained in:
openharmony_ci 2024-11-11 14:25:08 +00:00 committed by Gitee
commit dc6422bcc5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 40 additions and 13 deletions

View File

@ -1347,6 +1347,11 @@ void FormPattern::FireFormSurfaceNodeCallback(
isTransparencyEnable_, isEnableSkeleton);
auto context = host->GetContext();
CHECK_NULL_VOID(context);
if (!ShouldDoSkeletonAnimation()) {
TAG_LOGE(AceLogTag::ACE_FORM, "not do skeleton animation");
SetExternalRenderOpacity(NON_TRANSPARENT_VAL);
return;
}
std::string nodeIdStr = std::to_string(host->GetId());
auto uiTaskExecutor = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::UI);
uiTaskExecutor.PostDelayedTask(
@ -1907,6 +1912,36 @@ void FormPattern::SetSkeletonEnableConfig(const RequestFormInfo &info)
}
}
void FormPattern::SetExternalRenderOpacity(double opacity)
{
auto externalRenderContext = DynamicCast<NG::RosenRenderContext>(GetExternalRenderContext());
CHECK_NULL_VOID(externalRenderContext);
externalRenderContext->SetOpacity(opacity);
}
bool FormPattern::ShouldDoSkeletonAnimation()
{
auto host = GetHost();
CHECK_NULL_RETURN(host, false);
std::list<RefPtr<UINode>> children = host->GetChildren();
if (children.size() <= 0) {
TAG_LOGE(AceLogTag::ACE_FORM, "Cur form component's children is empty.");
return false;
}
auto skeletonNode = GetFormChildNode(FormChildNodeType::FORM_SKELETON_NODE);
if (skeletonNode == nullptr) {
TAG_LOGE(AceLogTag::ACE_FORM, "Cur form component's has no skeleton.");
return false;
}
std::string lastChildTag = skeletonNode->GetTag();
if (lastChildTag != V2::COLUMN_ETS_TAG) {
TAG_LOGE(AceLogTag::ACE_FORM, "Cur form component's last child is not skeleton.");
return false;
}
return true;
}
void FormPattern::DoSkeletonAnimation()
{
ACE_FUNCTION_TRACE();
@ -1914,20 +1949,10 @@ void FormPattern::DoSkeletonAnimation()
ContainerScope scope(scopeId_);
auto host = GetHost();
CHECK_NULL_VOID(host);
std::list<RefPtr<UINode>> children = host->GetChildren();
if (children.size() <= 0) {
TAG_LOGE(AceLogTag::ACE_FORM, "Cur form component's children is empty.");
return;
}
auto skeletonNode = GetFormChildNode(FormChildNodeType::FORM_SKELETON_NODE);
if (skeletonNode == nullptr) {
TAG_LOGW(AceLogTag::ACE_FORM, "Cur form component's has no skeleton.");
return;
}
std::string lastChildTag = skeletonNode->GetTag();
if (lastChildTag != V2::COLUMN_ETS_TAG) {
TAG_LOGE(AceLogTag::ACE_FORM, "Cur form component's last child is not skeleton.");
if (!ShouldDoSkeletonAnimation()) {
TAG_LOGE(AceLogTag::ACE_FORM, "should not do skeleton anim");
SetExternalRenderOpacity(NON_TRANSPARENT_VAL);
return;
}

View File

@ -208,6 +208,8 @@ private:
int32_t dimensionHeight);
void SetTransparencyConfig(bool isTransparencyForm, const RequestFormInfo &info);
void SetSkeletonEnableConfig(const RequestFormInfo &info);
void SetExternalRenderOpacity(double opacity);
bool ShouldDoSkeletonAnimation();
void DoSkeletonAnimation();
void UpdateFormBaseConfig(bool isDynamic);
void AddFormChildNode(FormChildNodeType formChildNodeType, const RefPtr<FrameNode> child);