mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-20 20:20:13 -04:00
!1207 animationTransitionController callback
Merge pull request !1207 from 杨志荣/weekly_20220712
This commit is contained in:
+16
-5
@@ -1044,11 +1044,6 @@ WMError WindowImpl::Show(uint32_t reason, bool withAnimation)
|
||||
if (ret == WMError::WM_OK || ret == WMError::WM_ERROR_DEATH_RECIPIENT) {
|
||||
state_ = WindowState::STATE_SHOWN;
|
||||
NotifyAfterForeground();
|
||||
uint32_t animationFlag = property_->GetAnimationFlag();
|
||||
if (animationFlag == static_cast<uint32_t>(WindowAnimation::CUSTOM)) {
|
||||
// CustomAnimation is enabled when animationTranistionController_ exists
|
||||
animationTranistionController_->AnimationForShown();
|
||||
}
|
||||
} else if (ret == WMError::WM_ERROR_INVALID_WINDOW_MODE_OR_SIZE) {
|
||||
NotifyForegroundInvalidWindowMode();
|
||||
} else {
|
||||
@@ -1676,6 +1671,22 @@ void WindowImpl::RegisterAnimationTransitionController(const sptr<IAnimationTran
|
||||
return;
|
||||
}
|
||||
animationTranistionController_ = listener;
|
||||
wptr<WindowProperty> propertyToken(property_);
|
||||
wptr<IAnimationTransitionController> animationTransitionControllerToken(animationTranistionController_);
|
||||
if (uiContent_) {
|
||||
uiContent_->SetNextFrameLayoutCallback([propertyToken, animationTransitionControllerToken]() {
|
||||
auto property = propertyToken.promote();
|
||||
auto animationTransitionController = animationTransitionControllerToken.promote();
|
||||
if (!property || !animationTransitionController) {
|
||||
return;
|
||||
}
|
||||
uint32_t animationFlag = property->GetAnimationFlag();
|
||||
if (animationFlag == static_cast<uint32_t>(WindowAnimation::CUSTOM)) {
|
||||
// CustomAnimation is enabled when animationTranistionController_ exists
|
||||
animationTransitionController->AnimationForShown();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void WindowImpl::RegisterScreenshotListener(const sptr<IScreenshotListener>& listener)
|
||||
|
||||
Reference in New Issue
Block a user