diff --git a/apps/app/ui-tests-app/page/page-status-bar-css.ts b/apps/app/ui-tests-app/page/page-status-bar-css.ts index 6cafc2a69..06792906c 100644 --- a/apps/app/ui-tests-app/page/page-status-bar-css.ts +++ b/apps/app/ui-tests-app/page/page-status-bar-css.ts @@ -10,7 +10,7 @@ export function applyTap(args) { let css = "#test-element { " + args.object.tag + " }"; page.css = css; - } +} export function applyTapOnStyledActionBar(args) { let page = (args.object).page; @@ -18,8 +18,7 @@ export function applyTapOnStyledActionBar(args) { reset(page); page.actionBar.backgroundColor = new color.Color("#5DFC0A"); - var css = "#test-element { " + args.object.tag + " }"; - page.css = css; + page.css = "#test-element { " + args.object.tag + " }"; } export function applyTapWithHiddenActionBar(args) { @@ -28,8 +27,7 @@ export function applyTapWithHiddenActionBar(args) { reset(page); page.actionBarHidden = true; - var css = "#test-element { " + args.object.tag + " }"; - page.css = css; + page.css = "#test-element { " + args.object.tag + " }"; } export function applyTapWithSpan(args) { @@ -38,8 +36,7 @@ export function applyTapWithSpan(args) { reset(page); page.backgroundSpanUnderStatusBar = true; - var css = "#test-element { " + args.object.tag + " }"; - page.css = css; + page.css = "#test-element { " + args.object.tag + " }"; } export function applyTapOnStyledActionBarAndSpan(args) { @@ -49,8 +46,7 @@ export function applyTapOnStyledActionBarAndSpan(args) { page.backgroundSpanUnderStatusBar = true; page.actionBar.backgroundColor = new color.Color("#E0115F"); - var css = "#test-element { " + args.object.tag + " }"; - page.css = css; + page.css = "#test-element { " + args.object.tag + " }"; } export function applyTapWithActionBarHiddenAndSpan(args) { @@ -59,9 +55,8 @@ export function applyTapWithActionBarHiddenAndSpan(args) { reset(page); page.backgroundSpanUnderStatusBar = true; - page.actionBarHidden = true;; - var css = "#test-element { " + args.object.tag + " }"; - page.css = css; + page.actionBarHidden = true; + page.css = "#test-element { " + args.object.tag + " }"; } function reset(page: page.Page) { diff --git a/tns-core-modules/file-system/file-name-resolver.ts b/tns-core-modules/file-system/file-name-resolver.ts index 05ee0b5ad..a169a473c 100644 --- a/tns-core-modules/file-system/file-name-resolver.ts +++ b/tns-core-modules/file-system/file-name-resolver.ts @@ -142,9 +142,6 @@ export class FileNameResolver implements definition.FileNameResolver { var candidates = this.getFileCandidatesFromFolder(path, ext); result = _findFileMatch(path, ext, candidates, this._context); - if (trace.enabled) { - trace.write("Resolved file name for \"" + path + ext + "\" result: " + (result ? result : "no match found"), trace.categories.Navigation); - } return result; } @@ -179,9 +176,6 @@ export function _findFileMatch(path: string, ext: string, candidates: Arraythis.page.ios); var navigationItem: UINavigationItem = viewController.navigationItem; - var navController = frameModule.topmost().ios.controller; + var navController = frameModule.topmost().ios.controller; var navigationBar = navController ? navController.navigationBar : null; var previousController: UIViewController; @@ -229,7 +229,7 @@ export class ActionBar extends common.ActionBar { this.actionItems.getItems().forEach((actionItem) => { if (actionItem.actionView) { - view.View.measureChild(this, actionItem.actionView, + view.View.measureChild(this, actionItem.actionView, utils.layout.makeMeasureSpec(width, utils.layout.AT_MOST), utils.layout.makeMeasureSpec(navBarHeight, utils.layout.AT_MOST)); } diff --git a/tns-core-modules/ui/frame/frame-common.ts b/tns-core-modules/ui/frame/frame-common.ts index 351fadc36..2dbf461a6 100644 --- a/tns-core-modules/ui/frame/frame-common.ts +++ b/tns-core-modules/ui/frame/frame-common.ts @@ -1,9 +1,9 @@ import * as definition from "ui/frame"; -import {View, CustomLayoutView} from "ui/core/view"; -import {Page} from "ui/page"; -import {isString, isFunction, isDefined} from "utils/types"; +import { View, CustomLayoutView } from "ui/core/view"; +import { Page } from "ui/page"; +import { isString, isFunction, isDefined } from "utils/types"; import * as trace from "trace"; -import {resolveFileName} from "file-system/file-name-resolver"; +import { resolveFileName } from "file-system/file-name-resolver"; import * as fs from "file-system"; import * as builderModule from "ui/builder"; import * as platform from "platform"; @@ -222,7 +222,7 @@ export class Frame extends CustomLayoutView implements definition.Frame { // if (!this._currentEntry){ // return; // } - + // let currentPage = this._currentEntry.resolvedPage; // let currentNavigationEntry = this._currentEntry.entry; // if (currentPage["isBiOrientational"] && currentNavigationEntry.moduleName) { @@ -321,7 +321,7 @@ export class Frame extends CustomLayoutView implements definition.Frame { return !backstackHidden; } - public _updateActionBar(page?: Page) { + public _updateActionBar(page?: Page, disableNavBarAnimation?: boolean) { //trace.write("calling _updateActionBar on Frame", trace.categories.Navigation); } @@ -408,7 +408,7 @@ export class Frame extends CustomLayoutView implements definition.Frame { if (this._currentEntry) { return this._currentEntry.entry; } - + return null; } diff --git a/tns-core-modules/ui/frame/frame.d.ts b/tns-core-modules/ui/frame/frame.d.ts index e56f776ff..cb61bf29e 100644 --- a/tns-core-modules/ui/frame/frame.d.ts +++ b/tns-core-modules/ui/frame/frame.d.ts @@ -104,7 +104,7 @@ declare module "ui/frame" { navigationQueueIsEmpty(): boolean; navigationBarHeight: number; _processNavigationQueue(page: pages.Page); - _updateActionBar(page?: pages.Page); + _updateActionBar(page?: pages.Page, disableNavBarAnimation?: boolean); _getNavBarVisible(page: pages.Page): boolean; //@endprivate diff --git a/tns-core-modules/ui/frame/frame.ios.ts b/tns-core-modules/ui/frame/frame.ios.ts index b1475b6ed..67130d72c 100644 --- a/tns-core-modules/ui/frame/frame.ios.ts +++ b/tns-core-modules/ui/frame/frame.ios.ts @@ -1,10 +1,10 @@ import frameCommon = require("./frame-common"); import definition = require("ui/frame"); import trace = require("trace"); -import {Page} from "ui/page"; -import {NavigationBarVisibility, AnimationCurve} from "ui/enums"; +import { Page } from "ui/page"; +import { NavigationBarVisibility, AnimationCurve } from "ui/enums"; import utils = require("utils/utils"); -import {View} from "ui/core/view"; +import { View } from "ui/core/view"; import uiUtils = require("ui/utils"); import * as types from "utils/types"; import application = require("application"); @@ -109,10 +109,10 @@ export class Frame extends frameCommon.Frame { backstackEntry[NAV_DEPTH] = navDepth; viewController[ENTRY] = backstackEntry; - this._updateActionBar(backstackEntry.resolvedPage); - // First navigation. if (!this._currentEntry) { + // Update action-bar with disabled animations before the initial navigation. + this._updateActionBar(backstackEntry.resolvedPage, true); this._ios.controller.pushViewControllerAnimated(viewController, animated); if (trace.enabled) { trace.write(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, trace.categories.Navigation); @@ -189,16 +189,23 @@ export class Frame extends frameCommon.Frame { } } - public _updateActionBar(page?: Page): void { + public _updateActionBar(page?: Page, disableNavBarAnimation: boolean = false): void { super._updateActionBar(page); page = page || this.currentPage; let newValue = this._getNavBarVisible(page); - var disableNavBarAnimation = this._ios._disableNavBarAnimation; - this._ios._disableNavBarAnimation = true; + let disableNavBarAnimationCache = this._ios._disableNavBarAnimation; + + if (disableNavBarAnimation) { + this._ios._disableNavBarAnimation = true; + } + this._ios.showNavigationBar = newValue; - this._ios._disableNavBarAnimation = disableNavBarAnimation; + + if (disableNavBarAnimation) { + this._ios._disableNavBarAnimation = disableNavBarAnimationCache; + } if (this._ios.controller.navigationBar) { this._ios.controller.navigationBar.userInteractionEnabled = this.navigationQueueIsEmpty(); @@ -260,7 +267,7 @@ export class Frame extends frameCommon.Frame { } public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void { - View.adjustChildLayoutParams(this.currentPage, widthMeasureSpec, heightMeasureSpec); + View.adjustChildLayoutParams(this.currentPage, widthMeasureSpec, heightMeasureSpec); let width = utils.layout.getMeasureSpecSize(widthMeasureSpec); let widthMode = utils.layout.getMeasureSpecMode(widthMeasureSpec); @@ -693,7 +700,6 @@ class iOSFrame implements definition.iOSFrame { this._frame = frame; this._controller = UINavigationControllerImpl.initWithOwner(new WeakRef(frame)); this._controller.automaticallyAdjustsScrollViewInsets = false; - //this.showNavigationBar = false; this._navBarVisibility = NavigationBarVisibility.auto; } diff --git a/tns-core-modules/ui/page/page-common.ts b/tns-core-modules/ui/page/page-common.ts index 51261584b..8d8f10811 100644 --- a/tns-core-modules/ui/page/page-common.ts +++ b/tns-core-modules/ui/page/page-common.ts @@ -10,7 +10,7 @@ import * as frameModule from "ui/frame"; import proxy = require("ui/core/proxy"); import keyframeAnimation = require("ui/animation/keyframe-animation"); import types = require("utils/types"); -import {Color} from "color"; +import { Color } from "color"; let fs: typeof fileSystemModule; function ensureFS() { @@ -47,7 +47,8 @@ const actionBarHiddenProperty = new Property("actionBarHidden", "Page", new prox function onActionBarHiddenPropertyChanged(data: PropertyChangeData) { const page = data.object; if (page.isLoaded) { - page._updateActionBar(data.newValue); + // Update with disabled animation when setting visibility + page._updateActionBar(true); } } @@ -101,7 +102,7 @@ export class Page extends ContentView implements dts.Page { this._applyCss(); if (this.actionBarHidden !== undefined) { - this._updateActionBar(this.actionBarHidden); + this._updateActionBar(); } this._updateStatusBar(); @@ -148,7 +149,7 @@ export class Page extends ContentView implements dts.Page { this._setValue(Page.iosSwipeBackNavigationEnabledProperty, value); } - public _updateActionBar(hidden: boolean) { + public _updateActionBar(disableNavBarAnimation?: boolean) { // } diff --git a/tns-core-modules/ui/page/page.android.ts b/tns-core-modules/ui/page/page.android.ts index 9f6e9736b..f0cb5910e 100644 --- a/tns-core-modules/ui/page/page.android.ts +++ b/tns-core-modules/ui/page/page.android.ts @@ -187,7 +187,7 @@ export class Page extends pageCommon.Page { super._hideNativeModalView(parent); } - public _updateActionBar(hidden: boolean) { + public _updateActionBar() { this.actionBar.update(); } diff --git a/tns-core-modules/ui/page/page.ios.ts b/tns-core-modules/ui/page/page.ios.ts index f60da7583..b384ea325 100644 --- a/tns-core-modules/ui/page/page.ios.ts +++ b/tns-core-modules/ui/page/page.ios.ts @@ -145,9 +145,7 @@ class UIViewControllerImpl extends UIViewController { this.shown = false; let page = this._owner.get(); if (trace.enabled) { - if (trace.enabled) { - trace.write(page + " viewWillAppear", trace.categories.Navigation); - } + trace.write(page + " viewWillAppear", trace.categories.Navigation); } if (!page) { return; @@ -349,7 +347,7 @@ export class Page extends pageCommon.Page { if (this._enableLoadedEvents) { super.onLoaded(); } - this._updateActionBar(false); + this._updateActionBar(); } public onUnloaded() { @@ -433,10 +431,10 @@ export class Page extends pageCommon.Page { super._hideNativeModalView(parent); } - public _updateActionBar(hidden: boolean) { + public _updateActionBar(disableNavBarAnimation: boolean = false) { const frame = this.frame; if (frame) { - frame._updateActionBar(this); + frame._updateActionBar(this, disableNavBarAnimation); } } @@ -449,7 +447,7 @@ export class Page extends pageCommon.Page { if (this.frame && value) { let navigationController = frame.ios.controller; let navigationBar = navigationController.navigationBar; - + navigationBar.barStyle = value === "dark" ? 1 : 0; } } @@ -554,7 +552,7 @@ export class Page extends pageCommon.Page { export class PageStyler implements style.Styler { // statusBarStyle - private static setStatusBarStyleProperty(v: View, newValue: any) { + private static setStatusBarStyleProperty(v: View, newValue: any) { let page = v; page._updateStatusBarStyle(newValue); } @@ -570,11 +568,11 @@ export class PageStyler implements style.Styler { } public static registerHandlers() { - style.registerHandler(style.statusBarStyleProperty, new style.StylePropertyChangedHandler( + style.registerHandler(style.statusBarStyleProperty, new style.StylePropertyChangedHandler( PageStyler.setStatusBarStyleProperty, PageStyler.resetStatusBarStyleProperty, PageStyler.getStatusBarStyleProperty), "Page"); } } -PageStyler.registerHandlers(); \ No newline at end of file +PageStyler.registerHandlers();