mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Merge pull request #1049 from NativeScript/feature/respect-show-action-bar
Respect frame.android.showActionBar when page.actionBarHidden is not …
This commit is contained in:
@ -98,7 +98,7 @@ export class ActionBar extends common.ActionBar {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.page.actionBarHidden) {
|
||||
if (!this.page.frame || !this.page.frame._getNavBarVisible(this.page)) {
|
||||
this._toolbar.setVisibility(android.view.View.GONE);
|
||||
|
||||
// If action bar is hidden - no need to fill it with items.
|
||||
|
@ -5,6 +5,7 @@ import trace = require("trace");
|
||||
import observable = require("data/observable");
|
||||
import utils = require("utils/utils");
|
||||
import application = require("application");
|
||||
import types = require("utils/types");
|
||||
|
||||
global.moduleMerge(frameCommon, exports);
|
||||
|
||||
@ -346,8 +347,16 @@ export class Frame extends frameCommon.Frame {
|
||||
}
|
||||
|
||||
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 true;
|
||||
}
|
||||
}
|
||||
|
||||
var NativeActivity = {
|
||||
@ -520,9 +529,9 @@ var framesCache: Array<WeakRef<AndroidFrame>> = new Array<WeakRef<AndroidFrame>>
|
||||
class AndroidFrame extends observable.Observable implements definition.AndroidFrame {
|
||||
public rootViewGroup: android.view.ViewGroup;
|
||||
public hasOwnActivity = false;
|
||||
public showActionBar = false;
|
||||
public frameId;
|
||||
|
||||
private _showActionBar = true;
|
||||
private _activity: android.app.Activity;
|
||||
private _owner: Frame;
|
||||
private _cachePagesOnNavigate: boolean;
|
||||
@ -534,6 +543,19 @@ class AndroidFrame extends observable.Observable implements definition.AndroidFr
|
||||
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 {
|
||||
if (this._activity) {
|
||||
return this._activity;
|
||||
|
Reference in New Issue
Block a user