diff --git a/frameworks/base/subwindow/subwindow_manager.cpp b/frameworks/base/subwindow/subwindow_manager.cpp index f6b0ea5344eede52fda415d68716bfbbb595f3b1..33a80ec01df54dc1049924a4f076da8ed1997960 100644 --- a/frameworks/base/subwindow/subwindow_manager.cpp +++ b/frameworks/base/subwindow/subwindow_manager.cpp @@ -500,11 +500,25 @@ void SubwindowManager::ShowTipsNG(const RefPtr& targetNode, const overlayManager->UpdateTipsEnterAndLeaveInfoBool(targetId); auto duration = appearingTime; + overlayManager->UpdateTipsStartAnimation(targetId, true); if (overlayManager->TipsInfoListIsEmpty(targetId)) { - overlayManager->UpdateTipsStatus(targetId, false); + auto previewId = overlayManager->GetLastAnimationTipsTargetId(); + if ((previewId != -1) && (overlayManager->GetTipsExitAnimation(previewId))) { + overlayManager->HidePopupAnimation( + overlayManager->GetLastAnimationTipsPopupInfo().popupNode, nullptr, previewId, true); + overlayManager->UpdateAnimationTipsInfo(targetId, popupInfo); + overlayManager->UpdateTipsStartAnimationInfo(targetId, true); + overlayManager->UpdateTipsStatus(targetId, false); + } else { + overlayManager->UpdateTipsStartAnimationInfo(targetId, false); + overlayManager->UpdateAnimationTipsInfo(targetId, popupInfo); + overlayManager->UpdateTipsStatus(targetId, false); + } duration = appearingTime; } else { + overlayManager->UpdateAnimationTipsInfo(targetId, popupInfo); overlayManager->UpdateTipsStatus(targetId, true); + overlayManager->UpdateTipsStartAnimationInfo(targetId, true); overlayManager->UpdatePreviousDisappearingTime(targetId); duration = appearingTimeWithContinuousOperation; } diff --git a/frameworks/core/components_ng/pattern/bubble/bubble_pattern.cpp b/frameworks/core/components_ng/pattern/bubble/bubble_pattern.cpp index 7b126a9670cba7dc825c2129eb0565859a08f268..afc5cf9b13e1616e34340373d9ac1f085921db8d 100644 --- a/frameworks/core/components_ng/pattern/bubble/bubble_pattern.cpp +++ b/frameworks/core/components_ng/pattern/bubble/bubble_pattern.cpp @@ -35,6 +35,7 @@ constexpr float VISIABLE_ALPHA = 1.0f; constexpr float INVISIABLE_ALPHA = 0.0f; constexpr int32_t ENTRY_ANIMATION_DURATION = 250; constexpr int32_t EXIT_ANIMATION_DURATION = 100; +constexpr int32_t ENTRY_NOANIMATION_DURATION = 0; const Dimension INVISIABLE_OFFSET = 8.0_px; } // namespace @@ -396,19 +397,7 @@ void BubblePattern::PopBubble() CHECK_NULL_VOID(layoutProp); auto showInSubWindow = layoutProp->GetShowInSubWindow().value_or(false); auto isTips = layoutProp->GetIsTips().value_or(false); - if (showInSubWindow) { - if (isTips) { - SubwindowManager::GetInstance()->HideTipsNG(targetNodeId_, 0); - } else { - SubwindowManager::GetInstance()->HidePopupNG(targetNodeId_); - } - } else { - if (isTips) { - overlayManager->HideTips(targetNodeId_, popupInfo, 0); - } else { - overlayManager->HidePopup(targetNodeId_, popupInfo); - } - } + HidePopupOrTips(showInSubWindow, isTips, targetNodeId_, popupInfo); } void BubblePattern::PopTipsBubble() @@ -429,30 +418,43 @@ void BubblePattern::PopTipsBubble() CHECK_NULL_VOID(layoutProp); auto showInSubWindow = layoutProp->GetShowInSubWindow().value_or(false); auto isTips = layoutProp->GetIsTips().value_or(false); + HidePopupOrTips(showInSubWindow, isTips, targetNodeId_, popupInfo); +} + +RefPtr BubblePattern::GetPopupTheme() +{ + auto pipelineContext = PipelineBase::GetCurrentContext(); + CHECK_NULL_RETURN(pipelineContext, nullptr); + auto popupTheme = pipelineContext->GetTheme(); + CHECK_NULL_RETURN(popupTheme, nullptr); + return popupTheme; +} + +void BubblePattern::HidePopupOrTips(bool showInSubWindow, bool isTips, int targetNodeId_, const PopupInfo& popupInfo) +{ + auto host = GetHost(); + CHECK_NULL_VOID(host); + auto pipelineNg = host->GetContextRefPtr(); + CHECK_NULL_VOID(pipelineNg); + auto overlayManager = pipelineNg->GetOverlayManager(); + CHECK_NULL_VOID(overlayManager); if (showInSubWindow) { if (isTips) { SubwindowManager::GetInstance()->HideTipsNG(targetNodeId_, 0); + overlayManager->ClearTipsInfo(); } else { SubwindowManager::GetInstance()->HidePopupNG(targetNodeId_); } } else { if (isTips) { overlayManager->HideTips(targetNodeId_, popupInfo, 0); + overlayManager->ClearTipsInfo(); } else { overlayManager->HidePopup(targetNodeId_, popupInfo); } } } -RefPtr BubblePattern::GetPopupTheme() -{ - auto pipelineContext = PipelineBase::GetCurrentContext(); - CHECK_NULL_RETURN(pipelineContext, nullptr); - auto popupTheme = pipelineContext->GetTheme(); - CHECK_NULL_RETURN(popupTheme, nullptr); - return popupTheme; -} - void BubblePattern::Animation( RefPtr& renderContext, const Color& endColor, int32_t duration, const RefPtr& curve) { @@ -538,11 +540,12 @@ void BubblePattern::StartExitingTransitionEffects( }); } -void BubblePattern::StartEnteringAnimation(std::function finish) +void BubblePattern::StartEnteringAnimation(std::function finish, int32_t targetId, bool tipsFlag) { if (!arrowPlacement_.has_value()) { delayShow_ = true; finish_ = finish; + targetId_ = targetId; return; } if (IsOnShow()) { @@ -552,19 +555,29 @@ void BubblePattern::StartEnteringAnimation(std::function finish) if (transitionStatus_ == TransitionStatus::INVISIABLE) { ResetToInvisible(); } - - StartOffsetEnteringAnimation(); + auto host = GetHost(); + CHECK_NULL_VOID(host); + auto pipelineNg = host->GetContextRefPtr(); + CHECK_NULL_VOID(pipelineNg); + auto overlayManager = pipelineNg->GetOverlayManager(); + CHECK_NULL_VOID(overlayManager); + tipsFlag = overlayManager->GetTipsStartAnimationInfo(targetId_); + StartOffsetEnteringAnimation(tipsFlag); if (finish) { - StartAlphaEnteringAnimation(finish); + StartAlphaEnteringAnimation(finish, targetId_, tipsFlag); } else { - StartAlphaEnteringAnimation(finish_); + StartAlphaEnteringAnimation(finish_, targetId_, tipsFlag); } } -void BubblePattern::StartOffsetEnteringAnimation() +void BubblePattern::StartOffsetEnteringAnimation(bool tipsFlag) { AnimationOption optionPosition; - optionPosition.SetDuration(ENTRY_ANIMATION_DURATION); + if (tipsFlag) { + optionPosition.SetDuration(ENTRY_NOANIMATION_DURATION); + } else { + optionPosition.SetDuration(ENTRY_ANIMATION_DURATION); + } optionPosition.SetCurve(Curves::FRICTION); AnimationUtils::Animate( optionPosition, @@ -579,10 +592,14 @@ void BubblePattern::StartOffsetEnteringAnimation() nullptr); } -void BubblePattern::StartAlphaEnteringAnimation(std::function finish) +void BubblePattern::StartAlphaEnteringAnimation(std::function finish, int32_t targetId, bool tipsFlag) { AnimationOption optionAlpha; - optionAlpha.SetDuration(ENTRY_ANIMATION_DURATION); + if (tipsFlag) { + optionAlpha.SetDuration(ENTRY_NOANIMATION_DURATION); + } else { + optionAlpha.SetDuration(ENTRY_ANIMATION_DURATION); + } optionAlpha.SetCurve(Curves::SHARP); auto host = GetHost(); auto popupId = host->GetId(); @@ -602,7 +619,7 @@ void BubblePattern::StartAlphaEnteringAnimation(std::function finish) CHECK_NULL_VOID(renderContext); renderContext->UpdateOpacity(VISIABLE_ALPHA); }, - [weak = WeakClaim(this), finish, showInSubWindow, popupId, isBlock, isTips]() { + [weak = WeakClaim(this), finish, showInSubWindow, popupId, isBlock, isTips, targetId, host]() { auto pattern = weak.Upgrade(); CHECK_NULL_VOID(pattern); if (pattern->transitionStatus_ != TransitionStatus::ENTERING) { @@ -625,24 +642,50 @@ void BubblePattern::StartAlphaEnteringAnimation(std::function finish) auto subWindowMgr = SubwindowManager::GetInstance(); subWindowMgr->SetHotAreas(rects, SubwindowType::TYPE_POPUP, popupId, pattern->GetContainerId()); } + if (isTips) { + auto pipelineNg = host->GetContextRefPtr(); + CHECK_NULL_VOID(pipelineNg); + auto overlayManager = pipelineNg->GetOverlayManager(); + CHECK_NULL_VOID(overlayManager); + overlayManager->UpdateTipsStartAnimationInfo(targetId, false); + overlayManager->UpdateTipsStartAnimation(targetId, false); + } if (finish) { finish(); } }); } -void BubblePattern::StartExitingAnimation(std::function finish) +void BubblePattern::StartExitingAnimation( + std::function finish, int32_t targetId, bool tipsFlag, bool tipsAnimationFlag) { - StartOffsetExitingAnimation(); - StartAlphaExitingAnimation(finish); + StartOffsetExitingAnimation(tipsFlag, tipsAnimationFlag); + StartAlphaExitingAnimation(finish, targetId, tipsFlag, tipsAnimationFlag); } -void BubblePattern::StartOffsetExitingAnimation() +void BubblePattern::StartOffsetExitingAnimation(bool tipsFlag, bool tipsAnimationFlag) { AnimationOption optionPosition; - optionPosition.SetDuration(EXIT_ANIMATION_DURATION); + if (tipsAnimationFlag && (!tipsFlag)) { + if (offsetExitingAnimation_) { + AnimationUtils::StopAnimation(offsetExitingAnimation_); + } + + auto host = GetHost(); + CHECK_NULL_VOID(host); + auto renderContext = host->GetRenderContext(); + CHECK_NULL_VOID(renderContext); + renderContext->UpdateOpacity(0); + host->MarkNeedRenderOnly(); + return; + } + if (tipsFlag) { + optionPosition.SetDuration(0); + } else { + optionPosition.SetDuration(EXIT_ANIMATION_DURATION); + } optionPosition.SetCurve(Curves::FRICTION); - AnimationUtils::Animate( + offsetExitingAnimation_ = AnimationUtils::StartAnimation( optionPosition, [weak = WeakClaim(this)]() { auto pattern = weak.Upgrade(); @@ -655,12 +698,36 @@ void BubblePattern::StartOffsetExitingAnimation() nullptr); } -void BubblePattern::StartAlphaExitingAnimation(std::function finish) +void BubblePattern::StartAlphaExitingAnimation( + std::function finish, int32_t targetId, bool tipsFlag, bool tipsAnimationFlag) { AnimationOption optionAlpha; - optionAlpha.SetDuration(EXIT_ANIMATION_DURATION); + if (tipsAnimationFlag && (!tipsFlag)) { + if (alphaExitingAnimation_) { + AnimationUtils::StopAnimation(alphaExitingAnimation_); + } + auto host = GetHost(); + CHECK_NULL_VOID(host); + auto renderContext = host->GetRenderContext(); + CHECK_NULL_VOID(renderContext); + renderContext->UpdateOpacity(0); + host->MarkNeedRenderOnly(); + auto pipelineNg = host->GetContextRefPtr(); + CHECK_NULL_VOID(pipelineNg); + auto overlayManager = pipelineNg->GetOverlayManager(); + CHECK_NULL_VOID(overlayManager); + overlayManager->UpdateTipsExitAnimation(targetId, false); + overlayManager->UpdateTipsExitAnimationInfo(targetId, false); + overlayManager->EraseAnimationTipsInfo(targetId); + return; + } + if (tipsFlag) { + optionAlpha.SetDuration(0); + } else { + optionAlpha.SetDuration(EXIT_ANIMATION_DURATION); + } optionAlpha.SetCurve(Curves::SHARP); - AnimationUtils::Animate( + alphaExitingAnimation_ = AnimationUtils::StartAnimation( optionAlpha, [weak = WeakClaim(this)]() { auto pattern = weak.Upgrade(); diff --git a/frameworks/core/components_ng/pattern/bubble/bubble_pattern.h b/frameworks/core/components_ng/pattern/bubble/bubble_pattern.h index 8525168ee61d067e5d71198719d6a6666118943d..c1961abd54887ff242d464532638968f6db05fff 100644 --- a/frameworks/core/components_ng/pattern/bubble/bubble_pattern.h +++ b/frameworks/core/components_ng/pattern/bubble/bubble_pattern.h @@ -159,8 +159,9 @@ public: void OnWindowSizeChanged(int32_t width, int32_t height, WindowSizeChangeReason type) override; void StartEnteringTransitionEffects(const RefPtr& popupNode, const std::function& finish); void StartExitingTransitionEffects(const RefPtr& popupNode, const std::function& finish); - void StartEnteringAnimation(std::function finish); - void StartExitingAnimation(std::function finish); + void StartEnteringAnimation(std::function finish, int32_t targetId = -1, bool tipsFlag = false); + void StartExitingAnimation( + std::function finish, int32_t targetId = -1, bool tipsFlag = false, bool tipsAnimationFlag = false); bool IsOnShow(); bool IsExiting(); void OnColorConfigurationUpdate() override; @@ -370,9 +371,9 @@ private: void OnModifyDone() override; void OnAttachToFrameNode() override; bool OnDirtyLayoutWrapperSwap(const RefPtr& dirty, bool skipMeasure, bool skipLayout) override; - RefPtr GetButtonRowNode(); RefPtr GetPopupTheme(); + void HidePopupOrTips(bool showInSubWindow, bool isTips, int targetNodeId_, const PopupInfo& popupInfo); void InitTouchEvent(); void HandleTouchEvent(const TouchEventInfo& info); void HandleTouchDown(const Offset& clickPosition); @@ -389,14 +390,16 @@ private: RefPtr GetRenderContext(); void ResetToInvisible(); bool PostTask(const TaskExecutor::Task& task, const std::string& name); - void StartOffsetEnteringAnimation(); - void StartAlphaEnteringAnimation(std::function finish); - void StartOffsetExitingAnimation(); - void StartAlphaExitingAnimation(std::function finish); + void StartOffsetEnteringAnimation(bool tipsFlag = false); + void StartAlphaEnteringAnimation(std::function finish, int32_t targetId = -1, bool tipsFlag = false); + void StartOffsetExitingAnimation(bool tipsFlag = false, bool tipsAnimationFlag = false); + void StartAlphaExitingAnimation( + std::function finish, int32_t targetId = -1, bool tipsFlag = false, bool tipsAnimationFlag = false); int32_t targetNodeId_ = -1; std::string targetTag_; - + std::shared_ptr alphaExitingAnimation_; + std::shared_ptr offsetExitingAnimation_; RefPtr touchEvent_; bool mouseEventInitFlag_ = false; bool touchEventInitFlag_ = false; @@ -428,6 +431,7 @@ private: bool delayShow_ = false; std::function finish_; + int32_t targetId_ = -1; std::optional targetOffset_; std::optional targetSize_; diff --git a/frameworks/core/components_ng/pattern/overlay/overlay_manager.cpp b/frameworks/core/components_ng/pattern/overlay/overlay_manager.cpp index 9d694300bb4c07074e84dffd7437e24114fe4fe8..33bf283b9808b4ba655df991fde4a2d2ea1bdee2 100644 --- a/frameworks/core/components_ng/pattern/overlay/overlay_manager.cpp +++ b/frameworks/core/components_ng/pattern/overlay/overlay_manager.cpp @@ -645,6 +645,9 @@ OverlayManager::~OverlayManager() tipsInfoList_.clear(); tipsEnterAndLeaveInfoMap_.clear(); tipsStatusList_.clear(); + animationInfoMap_.clear(); + tipsAnimationList_.clear(); + animationMap_.clear(); } void OverlayManager::UpdateContextMenuDisappearPosition( @@ -1851,18 +1854,19 @@ void OverlayManager::ShowPopupAnimation(const RefPtr& popupNode) } } -void OverlayManager::ShowPopupAnimationNG(const RefPtr& popupNode) +void OverlayManager::ShowPopupAnimationNG(const RefPtr& popupNode, int32_t targetId) { auto popupPattern = popupNode->GetPattern(); CHECK_NULL_VOID(popupPattern); if (popupPattern->GetHasTransition()) { popupPattern->StartEnteringTransitionEffects(popupNode, nullptr); } else { - popupPattern->StartEnteringAnimation(nullptr); + popupPattern->StartEnteringAnimation(nullptr, targetId); } } -void OverlayManager::HidePopupAnimation(const RefPtr& popupNode, const std::function& finish) +void OverlayManager::HidePopupAnimation(const RefPtr& popupNode, const std::function& finish, + int32_t targetId, bool tipsFlag, bool tipsAnimationFlag) { auto rootNode = rootNodeWeak_.Upgrade(); auto popupPattern = popupNode->GetPattern(); @@ -1875,7 +1879,7 @@ void OverlayManager::HidePopupAnimation(const RefPtr& popupNode, cons popupPattern->StartExitingTransitionEffects(popupNode, finish); } } else { - popupPattern->StartExitingAnimation(finish); + popupPattern->StartExitingAnimation(finish, targetId, tipsFlag, tipsAnimationFlag); } } @@ -1922,6 +1926,7 @@ void OverlayManager::ShowTips(int32_t targetId, const PopupInfo& popupInfo, int3 UpdateTipsStatus(targetId, false); duration = appearingTime; } else { + UpdateTipsStartAnimationInfo(targetId, true); UpdateTipsStatus(targetId, true); UpdatePreviousDisappearingTime(targetId); duration = appearingTimeWithContinuousOperation; @@ -1973,6 +1978,7 @@ void OverlayManager::ShowTipsInSubwindow(int32_t targetId, const PopupInfo& popu void OverlayManager::HideTips(int32_t targetId, const PopupInfo& popupInfo, int32_t disappearingTime) { + UpdateTipsExitAnimation(targetId, true); auto duration = disappearingTime; auto isInContinus = GetTipsStatus(targetId); if (isInContinus) { @@ -1990,7 +1996,7 @@ void OverlayManager::HideTips(int32_t targetId, const PopupInfo& popupInfo, int3 CHECK_NULL_VOID(overlayManager); ContainerScope scope(id); auto isExecuteTask = overlayManager->GetBoolFromTipsEnterAndLeaveInfo(tipsId, times); - if (!isExecuteTask) { + if (!isExecuteTask) { overlayManager->EraseTipsEnterAndLeaveInfo(tipsId, times); return; } @@ -2095,12 +2101,54 @@ void OverlayManager::UpdatePreviousDisappearingTime(int32_t targetId) if (previousTargetId != targetId && !previousIsInContinus) { auto previousTipsInfo = GetTipsInfo(previousTargetId); auto previousDisappearingTime = previousTipsInfo.disappearingTimeWithContinuousOperation; + UpdateTipsExitAnimationInfo(previousTargetId, true); UpdateTipsEnterAndLeaveInfoBool(previousTargetId); UpdateTipsStatus(previousTargetId, true); HideTips(previousTargetId, previousTipsInfo, previousDisappearingTime); } } +void OverlayManager::UpdateAnimationTipsInfo(int32_t targetId, const PopupInfo& popupInfo) +{ + auto it = tipsAnimationList_.begin(); + while (it != tipsAnimationList_.end()) { + if (it->first == targetId) { + it = tipsAnimationList_.erase(it); + } else { + ++it; + } + } + tipsAnimationList_.emplace_back(targetId, popupInfo); +} + +void OverlayManager::EraseAnimationTipsInfo(int32_t targetId) +{ + auto it = tipsAnimationList_.begin(); + while (it != tipsAnimationList_.end()) { + if (it->first == targetId) { + it = tipsAnimationList_.erase(it); + } else { + ++it; + } + } +} + +int32_t OverlayManager::GetLastAnimationTipsTargetId() const +{ + if (tipsAnimationList_.empty()) { + return -1; + } + return tipsAnimationList_.back().first; +} + +PopupInfo OverlayManager::GetLastAnimationTipsPopupInfo() const +{ + if (tipsAnimationList_.empty()) { + return {}; + } + return tipsAnimationList_.back().second; +} + void OverlayManager::UpdateTipsInfo(int32_t targetId, const PopupInfo& popupInfo) { auto it = tipsInfoList_.begin(); @@ -2139,6 +2187,71 @@ PopupInfo OverlayManager::GetTipsInfo(int32_t targetId) return {}; } +void OverlayManager::ClearTipsInfo() { + tipsInfoList_.clear(); + tipsEnterAndLeaveInfoMap_.clear(); + tipsStatusList_.clear(); + animationInfoMap_.clear(); + tipsAnimationList_.clear(); + animationMap_.clear(); +} + +void OverlayManager::UpdateTipsStartAnimationInfo(int32_t targetId, bool startFlag) +{ + animationInfoMap_[targetId].startFlag = startFlag; +} + +void OverlayManager::UpdateTipsExitAnimationInfo(int32_t targetId, bool exitFlag) +{ + animationInfoMap_[targetId].exitFlag = exitFlag; +} + +bool OverlayManager::GetTipsExitAnimationInfo(int32_t targetId) +{ + auto it = animationInfoMap_.find(targetId); + if (it != animationInfoMap_.end()) { + return it->second.exitFlag; + } + return false; +} + +bool OverlayManager::GetTipsStartAnimationInfo(int32_t targetId) +{ + auto it = animationInfoMap_.find(targetId); + if (it != animationInfoMap_.end()) { + return it->second.startFlag; + } + return false; +} + +void OverlayManager::UpdateTipsStartAnimation(int32_t targetId, bool startFlag) +{ + animationMap_[targetId].startFlag = startFlag; +} + +void OverlayManager::UpdateTipsExitAnimation(int32_t targetId, bool exitFlag) +{ + animationMap_[targetId].exitFlag = exitFlag; +} + +bool OverlayManager::GetTipsExitAnimation(int32_t targetId) +{ + auto it = animationMap_.find(targetId); + if (it != animationMap_.end()) { + return it->second.exitFlag; + } + return false; +} + +bool OverlayManager::GetTipsStartAnimation(int32_t targetId) +{ + auto it = animationMap_.find(targetId); + if (it != animationMap_.end()) { + return it->second.startFlag; + } + return false; +} + void OverlayManager::UpdateTipsStatus(int32_t targetId, bool isInContinus) { auto it = tipsStatusList_.begin(); @@ -2238,7 +2351,7 @@ void OverlayManager::MountPopup(int32_t targetId, const PopupInfo& popupInfo, (!Container::LessThanAPIVersion(PlatformVersion::VERSION_ELEVEN) && isUseCustom && popupInfo.focusable)) { ShowPopupAnimation(popupNode); } else { - ShowPopupAnimationNG(popupNode); + ShowPopupAnimationNG(popupNode, targetId); } if (!popupInfo.isTips) { SetPopupHotAreas(popupNode); @@ -2355,6 +2468,10 @@ void OverlayManager::HidePopup(int32_t targetId, const PopupInfo& popupInfo, boo auto rootNode = rootNodeWk.Upgrade(); auto popupNode = popupNodeWk.Upgrade(); auto overlayManager = weak.Upgrade(); + if (overlayManager->GetPopupInfo(targetId).isTips) { + overlayManager->UpdateTipsExitAnimationInfo(targetId, false); + overlayManager->EraseAnimationTipsInfo(targetId); + } CHECK_NULL_VOID(rootNode && popupNode && overlayManager); auto popupInfoIter = overlayManager->popupMap_.find(targetId); auto targetIsInMap = popupInfoIter != overlayManager->popupMap_.end(); @@ -2391,7 +2508,7 @@ void OverlayManager::HidePopup(int32_t targetId, const PopupInfo& popupInfo, boo } popupPattern->CallDoubleBindCallback("false"); }; - HidePopupAnimation(popupNode, onFinish); + HidePopupAnimation(popupNode, onFinish, targetId, GetTipsExitAnimationInfo(targetId), false); RemoveEventColumn(); FireAutoSave(popupNode); RemovePixelMapAnimation(false, 0, 0); diff --git a/frameworks/core/components_ng/pattern/overlay/overlay_manager.h b/frameworks/core/components_ng/pattern/overlay/overlay_manager.h index d6ec2115cf6207e8dae9dffebf77c5794fcd56c9..648eb7fb988c88e2dae923973dbc6295fc8ed65e 100644 --- a/frameworks/core/components_ng/pattern/overlay/overlay_manager.h +++ b/frameworks/core/components_ng/pattern/overlay/overlay_manager.h @@ -69,6 +69,12 @@ enum class HideMenuType : int32_t { CLOSE_AI_MENU, REMOVE_MENU, }; + +struct AnimationInfo { + bool startFlag = false; + bool exitFlag = false; +}; + struct PopupInfo { int32_t popupId = -1; WeakPtr target; @@ -148,8 +154,9 @@ public: void HideCustomPopups(); void SetPopupHotAreas(RefPtr popupNode); void ShowPopupAnimation(const RefPtr& popupNode); - void ShowPopupAnimationNG(const RefPtr& popupNode); - void HidePopupAnimation(const RefPtr& popupNode, const std::function& finish); + void ShowPopupAnimationNG(const RefPtr& popupNode, int32_t targetId); + void HidePopupAnimation(const RefPtr& popupNode, const std::function& finish, + int32_t targetId = -1, bool tipsFlag = false, bool tipsAnimationFlag= false); PopupInfo GetPopupInfoWithExistContent(const RefPtr& node); void UpdateTipsEnterAndLeaveInfo(int32_t targetId); void UpdateTipsEnterAndLeaveInfoBool(int32_t targetId); @@ -161,7 +168,21 @@ public: void EraseTipsStatus(int32_t targetId); bool GetTipsStatus(int32_t targetId); bool TipsInfoListIsEmpty(int32_t targetId); - + void UpdateTipsAnimationInfo(int32_t targetId, AnimationInfo& AnimationInfo); + bool GetTipsTipsAnimationInfo(int32_t targetId); + void UpdateTipsStartAnimationInfo(int32_t targetId, bool startFlag); + void UpdateTipsExitAnimationInfo(int32_t targetId, bool exitFlag); + bool GetTipsExitAnimationInfo(int32_t targetId); + bool GetTipsStartAnimationInfo(int32_t targetId); + void UpdateTipsStartAnimation(int32_t targetId, bool startFlag); + void UpdateTipsExitAnimation(int32_t targetId, bool exitFlag); + bool GetTipsExitAnimation(int32_t targetId); + bool GetTipsStartAnimation(int32_t targetId); + void EraseAnimationTipsInfo(int32_t targetId); + void UpdateAnimationTipsInfo(int32_t targetId, const PopupInfo& popupInfo); + void ClearTipsInfo(); + int32_t GetLastAnimationTipsTargetId() const; + PopupInfo GetLastAnimationTipsPopupInfo() const; PopupInfo GetPopupInfo(int32_t targetId) const { auto it = popupMap_.find(targetId); @@ -970,7 +991,10 @@ private: std::unordered_map popupMap_; std::unordered_map>> tipsEnterAndLeaveInfoMap_; std::list> tipsInfoList_; + std::list> tipsAnimationList_; std::list> tipsStatusList_; + std::unordered_map animationInfoMap_; + std::unordered_map animationMap_; // K: target frameNode ID, V: menuNode std::unordered_map> menuMap_; std::unordered_map> dialogMap_; diff --git a/test/unittest/core/pattern/overlay/overlay_manager_popup_test_ng.cpp b/test/unittest/core/pattern/overlay/overlay_manager_popup_test_ng.cpp index 1830db8b27815feaa6d969acc32d84a2b2dd0564..42913aa2e3e087dcb966dfcd51616400cf631f3a 100644 --- a/test/unittest/core/pattern/overlay/overlay_manager_popup_test_ng.cpp +++ b/test/unittest/core/pattern/overlay/overlay_manager_popup_test_ng.cpp @@ -1325,7 +1325,7 @@ HWTEST_F(OverlayManagerPopupTestNg, PopupTest023, TestSize.Level1) ASSERT_NE(popupPattern, nullptr); popupPattern->SetHasTransition(true); EXPECT_TRUE(popupPattern->GetHasTransition()); - overlayManager->ShowPopupAnimationNG(popupNode); + overlayManager->ShowPopupAnimationNG(popupNode, targetId); EXPECT_EQ(popupPattern->transitionStatus_, TransitionStatus::ENTERING); EXPECT_EQ(layoutProp->GetVisibility(), VisibleType::VISIBLE); } @@ -1412,7 +1412,7 @@ HWTEST_F(OverlayManagerPopupTestNg, PopupTest025, TestSize.Level1) ASSERT_NE(popupPattern, nullptr); popupPattern->SetHasTransition(false); EXPECT_FALSE(popupPattern->GetHasTransition()); - overlayManager->ShowPopupAnimationNG(popupNode); + overlayManager->ShowPopupAnimationNG(popupNode, targetId); EXPECT_EQ(popupPattern->transitionStatus_, TransitionStatus::INVISIABLE); } @@ -1586,7 +1586,7 @@ HWTEST_F(OverlayManagerPopupTestNg, PopupTest029, TestSize.Level1) ASSERT_NE(popupPattern, nullptr); popupPattern->SetHasTransition(true); EXPECT_TRUE(popupPattern->GetHasTransition()); - overlayManager->ShowPopupAnimationNG(popupNode); + overlayManager->ShowPopupAnimationNG(popupNode, targetId); EXPECT_EQ(popupPattern->transitionStatus_, TransitionStatus::ENTERING); EXPECT_EQ(layoutProp->GetVisibility(), VisibleType::VISIBLE); } @@ -1673,7 +1673,7 @@ HWTEST_F(OverlayManagerPopupTestNg, PopupTest031, TestSize.Level1) ASSERT_NE(popupPattern, nullptr); popupPattern->SetHasTransition(false); EXPECT_FALSE(popupPattern->GetHasTransition()); - overlayManager->ShowPopupAnimationNG(popupNode); + overlayManager->ShowPopupAnimationNG(popupNode, targetId); EXPECT_EQ(popupPattern->transitionStatus_, TransitionStatus::INVISIABLE); }