refactoring circular imports

This commit is contained in:
Hristo Hristov
2017-03-06 14:01:22 +02:00
parent 347755367e
commit ea22eb9c20
82 changed files with 2229 additions and 2188 deletions

View File

@@ -1,16 +1,7 @@
declare module "utils/utils" {
import * as colorModule from "color";
export var RESOURCE_PREFIX: string;
//@private
/**
* Used by various android event listener implementations
*/
interface Owned {
owner: any;
}
/**
* Used to cache and restore Android views' layer type, i.e. android.view.View.getLayerType and android.view.View.setLayerType.
*/
@@ -159,17 +150,6 @@
*/
export function getter<T>(_this: any, propertyValue: T | {(): T}): T;
// Common properties between UILabel, UITextView and UITextField
export interface TextUIView {
font: any;
textAlignment: number;
textColor: any;
text: string;
attributedText: any;
lineBreakMode: number;
numberOfLines: number;
}
/**
* Utility module dealing with some iOS collections.
*/
@@ -186,15 +166,11 @@
export function nsArrayToJSArray(a: any): string[];
}
/**
* Gets NativeScript color from [UIColor](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIColor_Class/).
* @param uiColor - UIColor instance used to create a NativeScript color.
*/
export function getColor(uiColor: any /* UIColor */): colorModule.Color;
/**
* Gets an information about if current mode is Landscape.
*/
export function isLandscape(): boolean;
/**
* Gets the iOS device major version (for 8.1 will return 8).
*/
@@ -240,7 +216,7 @@
* Converts string value to number or boolean.
* @param value The original value.
*/
export function convertString(value: any): any
export function convertString(value: string): boolean | number;
/**
* Sorts an array by using merge sort algoritm (which ensures stable sort since the built-in Array.sort() does not promise a stable sort).

View File

@@ -1,5 +1,4 @@
import { Color } from "color";
import * as fsModule from "file-system";
import * as fsModule from "file-system";
import {
write as traceWrite, categories as traceCategories, messageType as traceMessageType
} from "trace";
@@ -58,21 +57,6 @@ export module ios {
}
}
export function getColor(uiColor: UIColor): Color {
var redRef = new interop.Reference<number>();
var greenRef = new interop.Reference<number>();
var blueRef = new interop.Reference<number>();
var alphaRef = new interop.Reference<number>();
uiColor.getRedGreenBlueAlpha(redRef, greenRef, blueRef, alphaRef);
var red = redRef.value * 255;
var green = greenRef.value * 255;
var blue = blueRef.value * 255;
var alpha = alphaRef.value * 255;
return new Color(alpha, red, green, blue);
}
export function isLandscape(): boolean {
var device = getter(UIDevice, UIDevice.currentDevice);
var statusBarOrientation = getter(UIApplication, UIApplication.sharedApplication).statusBarOrientation;