Skip to content

Commit 19ee47b

Browse files
Hristo HristovHristo Hristov
authored andcommitted
got to layouts
1 parent 07e2102 commit 19ee47b

76 files changed

Lines changed: 950 additions & 1011 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎tns-core-modules/application/application-common.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
require("globals");
22
import definition = require("application");
33
import observable = require("data/observable");
4-
import frame = require("ui/frame");
5-
import {RuleSet} from "ui/styling/css-selector";
4+
// TODO: Raise event on("livesync") and attach this handler in the ui/frame module.
5+
import { NavigationEntry, reloadPage } from "ui/frame";
6+
import { RuleSet } from "ui/styling/css-selector";
67
import * as fileSystemModule from "file-system";
78
import * as styleScopeModule from "ui/styling/style-scope";
8-
import * as fileResolverModule from "file-system/file-name-resolver";
9+
import * as fileResolverModule from "file-system/file-name-resolver";
910
import * as builderModule from "ui/builder";
1011
import "../bundle-entry-points";
1112

@@ -30,7 +31,7 @@ export var uncaughtErrorEvent = "uncaughtError";
3031
export var orientationChangedEvent = "orientationChanged";
3132

3233
export var mainModule: string;
33-
export var mainEntry: frame.NavigationEntry;
34+
export var mainEntry: NavigationEntry;
3435

3536
export var cssFile: string = "app.css"
3637

