!47254 [Bug]: navigation title paddingend 设置后不生效

Merge pull request !47254 from yuzhicheng/page_title_1030
This commit is contained in:
openharmony_ci 2024-11-04 13:01:47 +00:00 committed by Gitee
commit 7db9818420
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 22 additions and 11 deletions

View File

@ -908,15 +908,7 @@ void NavigationPattern::CheckTopNavPathChange(
navBarNode->GetLayoutProperty()->UpdateVisibility(VisibleType::VISIBLE);
navBarNode->SetJSViewActive(true);
}
auto stageManager = context->GetStageManager();
if (stageManager != nullptr) {
RefPtr<FrameNode> pageNode = stageManager->GetLastPage();
CHECK_NULL_VOID(pageNode);
auto pagePattern = pageNode->GetPattern<NG::PagePattern>();
CHECK_NULL_VOID(pagePattern);
auto pageInfo = pagePattern->GetPageInfo();
NotifyPageShow(pageInfo->GetPageUrl());
}
ProcessPageShowEvent();
navBarNode->GetEventHub<EventHub>()->SetEnabledInternal(true);
if (GetIsFocusable(navBarNode)) {
auto navBarFocusView = navBarNode->GetPattern<FocusView>();
@ -1132,6 +1124,24 @@ void NavigationPattern::NotifyPageShow(const std::string& pageName)
}
}
void NavigationPattern::ProcessPageShowEvent()
{
auto hostNode = AceType::DynamicCast<NavigationGroupNode>(GetHost());
CHECK_NULL_VOID(hostNode);
auto context = hostNode->GetContext();
CHECK_NULL_VOID(context);
auto stageManager = context->GetStageManager();
if (stageManager) {
RefPtr<FrameNode> pageNode = stageManager->GetLastPage();
CHECK_NULL_VOID(pageNode);
auto pagePattern = pageNode->GetPattern<NG::PagePattern>();
CHECK_NULL_VOID(pagePattern);
auto pageInfo = pagePattern->GetPageInfo();
CHECK_NULL_VOID(pageInfo);
NotifyPageShow(pageInfo->GetPageUrl());
}
}
void NavigationPattern::ReplaceAnimation(const RefPtr<NavDestinationGroupNode>& preTopNavDestination,
const RefPtr<NavDestinationGroupNode>& newTopNavDestination)
{

View File

@ -508,6 +508,7 @@ private:
const RefPtr<NavigationGroupNode>& hostNode, const RefPtr<NavigationLayoutProperty>& navigationLayoutProperty);
bool UpdateTitleModeChangeEventHub(const RefPtr<NavigationGroupNode>& hostNode);
void NotifyPageShow(const std::string& pageName);
void ProcessPageShowEvent();
int32_t FireNavDestinationStateChange(NavDestinationLifecycle lifecycle);
void UpdatePreNavDesZIndex(const RefPtr<FrameNode> &preTopNavDestination,
const RefPtr<FrameNode> &newTopNavDestination, int32_t preLastStandardIndex = -1);

View File

@ -179,7 +179,7 @@ float TitleBarLayoutAlgorithm::GetTitleWidth(const RefPtr<TitleBarNode>& titleBa
} else {
occupiedWidth += menuWidth_;
if (!navDestination->GetPrevMenuIsCustomValue(false)) {
occupiedWidth += paddingLeft;
occupiedWidth += paddingRight;
occupiedWidth += isCustom ? 0.0f : horizontalMargin;
}
}

View File

@ -90,7 +90,6 @@ bool PagePattern::TriggerPageTransition(PageTransitionType type, const std::func
if (pageTransitionFunc_) {
pageTransitionFunc_();
}
auto effect = FindPageTransitionEffect(type);
pageTransitionFinish_ = std::make_shared<std::function<void()>>(onFinish);
auto wrappedOnFinish = [weak = WeakClaim(this), sharedFinish = pageTransitionFinish_]() {
auto pattern = weak.Upgrade();
@ -104,6 +103,7 @@ bool PagePattern::TriggerPageTransition(PageTransitionType type, const std::func
host->DeleteAnimatablePropertyFloat(KEY_PAGE_TRANSITION_PROPERTY);
}
};
auto effect = FindPageTransitionEffect(type);
if (effect && effect->GetUserCallback()) {
RouteType routeType = (type == PageTransitionType::ENTER_POP || type == PageTransitionType::EXIT_POP)
? RouteType::POP