Respect frame.android.showActionBar when page.actionBarHidden is not defined

This commit is contained in:
vakrilov
2015-11-06 14:40:35 +02:00
parent 523e5bfbce
commit 4c7dfb6748
2 changed files with 27 additions and 5 deletions

View File

@ -98,7 +98,7 @@ export class ActionBar extends common.ActionBar {
return; return;
} }
if (this.page.actionBarHidden) { if (!this.page.frame || !this.page.frame._getNavBarVisible(this.page)) {
this._toolbar.setVisibility(android.view.View.GONE); this._toolbar.setVisibility(android.view.View.GONE);
// If action bar is hidden - no need to fill it with items. // If action bar is hidden - no need to fill it with items.

View File

@ -5,6 +5,7 @@ import trace = require("trace");
import observable = require("data/observable"); import observable = require("data/observable");
import utils = require("utils/utils"); import utils = require("utils/utils");
import application = require("application"); import application = require("application");
import types = require("utils/types");
global.moduleMerge(frameCommon, exports); global.moduleMerge(frameCommon, exports);
@ -346,8 +347,16 @@ export class Frame extends frameCommon.Frame {
} }
public _getNavBarVisible(page: pages.Page): boolean { public _getNavBarVisible(page: pages.Page): boolean {
if (types.isDefined(page.actionBarHidden)) {
return !page.actionBarHidden;
}
if (this._android && types.isDefined(this._android.showActionBar)) {
return this._android.showActionBar; return this._android.showActionBar;
} }
return true;
}
} }
var NativeActivity = { var NativeActivity = {
@ -520,9 +529,9 @@ var framesCache: Array<WeakRef<AndroidFrame>> = new Array<WeakRef<AndroidFrame>>
class AndroidFrame extends observable.Observable implements definition.AndroidFrame { class AndroidFrame extends observable.Observable implements definition.AndroidFrame {
public rootViewGroup: android.view.ViewGroup; public rootViewGroup: android.view.ViewGroup;
public hasOwnActivity = false; public hasOwnActivity = false;
public showActionBar = false;
public frameId; public frameId;
private _showActionBar = true;
private _activity: android.app.Activity; private _activity: android.app.Activity;
private _owner: Frame; private _owner: Frame;
private _cachePagesOnNavigate: boolean; private _cachePagesOnNavigate: boolean;
@ -534,6 +543,19 @@ class AndroidFrame extends observable.Observable implements definition.AndroidFr
framesCache.push(new WeakRef(this)); framesCache.push(new WeakRef(this));
} }
public get showActionBar(): boolean {
return this._showActionBar;
}
public set showActionBar(value: boolean) {
if (this._showActionBar !== value) {
this._showActionBar = value;
if (this.owner.currentPage) {
this.owner.currentPage.actionBar.update();
}
}
}
public get activity(): android.app.Activity { public get activity(): android.app.Activity {
if (this._activity) { if (this._activity) {
return this._activity; return this._activity;