Resolved Issue #1242: Add Page showingModally event.

This commit is contained in:
Rossen Hristov
2015-12-12 16:42:23 +02:00
parent 55cbbb977a
commit d2c7b9968a
8 changed files with 40 additions and 4 deletions

View File

@@ -35,6 +35,7 @@ export class Page extends ContentView implements dts.Page {
public static navigatingFromEvent = "navigatingFrom";
public static navigatedFromEvent = "navigatedFrom";
public static shownModallyEvent = "shownModally";
public static showingModallyEvent = "showingModally";
protected _closeModalCallback: Function;
@@ -251,6 +252,13 @@ export class Page extends ContentView implements dts.Page {
});
}
protected _raiseShowingModallyEvent() {
this.notify({
eventName: Page.showingModallyEvent,
object: this
});
}
public _getStyleScope(): styleScope.StyleScope {
return this._styleScope;
}

View File

@@ -125,8 +125,9 @@ export class Page extends pageCommon.Page {
this._dialogFragment = new DialogFragmentClass(this, fullscreen, function () {
that.closeModal();
});
this._dialogFragment.show(parent.frame.android.activity.getFragmentManager(), "dialog");
super._raiseShowingModallyEvent();
this._dialogFragment.show(parent.frame.android.activity.getFragmentManager(), "dialog");
super._raiseShownModallyEvent(parent, context, closeCallback);
}

12
ui/page/page.d.ts vendored
View File

@@ -61,6 +61,11 @@ declare module "ui/page" {
*/
public static actionBarHiddenProperty: dependencyObservable.Property;
/**
* String value used when hooking to showingModally event.
*/
public static showingModallyEvent: string;
/**
* String value used when hooking to shownModally event.
*/
@@ -159,7 +164,12 @@ declare module "ui/page" {
on(event: "navigatedFrom", callback: (args: NavigatedData) => void, thisArg?: any);
/**
* Raised when the page is shown as a modal dialog.
* Raised before the page is shown as a modal dialog.
*/
on(event: "showingModally", callback: (args: observable.EventData) => void, thisArg?: any);
/**
* Raised after the page is shown as a modal dialog.
*/
on(event: "shownModally", callback: (args: ShownModallyData) => void, thisArg?: any);

View File

@@ -241,6 +241,7 @@ export class Page extends pageCommon.Page {
this._UIModalPresentationFormSheet = true;
}
super._raiseShowingModallyEvent();
var that = this;
parent.ios.presentViewControllerAnimatedCompletion(this._ios, false, function completion() {
that._raiseShownModallyEvent(parent, context, closeCallback);