From 41168d3782d0c2bebfc579dcec6cf6427350033f Mon Sep 17 00:00:00 2001 From: hshristov Date: Thu, 16 Jul 2015 01:22:16 +0300 Subject: [PATCH] Layouts are now implemented natively for Android. --- apps/tests/pages/page9.ts | 2 +- ui/layouts/layout.d.ts | 2 +- ui/layouts/wrap-layout/wrap-layout-common.ts | 5 +- ui/styling/style.ts | 49 ++++++++++++++++++-- ui/styling/stylers.android.ts | 4 +- 5 files changed, 51 insertions(+), 11 deletions(-) diff --git a/apps/tests/pages/page9.ts b/apps/tests/pages/page9.ts index d11d66d91..491861d07 100644 --- a/apps/tests/pages/page9.ts +++ b/apps/tests/pages/page9.ts @@ -25,4 +25,4 @@ export function createPage() { page.content = grid; page.css = "GridLayout { background-color: pink } image { background-color: green }"; return page; -} \ No newline at end of file +} diff --git a/ui/layouts/layout.d.ts b/ui/layouts/layout.d.ts index 42bb4b9b9..92ad93e91 100644 --- a/ui/layouts/layout.d.ts +++ b/ui/layouts/layout.d.ts @@ -7,4 +7,4 @@ export class Layout extends layoutBase.LayoutBase { // } -} \ No newline at end of file +} diff --git a/ui/layouts/wrap-layout/wrap-layout-common.ts b/ui/layouts/wrap-layout/wrap-layout-common.ts index a1db2c73b..f9c1579dc 100644 --- a/ui/layouts/wrap-layout/wrap-layout-common.ts +++ b/ui/layouts/wrap-layout/wrap-layout-common.ts @@ -6,7 +6,6 @@ import proxy = require("ui/core/proxy"); // on Android we explicitly set propertySettings to None because android will invalidate its layout (so we skip unnecessary native call). var AffectsLayout = global.android ? dependencyObservable.PropertyMetadataSettings.None : dependencyObservable.PropertyMetadataSettings.AffectsLayout; -var defailtItemWidthHeight = global.android ? 0 : Number.NaN; function isWidthHeightValid(value: any): boolean { return (value >= 0.0 && value !== Number.POSITIVE_INFINITY); @@ -22,10 +21,10 @@ export class WrapLayout extends layouts.LayoutBase implements definition.WrapLay new proxy.PropertyMetadata(enums.Orientation.horizontal, AffectsLayout, undefined, isValidOrientation)); public static itemWidthProperty = new dependencyObservable.Property("itemWidth", "WrapLayout", - new proxy.PropertyMetadata(defailtItemWidthHeight, AffectsLayout, undefined, isWidthHeightValid)); + new proxy.PropertyMetadata(0, AffectsLayout, undefined, isWidthHeightValid)); public static itemHeightProperty = new dependencyObservable.Property("itemHeight", "WrapLayout", - new proxy.PropertyMetadata(defailtItemWidthHeight, AffectsLayout, undefined, isWidthHeightValid)); + new proxy.PropertyMetadata(0, AffectsLayout, undefined, isWidthHeightValid)); get orientation(): string { return this._getValue(WrapLayout.orientationProperty); diff --git a/ui/styling/style.ts b/ui/styling/style.ts index 1ce99fa20..7cf4de96c 100644 --- a/ui/styling/style.ts +++ b/ui/styling/style.ts @@ -147,6 +147,47 @@ function isMinWidthHeightValid(value: number): boolean { return !isNaN(value) && value >= 0.0 && isFinite(value); } +function onBackgroundImagePropertyChanged(data: observable.PropertyChangeData) { + var style =