1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVIGATION_PATTERN_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVIGATION_PATTERN_H 18 19 #include "base/memory/referenced.h" 20 #include "base/system_bar/system_bar_style.h" 21 #include "core/components_ng/base/ui_node.h" 22 #include "core/components_ng/pattern/navigation/inner_navigation_controller.h" 23 #include "core/components_ng/pattern/navigation/navigation_declaration.h" 24 #include "core/components_ng/pattern/navigation/navigation_event_hub.h" 25 #include "core/components_ng/pattern/navigation/navigation_group_node.h" 26 #include "core/components_ng/pattern/navigation/navigation_layout_algorithm.h" 27 #include "core/components_ng/pattern/navigation/navigation_layout_property.h" 28 #include "core/components_ng/pattern/navigation/navigation_stack.h" 29 #include "core/components_ng/pattern/navigation/title_bar_layout_property.h" 30 #include "core/components_ng/pattern/navigation/title_bar_node.h" 31 #include "core/components_ng/pattern/navigation/navigation_transition_proxy.h" 32 #include "core/components_ng/pattern/navrouter/navdestination_group_node.h" 33 #include "core/components_ng/pattern/pattern.h" 34 35 namespace OHOS::Ace::NG { 36 37 using namespace Framework; 38 using OnNavigationAnimation = std::function<NavigationTransition(RefPtr<NavDestinationContext>, 39 RefPtr<NavDestinationContext>, NavigationOperation)>; 40 class NavigationPattern : public Pattern { 41 DECLARE_ACE_TYPE(NavigationPattern, Pattern); 42 43 public: 44 NavigationPattern(); 45 ~NavigationPattern() override = default; 46 IsAtomicNode()47 bool IsAtomicNode() const override 48 { 49 return false; 50 } 51 CreateLayoutProperty()52 RefPtr<LayoutProperty> CreateLayoutProperty() override 53 { 54 return MakeRefPtr<NavigationLayoutProperty>(); 55 } 56 CreateEventHub()57 RefPtr<EventHub> CreateEventHub() override 58 { 59 return MakeRefPtr<NavigationEventHub>(); 60 } 61 CreateLayoutAlgorithm()62 RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override 63 { 64 auto layoutAlgorithm = MakeRefPtr<NavigationLayoutAlgorithm>(); 65 layoutAlgorithm->SetRealNavBarWidth(realNavBarWidth_); 66 layoutAlgorithm->SetIfNeedInit(ifNeedInit_); 67 return layoutAlgorithm; 68 } 69 70 void OnAttachToFrameNode() override; 71 void OnDetachFromFrameNode(FrameNode* frameNode) override; 72 void OnModifyDone() override; 73 void OnWindowHide() override; 74 bool OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config) override; 75 void BeforeSyncGeometryProperties(const DirtySwapConfig& /* config */) override; 76 77 void OnLanguageConfigurationUpdate() override; 78 GetFocusPattern()79 FocusPattern GetFocusPattern() const override 80 { 81 return { FocusType::SCOPE, true }; 82 } 83 GetScopeFocusAlgorithm()84 ScopeFocusAlgorithm GetScopeFocusAlgorithm() override 85 { 86 return { false, true, ScopeType::FLEX }; 87 } 88 SetNavDestination(std::function<void (std::string)> && builder)89 void SetNavDestination(std::function<void(std::string)>&& builder) 90 { 91 builder_ = std::move(builder); 92 } 93 GetNavigationMode()94 NavigationMode GetNavigationMode() const 95 { 96 return navigationMode_; 97 } 98 SetNavigationMode(NavigationMode navigationMode)99 void SetNavigationMode(NavigationMode navigationMode) 100 { 101 navigationMode_ = navigationMode; 102 } 103 104 bool JudgeFoldStateChangeAndUpdateState(); 105 106 void SetNavigationStack(const RefPtr<NavigationStack>& navigationStack); 107 GetNavigationStack()108 const RefPtr<NavigationStack>& GetNavigationStack() 109 { 110 return navigationStack_; 111 } 112 113 // use for navRouter case AddNavDestinationNode(const std::string & name,const RefPtr<UINode> & navDestinationNode)114 void AddNavDestinationNode(const std::string& name, const RefPtr<UINode>& navDestinationNode) 115 { 116 addByNavRouter_ = true; 117 navigationStack_->Add(name, navDestinationNode); 118 } 119 AddNavDestinationNode(const std::string & name,const RefPtr<UINode> & navDestinationNode,NavRouteMode mode)120 void AddNavDestinationNode(const std::string& name, const RefPtr<UINode>& navDestinationNode, NavRouteMode mode) 121 { 122 addByNavRouter_ = true; 123 navigationStack_->Add(name, navDestinationNode, mode); 124 } 125 AddNavDestinationNode(const std::string & name,const RefPtr<UINode> & navDestinationNode,NavRouteMode mode,const RefPtr<RouteInfo> & routeInfo)126 void AddNavDestinationNode(const std::string& name, const RefPtr<UINode>& navDestinationNode, NavRouteMode mode, 127 const RefPtr<RouteInfo>& routeInfo) 128 { 129 addByNavRouter_ = true; 130 navigationStack_->Add(name, navDestinationNode, mode, routeInfo); 131 } 132 GetNavDestinationNode(const std::string & name)133 RefPtr<UINode> GetNavDestinationNode(const std::string& name) 134 { 135 RefPtr<UINode> uiNode; 136 int32_t index; 137 navigationStack_->Get(name, uiNode, index); 138 return uiNode; 139 } 140 GetNavDestinationNode()141 RefPtr<UINode> GetNavDestinationNode() 142 { 143 // get NavDestinationNode from the stack top 144 return navigationStack_->Get(); 145 } 146 GetPreNavDestination(const std::string & name,const RefPtr<UINode> & navDestinationNode)147 RefPtr<UINode> GetPreNavDestination(const std::string& name, const RefPtr<UINode>& navDestinationNode) 148 { 149 return navigationStack_->GetPre(name, navDestinationNode); 150 } 151 GetAllNavDestinationNodes()152 const std::vector<std::pair<std::string, RefPtr<UINode>>>& GetAllNavDestinationNodes() 153 { 154 return navigationStack_->GetAllNavDestinationNodes(); 155 } 156 RemoveIfNeeded(const std::string & name,const RefPtr<UINode> & navDestinationNode)157 void RemoveIfNeeded(const std::string& name, const RefPtr<UINode>& navDestinationNode) 158 { 159 navigationStack_->Remove(name, navDestinationNode); 160 } 161 RemoveNavDestination()162 void RemoveNavDestination() 163 { 164 navigationStack_->Remove(); 165 } 166 167 void InitDividerMouseEvent(const RefPtr<InputEventHub>& inputHub); 168 CleanStack()169 void CleanStack() 170 { 171 navigationStack_->RemoveAll(); 172 } 173 UpdateAnimatedValue(bool animated)174 void UpdateAnimatedValue(bool animated) 175 { 176 navigationStack_->UpdateAnimatedValue(animated); 177 } 178 SetNavigationStackProvided(bool provided)179 void SetNavigationStackProvided(bool provided) 180 { 181 navigationStackProvided_ = provided; 182 } 183 GetNavigationStackProvided()184 bool GetNavigationStackProvided() const 185 { 186 return navigationStackProvided_; 187 } 188 SetNavBarVisibilityChange(bool isChange)189 void SetNavBarVisibilityChange(bool isChange) 190 { 191 navBarVisibilityChange_ = isChange; 192 } 193 GetNavBarVisibilityChange()194 bool GetNavBarVisibilityChange() const 195 { 196 return navBarVisibilityChange_; 197 } 198 199 void OnVisibleChange(bool isVisible) override; 200 201 void OnColorConfigurationUpdate() override; 202 void AddDragBarHotZoneRect(); 203 GetMinNavBarWidthValue()204 Dimension GetMinNavBarWidthValue() const 205 { 206 return minNavBarWidthValue_; 207 } SetMinNavBarWidthValue(Dimension minNavBarWidthValue)208 void SetMinNavBarWidthValue(Dimension minNavBarWidthValue) 209 { 210 minNavBarWidthValue_ = minNavBarWidthValue; 211 } 212 GetMaxNavBarWidthValue()213 Dimension GetMaxNavBarWidthValue() const 214 { 215 return maxNavBarWidthValue_; 216 } SetMaxNavBarWidthValue(Dimension maxNavBarWidthValue)217 void SetMaxNavBarWidthValue(Dimension maxNavBarWidthValue) 218 { 219 maxNavBarWidthValue_ = maxNavBarWidthValue; 220 } 221 GetMinContentWidthValue()222 Dimension GetMinContentWidthValue() const 223 { 224 return minContentWidthValue_; 225 } 226 SetMinContentWidthValue(Dimension minContentWidthValue)227 void SetMinContentWidthValue(Dimension minContentWidthValue) 228 { 229 minContentWidthValue_ = minContentWidthValue; 230 } 231 GetUserSetNavBarRangeFlag()232 bool GetUserSetNavBarRangeFlag() const 233 { 234 return userSetNavBarRangeFlag_; 235 } 236 SetUserSetNavBarRangeFlag(bool userSetNavBarRangeFlag)237 void SetUserSetNavBarRangeFlag(bool userSetNavBarRangeFlag) 238 { 239 userSetNavBarRangeFlag_ = userSetNavBarRangeFlag; 240 } 241 GetUserSetMinContentFlag()242 bool GetUserSetMinContentFlag() const 243 { 244 return userSetMinContentFlag_; 245 } 246 SetUserSetMinContentFlag(bool userSetMinContentFlag)247 void SetUserSetMinContentFlag(bool userSetMinContentFlag) 248 { 249 userSetMinContentFlag_ = userSetMinContentFlag; 250 } 251 GetUserSetNavBarWidthFlag()252 bool GetUserSetNavBarWidthFlag() const 253 { 254 return userSetNavBarWidthFlag_; 255 } 256 SetUserSetNavBarWidthFlag(bool userSetNavBarWidthFlag)257 void SetUserSetNavBarWidthFlag(bool userSetNavBarWidthFlag) 258 { 259 userSetNavBarWidthFlag_ = userSetNavBarWidthFlag; 260 } 261 SetInitNavBarWidth(const Dimension & initNavBarWidth)262 void SetInitNavBarWidth(const Dimension& initNavBarWidth) 263 { 264 realNavBarWidth_ = static_cast<float>(initNavBarWidth.ConvertToPx()); 265 initNavBarWidthValue_ = initNavBarWidth; 266 } 267 GetInitNavBarWidth()268 Dimension GetInitNavBarWidth() const 269 { 270 return initNavBarWidthValue_; 271 } 272 SetIfNeedInit(bool ifNeedInit)273 void SetIfNeedInit(bool ifNeedInit) 274 { 275 ifNeedInit_ = ifNeedInit; 276 } 277 278 void UpdateContextRect( 279 const RefPtr<NavDestinationGroupNode>& curDestination, const RefPtr<NavigationGroupNode>& navigation); 280 GetNavigationModeChange()281 bool GetNavigationModeChange() const 282 { 283 return navigationModeChange_; 284 } 285 SetNavigationModeChange(bool modeChange)286 void SetNavigationModeChange(bool modeChange) 287 { 288 navigationModeChange_ = modeChange; 289 } 290 AddOnStateChangeItem(int32_t nodeId,std::function<void (bool)> callback)291 void AddOnStateChangeItem(int32_t nodeId, std::function<void(bool)> callback) 292 { 293 onStateChangeMap_.emplace(nodeId, callback); 294 } 295 DeleteOnStateChangeItem(int32_t nodeId)296 void DeleteOnStateChangeItem(int32_t nodeId) 297 { 298 onStateChangeMap_.erase(nodeId); 299 } 300 GetNavigationController()301 const std::shared_ptr<NavigationController>& GetNavigationController() const 302 { 303 return navigationController_; 304 } 305 GetOnStateChangeMap()306 const std::map<int32_t, std::function<void(bool)>>& GetOnStateChangeMap() 307 { 308 return onStateChangeMap_; 309 } 310 311 void OnNavigationModeChange(bool modeChange); 312 313 void OnNavBarStateChange(bool modeChange); 314 315 static void FireNavigationChange(const RefPtr<UINode>& node, bool isShow, bool isFirst); 316 317 static void FireNavigationInner(const RefPtr<UINode>& node, bool isShow); 318 319 static void FireNavigationStateChange(const RefPtr<UINode>& node, bool isShow); 320 321 static void FireNavigationLifecycleChange(const RefPtr<UINode>& node, NavDestinationLifecycle lifecycle); 322 323 static bool CheckParentDestinationIsOnhide(const RefPtr<NavDestinationGroupNode>& destinationNode); 324 325 static bool CheckDestinationIsPush(const RefPtr<NavDestinationGroupNode>& destinationNode); 326 327 static void NotifyPerfMonitorPageMsg(const std::string& pageName); 328 329 // type: will_show + on_show, will_hide + on_hide, hide, show, willShow, willHide 330 void NotifyDialogChange(NavDestinationLifecycle lifecycle, bool isNavigationChanged, bool isFromStandard); 331 void NotifyPageHide(const std::string& pageName); 332 void CheckContentNeedMeasure(const RefPtr<FrameNode>& node); 333 void DumpInfo() override; 334 335 void NotifyDialogChange(bool isShow, bool isNavigationChanged); 336 SetIsCustomAnimation(bool isCustom)337 void SetIsCustomAnimation(bool isCustom) 338 { 339 isCustomAnimation_ = isCustom; 340 } 341 SetNavigationTransition(const OnNavigationAnimation navigationAnimation)342 void SetNavigationTransition(const OnNavigationAnimation navigationAnimation) 343 { 344 auto currentProxy = GetTopNavigationProxy(); 345 if (currentProxy && !currentProxy->GetIsFinished()) { 346 TAG_LOGI(AceLogTag::ACE_NAVIGATION, "not support to update callback during animation"); 347 return; 348 } 349 onTransition_ = std::move(navigationAnimation); 350 } 351 NeedSyncWithJsStackMarked()352 bool NeedSyncWithJsStackMarked() const 353 { 354 return needSyncWithJsStack_; 355 } 356 MarkNeedSyncWithJsStack()357 void MarkNeedSyncWithJsStack() 358 { 359 needSyncWithJsStack_ = true; 360 } 361 362 void SyncWithJsStackIfNeeded(); 363 364 void AttachNavigationStackToParent(); 365 void DetachNavigationStackFromParent(); 366 367 void AddToDumpManager(); 368 void RemoveFromDumpManager(); 369 370 void NotifyDestinationLifecycle(const RefPtr<UINode>& destinationNode, 371 NavDestinationLifecycle lifecycle); 372 void AbortAnimation(RefPtr<NavigationGroupNode>& hostNode); 373 SetParentCustomNode(const RefPtr<UINode> & parentNode)374 void SetParentCustomNode(const RefPtr<UINode>& parentNode) 375 { 376 parentNode_ = parentNode; 377 } 378 GetParentCustomNode()379 WeakPtr<UINode> GetParentCustomNode() const 380 { 381 return parentNode_; 382 } 383 384 void SetSystemBarStyle(const RefPtr<SystemBarStyle>& style); 385 386 void OnAttachToMainTree() override; 387 void OnDetachFromMainTree() override; 388 IsFullPageNavigation()389 bool IsFullPageNavigation() const 390 { 391 return isFullPageNavigation_; 392 } 393 394 bool IsTopNavDestination(const RefPtr<UINode>& node) const; 395 void TryRestoreSystemBarStyle(const RefPtr<WindowManager>& windowManager); 396 IsFinishInteractiveAnimation()397 bool IsFinishInteractiveAnimation() const 398 { 399 return isFinishInteractiveAnimation_; 400 } 401 GetTopNavigationProxy()402 const RefPtr<NavigationTransitionProxy> GetTopNavigationProxy() const 403 { 404 return proxyList_.empty() ? nullptr : proxyList_.back(); 405 } 406 407 RefPtr<NavigationTransitionProxy> GetProxyById(uint64_t id) const; 408 409 void RemoveProxyById(uint64_t id); 410 IsCurTopNewInstance()411 bool IsCurTopNewInstance() const 412 { 413 return isCurTopNewInstance_; 414 } 415 GetAllNavDestinationNodesPrev()416 const std::vector<std::pair<std::string, WeakPtr<UINode>>>& GetAllNavDestinationNodesPrev() 417 { 418 return navigationStack_->GetAllNavDestinationNodesPrev(); 419 } 420 421 void DialogAnimation(const RefPtr<NavDestinationGroupNode>& preTopNavDestination, 422 const RefPtr<NavDestinationGroupNode>& newTopNavDestination, bool isPopPage, bool isNeedVisible); 423 424 bool IsLastStdChange(); 425 void ReplaceAnimation(const RefPtr<NavDestinationGroupNode>& preTopNavDestination, 426 const RefPtr<NavDestinationGroupNode>& newTopNavDestination); 427 void TransitionWithDialogAnimation(const RefPtr<NavDestinationGroupNode>& preTopNavDestination, 428 const RefPtr<NavDestinationGroupNode>& newTopNavDestination, bool isPopPage); 429 void FollowStdNavdestinationAnimation(const RefPtr<NavDestinationGroupNode>& preTopNavDestination, 430 const RefPtr<NavDestinationGroupNode>& newTopNavDestination, bool isPopPage); 431 GetNavBasePageNode()432 RefPtr<FrameNode> GetNavBasePageNode() const 433 { 434 return pageNode_.Upgrade(); 435 } 436 437 RefPtr<FrameNode> GetDragBarNode() const; 438 void BuildDragBar(); 439 void InitDragBarEvent(); 440 void ClearDragBarEvent(); 441 void InitTouchEvent(const RefPtr<GestureEventHub>& gestureHub); 442 void HandleTouchEvent(const TouchEventInfo& info); 443 void HandleTouchDown(); 444 void HandleTouchUp(); 445 SetEnableDragBar(bool enabled)446 void SetEnableDragBar(bool enabled) 447 { 448 enableDragBar_ = enabled; 449 } 450 GetEnableDragBar()451 bool GetEnableDragBar() const 452 { 453 return enableDragBar_; 454 } 455 456 std::unique_ptr<JsonValue> GetNavdestinationJsonArray(); 457 void RestoreJsStackIfNeeded(); 458 459 private: 460 void UpdateIsFullPageNavigation(const RefPtr<FrameNode>& host); 461 void UpdateSystemBarStyleOnFullPageStateChange(const RefPtr<WindowManager>& windowManager); 462 void UpdateSystemBarStyleOnTopNavPathChange( 463 const std::optional<std::pair<std::string, RefPtr<UINode>>>& newTopNavPath); 464 void UpdateSystemBarStyleWithTopNavPath(const RefPtr<WindowManager>& windowManager, 465 const std::optional<std::pair<std::string, RefPtr<UINode>>>& topNavPath); 466 void UpdateSystemBarStyleOnPageVisibilityChange(bool show); 467 void RegisterPageVisibilityChangeCallback(); 468 bool ApplyTopNavPathSystemBarStyleOrRestore(const RefPtr<WindowManager>& windowManager, 469 const std::optional<std::pair<std::string, RefPtr<UINode>>>& topNavPath); 470 void InitPageNode(const RefPtr<FrameNode>& host); 471 void InitFoldState(); 472 473 void CheckTopNavPathChange(const std::optional<std::pair<std::string, RefPtr<UINode>>>& preTopNavPath, 474 const std::optional<std::pair<std::string, RefPtr<UINode>>>& newTopNavPath, 475 int32_t preLastStandardIndex = -1); 476 void TransitionWithAnimation(const RefPtr<NavDestinationGroupNode>& preTopNavDestination, 477 const RefPtr<NavDestinationGroupNode>& newTopNavDestination, bool isPopPage, bool isNeedVisible = false); 478 bool TriggerCustomAnimation(const RefPtr<NavDestinationGroupNode>& preTopNavDestination, 479 const RefPtr<NavDestinationGroupNode>& newTopNavDestination, bool isPopPage); 480 481 void OnCustomAnimationFinish(const RefPtr<NavDestinationGroupNode>& preTopNavDestination, 482 const RefPtr<NavDestinationGroupNode>& newTopNavDestination, bool isPopPage); 483 void TransitionWithOutAnimation(const RefPtr<NavDestinationGroupNode>& preTopNavDestination, 484 const RefPtr<NavDestinationGroupNode>& newTopNavDestination, bool isPopPage, bool needVisible = false); 485 NavigationTransition ExecuteTransition(const RefPtr<NavDestinationGroupNode>& preTopDestination, 486 const RefPtr<NavDestinationGroupNode>& newTopNavDestination, bool isPopPage); 487 RefPtr<RenderContext> GetTitleBarRenderContext(); 488 void DoAnimation(NavigationMode usrNavigationMode); 489 void RecoveryToLastStack(const RefPtr<NavDestinationGroupNode>& preTopDestination, 490 const RefPtr<NavDestinationGroupNode>& newTopDestination); 491 RefPtr<UINode> GenerateUINodeByIndex(int32_t index); 492 void GenerateUINodeFromRecovery(int32_t lastStandardIndex, NavPathList& navPathList); 493 void DoNavbarHideAnimation(const RefPtr<NavigationGroupNode>& hostNode); 494 RefPtr<FrameNode> GetDividerNode() const; 495 void FireInterceptionEvent(bool isBefore, 496 const std::optional<std::pair<std::string, RefPtr<UINode>>>& newTopNavPath); 497 void InitDividerPanEvent(const RefPtr<GestureEventHub>& gestureHub); 498 void InitDragBarPanEvent(const RefPtr<GestureEventHub>& gestureHub); 499 void HandleDragStart(); 500 void HandleDragUpdate(float xOffset); 501 void HandleDragEnd(); 502 void OnHover(bool isHover); GetPaintRectHeight(const RefPtr<FrameNode> & node)503 float GetPaintRectHeight(const RefPtr<FrameNode>& node) 504 { 505 auto renderContext = node->GetRenderContext(); 506 CHECK_NULL_RETURN(renderContext, 0.0f); 507 return renderContext->GetPaintRectWithoutTransform().Height(); 508 } 509 void AddDividerHotZoneRect(); 510 void RangeCalculation( 511 const RefPtr<NavigationGroupNode>& hostNode, const RefPtr<NavigationLayoutProperty>& navigationLayoutProperty); 512 bool UpdateTitleModeChangeEventHub(const RefPtr<NavigationGroupNode>& hostNode); 513 void NotifyPageShow(const std::string& pageName); 514 int32_t FireNavDestinationStateChange(NavDestinationLifecycle lifecycle); 515 void UpdatePreNavDesZIndex(const RefPtr<FrameNode> &preTopNavDestination, 516 const RefPtr<FrameNode> &newTopNavDestination, int32_t preLastStandardIndex = -1); 517 void UpdateNavPathList(); 518 void RefreshNavDestination(); 519 RefPtr<NavigationPattern> GetParentNavigationPattern(); 520 void DealTransitionVisibility(const RefPtr<FrameNode>& node, bool isVisible, bool isNavBar); 521 void NotifyNavDestinationSwitch(const RefPtr<NavDestinationContext>& from, 522 const RefPtr<NavDestinationContext>& to, NavigationOperation operation); 523 524 void UpdateIsAnimation(const std::optional<std::pair<std::string, RefPtr<UINode>>>& preTopNavPath); 525 void StartTransition(const RefPtr<NavDestinationGroupNode>& preDestination, 526 const RefPtr<NavDestinationGroupNode>& topDestination, 527 bool isAnimated, bool isPopPage, bool isNeedVisible = false); 528 void ProcessAutoSave(const RefPtr<FrameNode>& node); 529 530 void FireShowAndHideLifecycle(const RefPtr<NavDestinationGroupNode>& preDestination, 531 const RefPtr<NavDestinationGroupNode>& topDestination, bool isPopPage, bool isAnimated); 532 void OnWindowSizeChanged(int32_t width, int32_t height, WindowSizeChangeReason type) override; 533 void RefreshFocusToDestination(); 534 535 void PerformanceEventReport(int32_t nodeCount, int32_t depth, const std::string& navDestinationName); 536 void StartDefaultAnimation(const RefPtr<NavDestinationGroupNode>& preTopDestination, 537 const RefPtr<NavDestinationGroupNode>& topDestination, 538 bool isPopPage, bool isNeedInVisible); 539 bool ExecuteAddAnimation(const RefPtr<NavDestinationGroupNode>& preTopDestination, 540 const RefPtr<NavDestinationGroupNode>& topDestination, 541 bool isPopPage, const RefPtr<NavigationTransitionProxy>& proxy, 542 NavigationTransition navigationTransition); 543 bool GetIsFocusable(const RefPtr<FrameNode>& frameNode); 544 void GetOrCreateNavDestinationUINode(); 545 546 void CreateDragBarNode(const RefPtr<NavigationGroupNode>& navigationGroupNode); 547 RefPtr<FrameNode> CreateDragBarItemNode(); 548 549 NavigationMode navigationMode_ = NavigationMode::AUTO; 550 std::function<void(std::string)> builder_; 551 RefPtr<NavigationStack> navigationStack_; 552 RefPtr<InputEvent> hoverEvent_; 553 RefPtr<PanEvent> panEvent_; 554 RefPtr<PanEvent> dragBarPanEvent_; 555 std::vector<RefPtr<NavigationTransitionProxy>> proxyList_; 556 RectF dragRect_; 557 RectF dragBarRect_; 558 WeakPtr<FrameNode> pageNode_; 559 bool isFullPageNavigation_ = false; 560 std::optional<RefPtr<SystemBarStyle>> backupStyle_; 561 std::optional<RefPtr<SystemBarStyle>> currStyle_; 562 bool addByNavRouter_ = false; 563 bool ifNeedInit_ = true; 564 float preNavBarWidth_ = 0.0f; 565 float realNavBarWidth_ = DEFAULT_NAV_BAR_WIDTH.ConvertToPx(); 566 float realDividerWidth_ = 2.0f; 567 bool navigationStackProvided_ = false; 568 bool navBarVisibilityChange_ = false; 569 bool userSetNavBarRangeFlag_ = false; 570 bool userSetMinContentFlag_ = false; 571 bool userSetNavBarWidthFlag_ = false; 572 bool isChanged_ = false; // check navigation top page is change 573 Dimension initNavBarWidthValue_ = DEFAULT_NAV_BAR_WIDTH; 574 Dimension minNavBarWidthValue_ = 0.0_vp; 575 Dimension maxNavBarWidthValue_ = 0.0_vp; 576 Dimension minContentWidthValue_ = 0.0_vp; 577 NavigationTitleMode titleMode_ = NavigationTitleMode::FREE; 578 bool navigationModeChange_ = false; 579 bool isCustomAnimation_ = false; // custom animation 580 bool isInDividerDrag_ = false; 581 bool isDividerDraggable_ = true; 582 bool isAnimated_ = false; 583 FoldStatus currentFoldStatus_ = FoldStatus::UNKNOWN; // only used for mode-switch animation 584 #if defined(ENABLE_NAV_SPLIT_MODE) 585 bool isBackPage_ = false; 586 #endif 587 bool isReplace_ = false; 588 bool isFinishInteractiveAnimation_ = true; 589 int32_t lastPreIndex_ = false; 590 std::shared_ptr<NavigationController> navigationController_; 591 std::map<int32_t, std::function<void(bool)>> onStateChangeMap_; 592 OnNavigationAnimation onTransition_; 593 bool needSyncWithJsStack_ = false; 594 std::optional<std::pair<std::string, RefPtr<UINode>>> preTopNavPath_; 595 RefPtr<NavDestinationContext> preContext_; 596 WeakPtr<UINode> parentNode_; 597 int32_t preStackSize_ = 0; 598 bool isRightToLeft_ = false; 599 bool isCurTopNewInstance_ = false; 600 RefPtr<TouchEventImpl> touchEvent_; 601 bool enableDragBar_ = false; 602 }; 603 604 } // namespace OHOS::Ace::NG 605 606 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_NAVIGATION_NAVIGATION_PATTERN_H 607