@@ -132,6 +133,6 @@ export function __onLiveSync() {
132133

133134
export function __onLiveSyncCore() {
134135
// Reload current page.
135-
frame.reloadPage();
136+
reloadPage();
136137
}
137138
global.__onLiveSyncCore = __onLiveSyncCore;

‎tns-core-modules/application/application.android.ts‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import definition = require("application");
33
import frame = require("ui/frame");
44
import observable = require("data/observable");
55
import * as typesModule from "utils/types";
6-
import * as enumsModule from "ui/enums";
7-
let enums: typeof enumsModule;
86

97
global.moduleMerge(appModule, exports);
108
const typedExports: typeof definition = exports;
@@ -129,22 +127,18 @@ function initComponentCallbacks() {
129127
return;
130128
}
131129

132-
if (!enums) {
133-
enums = require("ui/enums");
134-
}
135-
136130
currentOrientation = newOrientation;
137131
let newValue;
138132

139133
switch (newOrientation) {
140134
case android.content.res.Configuration.ORIENTATION_LANDSCAPE:
141-
newValue = enums.DeviceOrientation.landscape;
135+
newValue = "landscape";
142136
break;
143137
case android.content.res.Configuration.ORIENTATION_PORTRAIT:
144-
newValue = enums.DeviceOrientation.portrait;
138+
newValue = "portrait";
145139
break;
146140
default:
147-
newValue = enums.DeviceOrientation.unknown;
141+
newValue = "unknown";
148142
break;
149143
}
150144

‎tns-core-modules/application/application.d.ts‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
* Contains the application abstraction with all related methods.
33
*/
44
declare module "application" {
5-
import {RuleSet} from "ui/styling/css-selector";
6-
import observable = require("data/observable");
7-
import frame = require("ui/frame");
8-
import {View} from "ui/core/view";
5+
import { RuleSet } from "ui/styling/css-selector";
6+
import { NavigationEntry, View, Observable } from "ui/frame";
7+
98
/**
109
* An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code.
1110
*/
@@ -69,7 +68,7 @@ declare module "application" {
6968
* The name of the event.
7069
*/
7170
eventName: string;
72-
71+
7372
/**
7473
* The instance that has raised the event.
7574
*/
@@ -79,7 +78,7 @@ declare module "application" {
7978
/**
8079
* Event data containing information for launch event.
8180
*/
82-
export interface LaunchEventData extends ApplicationEventData {
81+
export interface LaunchEventData extends ApplicationEventData {
8382
/**
8483
* The root view for this Window on iOS or Activity for Android.
8584
* 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" {
9493
/**
9594
* New orientation value.
9695
*/
97-
newValue: string;
96+
newValue: "portrait" | "landscape" | "unknown";
9897
}
9998

10099
/**
@@ -109,7 +108,7 @@ declare module "application" {
109108
/**
110109
* The main navigation entry to be used when loading the main Page.
111110
*/
112-
export var mainEntry: frame.NavigationEntry;
111+
export var mainEntry: NavigationEntry;
113112

114113
/**
115114
* An application level static resources.
@@ -156,7 +155,7 @@ declare module "application" {
156155
/**
157156
* Call this method to start the application. Important: All code after this method call will not be executed!
158157
*/
159-
export function start(entry?: frame.NavigationEntry);
158+
export function start(entry?: NavigationEntry);
160159

161160
/**
162161
* 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" {
351350
/**
352351
* The abstraction of an Android-specific application object.
353352
*/
354-
export class AndroidApplication extends observable.Observable {
353+
export class AndroidApplication extends Observable {
355354
/**
356355
* The [android Application](http://developer.android.com/reference/android/app/Application.html) object instance provided to the init of the module.
357356
*/
@@ -386,7 +385,7 @@ declare module "application" {
386385
* True if the main application activity is not running (suspended), false otherwise.
387386
*/
388387
paused: boolean;
389-
388+
390389
/**
391390
* Initialized the android-specific application object with the native android.app.Application instance.
392391
* This is useful when creating custom application types.
@@ -433,7 +432,7 @@ declare module "application" {
433432
* [Deprecated. Please use the respective event instead.] Direct handler of the onActivityResult method.
434433
*/
435434
onActivityResult: (requestCode: number, resultCode: number, data: any /* android.content.Intent */) => void;
436-
435+
437436
/**
438437
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
439438
* @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" {
536535
* String value used when hooking to activityBackPressed event.
537536
*/
538537
public static activityBackPressedEvent: string;
539-
538+
540539
/**
541540
* String value used when hooking to requestPermissions event.
542541
*/
@@ -573,7 +572,7 @@ declare module "application" {
573572
/**
574573
* The key window.
575574
*/
576-
window: any /* UIWindow */;
575+
window: any /* UIWindow */;
577576

578577
/**
579578
* The [UIApplication](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html).
@@ -602,7 +601,7 @@ declare module "application" {
602601
*/
603602
removeNotificationObserver(observer: any, notificationName: string): void;
604603
}
605-
604+
606605
/* tslint:disable */
607606
export interface RootViewControllerImpl {
608607

‎tns-core-modules/application/application.ios.ts‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import {Frame, NavigationEntry} from "ui/frame";
33
import definition = require("application");
44
import * as uiUtils from "ui/utils";
55
import * as typesModule from "utils/types";
6-
import * as enumsModule from "ui/enums";
7-
86
import * as utils from "utils/utils";
97

108
global.moduleMerge(common, exports);
@@ -188,20 +186,18 @@ class IOSApplication implements definition.iOSApplication {
188186
if (this._currentOrientation !== orientation) {
189187
this._currentOrientation = orientation;
190188

191-
var enums: typeof enumsModule = require("ui/enums");
192-
193-
var newValue;
189+
let newValue: "portrait" | "landscape" | "unknown";
194190
switch (orientation) {
195191
case UIDeviceOrientation.LandscapeRight:
196192
case UIDeviceOrientation.LandscapeLeft:
197-
newValue = enums.DeviceOrientation.landscape;
193+
newValue = "landscape";
198194
break;
199195
case UIDeviceOrientation.Portrait:
200196
case UIDeviceOrientation.PortraitUpsideDown:
201-
newValue = enums.DeviceOrientation.portrait;
197+
newValue = "portrait";
202198
break;
203199
default:
204-
newValue = enums.DeviceOrientation.unknown;
200+
newValue = "unknown";
205201
break;
206202
}
207203

‎tns-core-modules/file-system/file-name-resolver.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ export class FileNameResolver implements definition.FileNameResolver {
138138
var candidates = this.getFileCandidatesFromFolder(path, ext);
139139
result = findFileMatch(path, ext, candidates, this._context);
140140

141-
if (trace.enabled) {
142-
trace.write("Resolved file name for \"" + path + ext + "\" result: " + (result ? result : "no match found"), trace.categories.Navigation);
141+
if (traceEnabled) {
142+
traceWrite("Resolved file name for \"" + path + ext + "\" result: " + (result ? result : "no match found"), traceCategories.Navigation);
143143
}
144144
return result;
145145
}
@@ -162,8 +162,8 @@ export class FileNameResolver implements definition.FileNameResolver {
162162
});
163163
}
164164
else {
165-
if (trace.enabled) {
166-
trace.write("Could not find folder " + folderPath + " when loading " + path + ext, trace.categories.Navigation);
165+
if (traceEnabled) {
166+
traceWrite("Could not find folder " + folderPath + " when loading " + path + ext, traceCategories.Navigation);
167167
}
168168
}
169169

@@ -175,8 +175,8 @@ export function findFileMatch(path: string, ext: string, candidates: Array<strin
175175
var bestValue = -1
176176
var result: string = null;
177177

178-
if (trace.enabled) {
179-
trace.write("Candidates for " + path + ext + ": " + candidates.join(", "), trace.categories.Navigation);
178+
if (traceEnabled) {
179+
traceWrite("Candidates for " + path + ext + ": " + candidates.join(", "), traceCategories.Navigation);
180180
}
181181
for (var i = 0; i < candidates.length; i++) {
182182
var filePath = candidates[i];

‎tns-core-modules/text/formatted-string-common.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { isString } from "utils/types";
77
import { Color } from "color";
88

99
export module knownCollections {
10-
export let spans = "spans";
10+
export const spans = "spans";
1111
}
1212

13-
let CHILD_SPAN = "Span";
14-
let CHILD_FORMATTED_TEXT = "formattedText";
15-
let CHILD_FORMATTED_STRING = "FormattedString";
13+
const CHILD_SPAN = "Span";
14+
const CHILD_FORMATTED_TEXT = "formattedText";
15+
const CHILD_FORMATTED_STRING = "FormattedString";
1616

1717
export abstract class FormattedStringBase extends Observable implements FormattedStringDefinition, AddArrayFromBuilder, AddChildFromBuilder {
1818
private _spans: ObservableArray<Span>;

‎tns-core-modules/trace/Readme.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ How to specify category(s):
1313
```js
1414
import trace = require("trace");
1515
// only the Layout messages are traced
16-
trace.setCategories(trace.categories.Layout);
16+
trace.setCategories(traceCategories.Layout);
1717
```
1818

1919
```js
2020
import trace = require("trace");
2121
// set Layout + VisualTreeEvents categories
22-
trace.setCategories(trace.categories.concat(trace.categories.Layout, trace.categories.VisualTreeEvents));
22+
trace.setCategories(traceCategories.concat(traceCategories.Layout, traceCategories.VisualTreeEvents));
2323
```
2424

2525
```js
2626
import trace = require("trace");
2727
// trace everything
28-
trace.setCategories(trace.categories.All);
28+
trace.setCategories(traceCategories.All);
2929
```
3030

3131
How to trace:
3232

3333
```js
3434
import trace = require("trace");
35-
trace.write("tracing message", trace.categories.Layout);
35+
traceWrite("tracing message", traceCategories.Layout);
3636
```
3737

3838
The module also supports events notifications through the EventListener interface. You may call the `trace.notifyEvent` method and all registered listeners will receive a notification for the event.

‎tns-core-modules/ui/action-bar/action-bar.android.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ActionItemBase, ActionBarBase, isVisible, View, colorProperty, Color }
33
import { RESOURCE_PREFIX } from "utils/utils";
44
import { fromFileOrResource } from "image-source";
55
import * as application from "application";
6-
import * as trace from "trace";
76

87
export * from "./action-bar-common";
98

@@ -316,7 +315,6 @@ export class ActionBar extends ActionBarBase {
316315

317316
if (this.nativeView && child._nativeView) {
318317
this.nativeView.removeView(child._nativeView);
319-
trace.notifyEvent(child, "childInLayoutRemovedFromNativeVisualTree");
320318
}
321319
}
322320

‎tns-core-modules/ui/activity-indicator/activity-indicator-common.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export class ActivityIndicatorBase extends View implements ActivityIndicatorDefi
77
public busy: boolean;
88
}
99

10-
export let busyProperty = new Property<ActivityIndicatorBase, boolean>({ name: "busy", defaultValue: false, valueConverter: booleanConverter });
10+
export const busyProperty = new Property<ActivityIndicatorBase, boolean>({ name: "busy", defaultValue: false, valueConverter: booleanConverter });
1111
busyProperty.register(ActivityIndicatorBase);

‎tns-core-modules/ui/animation/animation-common.ts‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
Pair
77
} from "ui/animation";
88

9-
import { View, Color } from "ui/core/view";
10-
import * as trace from "trace";
9+
import { View, Color, traceEnabled, traceWrite, traceCategories } from "ui/core/view";
1110

1211
export * from "ui/core/view";
13-
export { trace };
1412

1513
export module Properties {
1614
export var opacity = "opacity";
@@ -65,8 +63,8 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
6563
throw new Error("No animation definitions specified");
6664
}
6765

68-
if (trace.enabled) {
69-
trace.write("Analyzing " + animationDefinitions.length + " animation definitions...", trace.categories.Animation);
66+
if (traceEnabled) {
67+
traceWrite("Analyzing " + animationDefinitions.length + " animation definitions...", traceCategories.Animation);
7068
}
7169

7270
this._propertyAnimations = new Array<PropertyAnimation>();
@@ -78,8 +76,8 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
7876
if (this._propertyAnimations.length === 0) {
7977
throw new Error("Nothing to animate.");
8078
}
81-
if (trace.enabled) {
82-
trace.write("Created " + this._propertyAnimations.length + " individual property animations.", trace.categories.Animation);
79+
if (traceEnabled) {
80+
traceWrite("Created " + this._propertyAnimations.length + " individual property animations.", traceCategories.Animation);
8381
}
8482

8583
this._playSequentially = playSequentially;

0 commit comments

Comments
 (0)