Initial prototype of Frame + Page + Navigation.

This commit is contained in:
atanasovg
2014-06-12 17:37:55 +03:00
parent ef7c3ce677
commit 2c4781db01
26 changed files with 520 additions and 80 deletions

View File

@@ -1,5 +1,6 @@
import appModule = require("application/application-common");
import dts = require("application");
import frame = require("ui/frame");
// merge the exports of the application_common file with the exports of this file
declare var exports;
@@ -112,7 +113,7 @@ class AndroidApplication implements dts.AndroidApplication {
public foregroundActivity: android.app.Activity;
public startActivity: android.app.Activity;
public packageName: string;
public getActivity: (intent: android.content.Intent) => any;
// public getActivity: (intent: android.content.Intent) => any;
public onActivityCreated: (activity: android.app.Activity, bundle: android.os.Bundle) => void;
public onActivityDestroyed: (activity: android.app.Activity) => void;
@@ -128,7 +129,15 @@ class AndroidApplication implements dts.AndroidApplication {
this.nativeApp = nativeApp;
this.packageName = nativeApp.getPackageName();
this.context = nativeApp.getApplicationContext();
this.getActivity = undefined;
}
public getActivity(intent: android.content.Intent): any {
var currentPage = rootFrame.currentPage;
if (!currentPage) {
throw new Error("Root frame not navigated to a page.");
}
return currentPage.android.getActivityExtends();
}
public init() {
@@ -136,4 +145,7 @@ class AndroidApplication implements dts.AndroidApplication {
this.nativeApp.registerActivityLifecycleCallbacks(this._eventsToken);
this.context = this.nativeApp.getApplicationContext();
}
}
}
// The root frame of the application
export var rootFrame = new frame.Frame();