got to layouts

This commit is contained in:
Hristo Hristov
2016-12-09 17:57:17 +02:00
parent 07e2102c5d
commit 19ee47ba24
76 changed files with 941 additions and 1002 deletions

View File

@@ -1,11 +1,12 @@
require("globals");
import definition = require("application");
import observable = require("data/observable");
import frame = require("ui/frame");
import {RuleSet} from "ui/styling/css-selector";
// TODO: Raise event on("livesync") and attach this handler in the ui/frame module.
import { NavigationEntry, reloadPage } from "ui/frame";
import { RuleSet } from "ui/styling/css-selector";
import * as fileSystemModule from "file-system";
import * as styleScopeModule from "ui/styling/style-scope";
import * as fileResolverModule from "file-system/file-name-resolver";
import * as fileResolverModule from "file-system/file-name-resolver";
import * as builderModule from "ui/builder";
import "../bundle-entry-points";
@@ -30,7 +31,7 @@ export var uncaughtErrorEvent = "uncaughtError";
export var orientationChangedEvent = "orientationChanged";
export var mainModule: string;
export var mainEntry: frame.NavigationEntry;
export var mainEntry: NavigationEntry;
export var cssFile: string = "app.css"
@@ -132,6 +133,6 @@ export function __onLiveSync() {
export function __onLiveSyncCore() {
// Reload current page.
frame.reloadPage();
reloadPage();
}
global.__onLiveSyncCore = __onLiveSyncCore;

View File

@@ -3,8 +3,6 @@ import definition = require("application");
import frame = require("ui/frame");
import observable = require("data/observable");
import * as typesModule from "utils/types";
import * as enumsModule from "ui/enums";
let enums: typeof enumsModule;
global.moduleMerge(appModule, exports);
const typedExports: typeof definition = exports;
@@ -129,22 +127,18 @@ function initComponentCallbacks() {
return;
}
if (!enums) {
enums = require("ui/enums");
}
currentOrientation = newOrientation;
let newValue;
switch (newOrientation) {
case android.content.res.Configuration.ORIENTATION_LANDSCAPE:
newValue = enums.DeviceOrientation.landscape;
newValue = "landscape";
break;
case android.content.res.Configuration.ORIENTATION_PORTRAIT:
newValue = enums.DeviceOrientation.portrait;
newValue = "portrait";
break;
default:
newValue = enums.DeviceOrientation.unknown;
newValue = "unknown";
break;
}

View File

@@ -2,10 +2,9 @@
* Contains the application abstraction with all related methods.
*/
declare module "application" {
import {RuleSet} from "ui/styling/css-selector";
import observable = require("data/observable");
import frame = require("ui/frame");
import {View} from "ui/core/view";
import { RuleSet } from "ui/styling/css-selector";
import { NavigationEntry, View, Observable } from "ui/frame";
/**
* An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code.
*/
@@ -69,7 +68,7 @@ declare module "application" {
* The name of the event.
*/
eventName: string;
/**
* The instance that has raised the event.
*/
@@ -79,7 +78,7 @@ declare module "application" {
/**
* Event data containing information for launch event.
*/
export interface LaunchEventData extends ApplicationEventData {
export interface LaunchEventData extends ApplicationEventData {
/**
* The root view for this Window on iOS or Activity for Android.
* If not set a new Frame will be created as a root view in order to maintain backwards compatibility.
@@ -94,7 +93,7 @@ declare module "application" {
/**
* New orientation value.
*/
newValue: string;
newValue: "portrait" | "landscape" | "unknown";
}
/**
@@ -109,7 +108,7 @@ declare module "application" {
/**
* The main navigation entry to be used when loading the main Page.
*/
export var mainEntry: frame.NavigationEntry;
export var mainEntry: NavigationEntry;
/**
* An application level static resources.
@@ -156,7 +155,7 @@ declare module "application" {
/**
* Call this method to start the application. Important: All code after this method call will not be executed!
*/
export function start(entry?: frame.NavigationEntry);
export function start(entry?: NavigationEntry);
/**
* The main entry point event. This method is expected to use the root frame to navigate to the main application page.
@@ -351,7 +350,7 @@ declare module "application" {
/**
* The abstraction of an Android-specific application object.
*/
export class AndroidApplication extends observable.Observable {
export class AndroidApplication extends Observable {
/**
* The [android Application](http://developer.android.com/reference/android/app/Application.html) object instance provided to the init of the module.
*/
@@ -386,7 +385,7 @@ declare module "application" {
* True if the main application activity is not running (suspended), false otherwise.
*/
paused: boolean;
/**
* Initialized the android-specific application object with the native android.app.Application instance.
* This is useful when creating custom application types.
@@ -433,7 +432,7 @@ declare module "application" {
* [Deprecated. Please use the respective event instead.] Direct handler of the onActivityResult method.
*/
onActivityResult: (requestCode: number, resultCode: number, data: any /* android.content.Intent */) => void;
/**
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
@@ -536,7 +535,7 @@ declare module "application" {
* String value used when hooking to activityBackPressed event.
*/
public static activityBackPressedEvent: string;
/**
* String value used when hooking to requestPermissions event.
*/
@@ -573,7 +572,7 @@ declare module "application" {
/**
* The key window.
*/
window: any /* UIWindow */;
window: any /* UIWindow */;
/**
* The [UIApplication](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html).
@@ -602,7 +601,7 @@ declare module "application" {
*/
removeNotificationObserver(observer: any, notificationName: string): void;
}
/* tslint:disable */
export interface RootViewControllerImpl {

View File

@@ -3,8 +3,6 @@ import {Frame, NavigationEntry} from "ui/frame";
import definition = require("application");
import * as uiUtils from "ui/utils";
import * as typesModule from "utils/types";
import * as enumsModule from "ui/enums";
import * as utils from "utils/utils";
global.moduleMerge(common, exports);
@@ -188,20 +186,18 @@ class IOSApplication implements definition.iOSApplication {
if (this._currentOrientation !== orientation) {
this._currentOrientation = orientation;
var enums: typeof enumsModule = require("ui/enums");
var newValue;
let newValue: "portrait" | "landscape" | "unknown";
switch (orientation) {
case UIDeviceOrientation.LandscapeRight:
case UIDeviceOrientation.LandscapeLeft:
newValue = enums.DeviceOrientation.landscape;
newValue = "landscape";
break;
case UIDeviceOrientation.Portrait:
case UIDeviceOrientation.PortraitUpsideDown:
newValue = enums.DeviceOrientation.portrait;
newValue = "portrait";
break;
default:
newValue = enums.DeviceOrientation.unknown;
newValue = "unknown";
break;
}