Implemented percent support for width, height and margins

This commit is contained in:
Hristo Hristov
2015-12-15 14:36:04 +02:00
parent 9418ab8f63
commit 1dbb742908
25 changed files with 834 additions and 212 deletions

View File

@@ -63,6 +63,29 @@ export module layout {
export function getMeasureSpecSize(spec: number): number {
return (spec & ~MODE_MASK);
}
export function measureSpecToString(measureSpec: number): string {
let mode = getMeasureSpecMode(measureSpec);
let size = getMeasureSpecSize(measureSpec);
let text = "MeasureSpec: ";
if (mode === UNSPECIFIED) {
text += "UNSPECIFIED ";
}
else if (mode === EXACTLY) {
text += "EXACTLY ";
}
else if (mode === AT_MOST) {
text += "AT_MOST ";
}
else {
text += mode + " ";
}
text += size;
return text;
}
}
export function isFileOrResourcePath(path: string): boolean {

2
utils/utils.d.ts vendored
View File

@@ -60,6 +60,8 @@
* @param value - The pixel to convert.
*/
export function toDeviceIndependentPixels(value: number): number;
export function measureSpecToString(measureSpec: number): string;
}
/**