diff --git a/adapter/ohos/entrance/ui_content_impl.cpp b/adapter/ohos/entrance/ui_content_impl.cpp index 46b34d9cc8c68ad18727741dc30846f640a30e54..cf0f4559fa7daf26247e1e1f3153f71685beeab4 100644 --- a/adapter/ohos/entrance/ui_content_impl.cpp +++ b/adapter/ohos/entrance/ui_content_impl.cpp @@ -524,6 +524,28 @@ void UIContentImpl::UpdateViewportConfig(const ViewportConfig& config, OHOS::Ros updateConfig_ = true; } +void UIContentImpl::UpdateWindowMode(OHOS::Rosen::WindowMode mode) +{ + LOGI("UpdateWindowMode, window mode is %{public}d", mode); + auto container = Platform::AceContainer::GetContainer(instanceId_); + if (!container) { + LOGE("UpdateWindowMode failed, get container(id=%{public}d) failed", instanceId_); + return; + } + auto pipelineContext = container->GetPipelineContext(); + if (!pipelineContext) { + LOGE("UpdateWindowMode failed, pipeline context is null."); + return; + } + if (mode == OHOS::Rosen::WindowMode::WINDOW_MODE_FULLSCREEN || + mode == OHOS::Rosen::WindowMode::WINDOW_MODE_SPLIT_PRIMARY || + mode == OHOS::Rosen::WindowMode::WINDOW_MODE_SPLIT_SECONDARY) { + pipelineContext->ShowContainerTitle(false); + } else { + pipelineContext->ShowContainerTitle(true); + } +} + void UIContentImpl::DumpInfo(const std::vector& params, std::vector& info) { auto container = Platform::AceContainer::GetContainer(instanceId_); diff --git a/adapter/ohos/entrance/ui_content_impl.h b/adapter/ohos/entrance/ui_content_impl.h index a1d473e5a6099b285ae116e758f69ced38d145dd..5ffade5531a938f7749f82e8a07d189652c34524 100644 --- a/adapter/ohos/entrance/ui_content_impl.h +++ b/adapter/ohos/entrance/ui_content_impl.h @@ -60,6 +60,7 @@ public: bool ProcessVsyncEvent(uint64_t timeStampNanos) override; void UpdateConfiguration(const std::shared_ptr& config) override; void UpdateViewportConfig(const ViewportConfig& config, OHOS::Rosen::WindowSizeChangeReason reason) override; + void UpdateWindowMode(OHOS::Rosen::WindowMode mode) override; void DumpInfo(const std::vector& params, std::vector& info) override; diff --git a/frameworks/core/components/container_modal/container_modal_component.cpp b/frameworks/core/components/container_modal/container_modal_component.cpp index 5defb31cc8387f1c98fcecb9fd3a2e5a495d7c9c..e7fc5d2bde262d154068db1e4f605655086bf6fa 100644 --- a/frameworks/core/components/container_modal/container_modal_component.cpp +++ b/frameworks/core/components/container_modal/container_modal_component.cpp @@ -198,7 +198,6 @@ std::list> ContainerModalComponent::BuildTitleChildren(bool is auto context = contextWptr.Upgrade(); if (context) { context->FireWindowSplitCallBack(); - context->ShowContainerTitle(false); } }); auto buttonResourceId = isFloating ? InternalResource::ResourceId::CONTAINER_MODAL_WINDOW_RECOVER @@ -210,11 +209,9 @@ std::list> ContainerModalComponent::BuildTitleChildren(bool is if (mode == WindowMode::WINDOW_MODE_FULLSCREEN) { LOGI("recover button clicked"); context->FireWindowRecoverCallBack(); - context->ShowContainerTitle(true); } else { LOGI("maximize button clicked"); context->FireWindowMaximizeCallBack(); - context->ShowContainerTitle(false); } } }); diff --git a/frameworks/core/components/container_modal/container_modal_element.cpp b/frameworks/core/components/container_modal/container_modal_element.cpp index e31668bf41b6e00b844c3aebb53fdd918d0555ee..04276331ae4ced75c6e90f785b9b3a83de605899 100644 --- a/frameworks/core/components/container_modal/container_modal_element.cpp +++ b/frameworks/core/components/container_modal/container_modal_element.cpp @@ -169,7 +169,6 @@ void ContainerModalElement::ShowTitle(bool isShow) if (floatingTitleDisplay_) { floatingTitleDisplay_->UpdateVisibleType(VisibleType::GONE); } - isFirstShowTitle_ = false; } void ContainerModalElement::PerformBuild() @@ -267,7 +266,7 @@ void ContainerModalElement::Update() bool ContainerModalElement::CanShowFloatingTitle() { auto context = context_.Upgrade(); - if (!context || !floatingTitleDisplay_ || !controller_ || isFirstShowTitle_) { + if (!context || !floatingTitleDisplay_ || !controller_) { LOGI("Show floating title failed, context, floatingTitleDisplay_ or controller is null."); return false; } diff --git a/frameworks/core/components/container_modal/container_modal_element.h b/frameworks/core/components/container_modal/container_modal_element.h index cd698f40af43ec23e964194510c7a6a15fa0adfa..3431ff327ceb19235a78be92840c860683a89db3 100644 --- a/frameworks/core/components/container_modal/container_modal_element.h +++ b/frameworks/core/components/container_modal/container_modal_element.h @@ -42,7 +42,6 @@ private: RefPtr floatingTitleBox_; RefPtr titleChildrenRow_; RefPtr floatingTitleChildrenRow_; - bool isFirstShowTitle_ = true; }; } // namespace OHOS::Ace diff --git a/interfaces/innerkits/ace/ui_content.h b/interfaces/innerkits/ace/ui_content.h index bd4fd67a067be6dc0cb200a0b3b8a146017f1559..a4b0ebc431e1f6bc4e5307fd7262703c7b593db6 100644 --- a/interfaces/innerkits/ace/ui_content.h +++ b/interfaces/innerkits/ace/ui_content.h @@ -34,6 +34,7 @@ class Configuration; namespace Rosen { class Window; enum class WindowSizeChangeReason : uint32_t; +enum class WindowMode : uint32_t; } namespace MMI { @@ -77,6 +78,7 @@ public: virtual bool ProcessVsyncEvent(uint64_t timeStampNanos) = 0; virtual void UpdateConfiguration(const std::shared_ptr& config) = 0; virtual void UpdateViewportConfig(const ViewportConfig& config, OHOS::Rosen::WindowSizeChangeReason reason) = 0; + virtual void UpdateWindowMode(OHOS::Rosen::WindowMode mode) = 0; virtual void DumpInfo(const std::vector& params, std::vector& info) = 0; };