mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-10-07 16:33:54 +00:00
commit
d7fc465a02
@ -40,7 +40,6 @@ UIExtensionPattern::UIExtensionPattern(const RefPtr<OHOS::Ace::WantWrap>& wantWr
|
||||
auto container = AceType::DynamicCast<Platform::AceContainer>(Container::Current());
|
||||
CHECK_NULL_VOID_NOLOG(container);
|
||||
auto callerToken = container->GetToken();
|
||||
Rosen::ExtensionSessionManager::GetInstance().Init();
|
||||
auto want = AceType::DynamicCast<WantWrapOhos>(wantWrap)->GetWant();
|
||||
if (want.GetElement().GetBundleName() == "AbilityComp") {
|
||||
return;
|
||||
|
@ -31,6 +31,16 @@ namespace OHOS::Ace::NG {
|
||||
namespace {
|
||||
constexpr uint32_t COLOR_BLACK = 0xff000000;
|
||||
constexpr uint32_t COLOR_WHITE = 0xffffffff;
|
||||
const std::map<std::string, Rosen::RSAnimationTimingCurve> curveMap {
|
||||
{ "default", Rosen::RSAnimationTimingCurve::DEFAULT },
|
||||
{ "linear", Rosen::RSAnimationTimingCurve::LINEAR },
|
||||
{ "ease", Rosen::RSAnimationTimingCurve::EASE },
|
||||
{ "easeIn", Rosen::RSAnimationTimingCurve::EASE_IN },
|
||||
{ "easeOut", Rosen::RSAnimationTimingCurve::EASE_OUT },
|
||||
{ "easeInOut", Rosen::RSAnimationTimingCurve::EASE_IN_OUT },
|
||||
{ "spring", Rosen::RSAnimationTimingCurve::SPRING },
|
||||
{ "interactiveSpring", Rosen::RSAnimationTimingCurve::INTERACTIVE_SPRING },
|
||||
};
|
||||
} // namespace
|
||||
|
||||
class LifecycleListener : public Rosen::ILifecycleListener {
|
||||
@ -208,9 +218,27 @@ void WindowPattern::BufferAvailableCallback()
|
||||
{
|
||||
ContainerScope scope(instanceId_);
|
||||
|
||||
const auto& config =
|
||||
Rosen::SceneSessionManager::GetInstance().GetWindowSceneConfig().startingWindowAnimationConfig_;
|
||||
if (config.enabled_) {
|
||||
CHECK_NULL_VOID(startingNode_);
|
||||
auto context = AceType::DynamicCast<RosenRenderContext>(startingNode_->GetRenderContext());
|
||||
CHECK_NULL_VOID(context);
|
||||
auto rsNode = context->GetRSNode();
|
||||
CHECK_NULL_VOID(rsNode);
|
||||
auto effect = Rosen::RSTransitionEffect::Create()->Opacity(config.opacityEnd_);
|
||||
rsNode->SetTransitionEffect(effect);
|
||||
Rosen::RSAnimationTimingProtocol protocol;
|
||||
protocol.SetDuration(config.duration_);
|
||||
auto curve = curveMap.count(config.curve_) ? curveMap.at(config.curve_) :
|
||||
Rosen::RSAnimationTimingCurve::DEFAULT;
|
||||
Rosen::RSNode::Animate(protocol, curve, [rsNode, effect] {
|
||||
rsNode->NotifyTransition(effect, false);
|
||||
});
|
||||
}
|
||||
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_VOID(host);
|
||||
|
||||
host->RemoveChild(startingNode_);
|
||||
startingNode_.Reset();
|
||||
host->MarkDirtyNode(PROPERTY_UPDATE_MEASURE);
|
||||
|
@ -46,11 +46,13 @@ void WindowSceneModel::Create(uint64_t persistentId)
|
||||
auto nodeId = stack->ClaimNodeId();
|
||||
auto windowNode = WindowNode::GetOrCreateWindowNode(V2::WINDOW_SCENE_ETS_TAG, nodeId,
|
||||
[sceneSession]() { return AceType::MakeRefPtr<WindowScene>(sceneSession); });
|
||||
stack->Push(windowNode);
|
||||
|
||||
auto windowScene = windowNode->GetPattern<WindowScene>();
|
||||
windowScene->UpdateSession(sceneSession);
|
||||
|
||||
if (windowNode->GetHitTestMode() == HitTestMode::HTMDEFAULT) {
|
||||
windowNode->SetHitTestMode(HitTestMode::HTMBLOCK);
|
||||
}
|
||||
stack->Push(windowNode);
|
||||
auto windowScene = windowNode->GetPattern<WindowScene>();
|
||||
windowScene->UpdateSession(sceneSession);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -25,7 +25,7 @@ class ScreenPattern : public StackPattern {
|
||||
DECLARE_ACE_TYPE(ScreenPattern, StackPattern);
|
||||
|
||||
public:
|
||||
ScreenPattern(const sptr<Rosen::ScreenSession>& screenSession) : screenSession_(screenSession) {}
|
||||
explicit ScreenPattern(const sptr<Rosen::ScreenSession>& screenSession) : screenSession_(screenSession) {}
|
||||
~ScreenPattern() override = default;
|
||||
|
||||
std::optional<RenderContext::ContextParam> GetContextParam() const override
|
||||
|
@ -48,5 +48,10 @@ RefPtr<RenderContext> RenderContext::Create()
|
||||
return MakeRefPtr<RosenRenderContext>();
|
||||
}
|
||||
|
||||
void RosenRenderContext::SetRSNode(const std::shared_ptr<RSNode>& rsNode) {}
|
||||
const std::shared_ptr<Rosen::RSNode>& RosenRenderContext::GetRSNode()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void RosenRenderContext::SetRSNode(const std::shared_ptr<Rosen::RSNode>& rsNode) {}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -13,18 +13,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_RENDER_CONTEXT_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_RENDER_CONTEXT_H
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_RENDER_CONTEXT_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_RENDER_CONTEXT_H
|
||||
|
||||
#include "core/components_ng/render/render_context.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
class RosenRenderContext : public RenderContext {
|
||||
DECLARE_ACE_TYPE(RosenRenderContext, RenderContext)
|
||||
DECLARE_ACE_TYPE(RosenRenderContext, RenderContext);
|
||||
|
||||
public:
|
||||
const std::shared_ptr<Rosen::RSNode>& GetRSNode();
|
||||
void SetRSNode(const std::shared_ptr<Rosen::RSNode>& rsNode);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_RENDER_CONTEXT_H
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_RENDER_CONTEXT_H
|
||||
|
Loading…
Reference in New Issue
Block a user