Fixed 'jurky` navigation between pages in iOS.

Fixed after application suspend/resume the UI was not restored.
Fixed modal-views page
This commit is contained in:
Hristo Hristov
2016-02-24 09:40:18 +02:00
parent d8d68d3a51
commit a9d2b2e970
6 changed files with 35 additions and 37 deletions

View File

@@ -184,7 +184,7 @@ function onFragmentHidden(fragment) {
export class Frame extends frameCommon.Frame {
private _android: AndroidFrame;
private _delayedNavigationEntry: definition.BackstackEntry;
private _containerViewId: number;
private _containerViewId: number = -1;
private _listener: android.view.View.OnAttachStateChangeListener;
constructor() {
super();
@@ -379,7 +379,10 @@ export class Frame extends frameCommon.Frame {
public _createUI() {
let root = new org.nativescript.widgets.ContentLayout(this._context);
this._containerViewId = android.view.View.generateViewId();
if (this._containerViewId < 0) {
this._containerViewId = android.view.View.generateViewId();
}
this._android.rootViewGroup = root;
this._android.rootViewGroup.setId(this._containerViewId);
this._android.rootViewGroup.addOnAttachStateChangeListener(this._listener);

View File

@@ -166,7 +166,7 @@ export class Frame extends frameCommon.Frame {
newValue = !page.actionBarHidden;
}
else {
newValue = this.backStack.length > 0 || (page && page.actionBar && !page.actionBar._isEmpty());
newValue = this.ios.controller.viewControllers.count > 1 || (page && page.actionBar && !page.actionBar._isEmpty());
}
newValue = !!newValue; // Make sure it is boolean
@@ -174,7 +174,7 @@ export class Frame extends frameCommon.Frame {
}
}
public get ios(): definition.iOSFrame {
public get ios(): iOSFrame {
return this._ios;
}
@@ -706,7 +706,7 @@ class iOSFrame implements definition.iOSFrame {
public set showNavigationBar(value: boolean) {
var change = this._showNavigationBar !== value;
this._showNavigationBar = value;
this._controller.navigationBarHidden = !value;
this._controller.setNavigationBarHiddenAnimated(!value, true);
let currentPage = this._controller.owner.currentPage;
if (currentPage && change) {

View File

@@ -43,14 +43,14 @@ function onSeparatorColorPropertyChanged(data: dependencyObservable.PropertyChan
export class ListView extends common.ListView {
private _android: android.widget.ListView;
public _realizedItems = {};
private _androidViewId: number;
private _androidViewId: number = -1;
public _createUI() {
this._android = new android.widget.ListView(this._context);
// Fixes issue with black random black items when scrolling
this._android.setCacheColorHint(android.graphics.Color.TRANSPARENT);
if (!this._androidViewId) {
if (this._androidViewId < 0) {
this._androidViewId = android.view.View.generateViewId();
}
this._android.setId(this._androidViewId);

View File

@@ -12,7 +12,7 @@ common.orientationProperty.metadata.onValueChanged = function scrollViewOrientat
export class ScrollView extends common.ScrollView implements definition.ScrollView {
private _android: org.nativescript.widgets.VerticalScrollView | org.nativescript.widgets.HorizontalScrollView;
private _androidViewId: number;
private _androidViewId: number = -1;
private handler: android.view.ViewTreeObserver.OnScrollChangedListener;
get android(): android.view.ViewGroup {
@@ -86,7 +86,7 @@ export class ScrollView extends common.ScrollView implements definition.ScrollVi
this._android = new org.nativescript.widgets.VerticalScrollView(this._context);
}
if (!this._androidViewId) {
if (this._androidViewId < 0) {
this._androidViewId = android.view.View.generateViewId();
}

View File

@@ -191,7 +191,7 @@ export class TabView extends common.TabView {
private _tabLayout: org.nativescript.widgets.TabLayout;
private _viewPager: android.support.v4.view.ViewPager;
private _pagerAdapter: android.support.v4.view.PagerAdapter;
private _androidViewId: number;
private _androidViewId: number = -1;
private _pageChagedListener: android.support.v4.view.ViewPager.SimpleOnPageChangeListener;
@@ -227,7 +227,7 @@ export class TabView extends common.TabView {
this._viewPager.setLayoutParams(lp);
this._grid.addView(this._viewPager);
if (!this._androidViewId) {
if (this._androidViewId < 0) {
this._androidViewId = android.view.View.generateViewId();
}
this._grid.setId(this._androidViewId);