From 86430bec3dbd838f1fd81a126b82acf7df812fb4 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Thu, 11 Jun 2015 17:32:51 +0300 Subject: [PATCH] stylers fixed --- ui/styling/stylers.android.ts | 23 ++++++++--------------- ui/styling/stylers.ios.ts | 8 ++++---- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/ui/styling/stylers.android.ts b/ui/styling/stylers.android.ts index 9fb6f1daf..34a9ce724 100644 --- a/ui/styling/stylers.android.ts +++ b/ui/styling/stylers.android.ts @@ -96,7 +96,7 @@ class BorderGradientDrawable extends android.graphics.drawable.GradientDrawable } function onBorderPropertyChanged(v: view.View) { - if (!this._nativeView) { + if (!v._nativeView) { return; } @@ -109,6 +109,10 @@ function onBorderPropertyChanged(v: view.View) { nativeView.setBackground(bkg); } + var padding = v.borderWidth * utils.layout.getDisplayDensity(); + + nativeView.setPadding(padding, padding, padding, padding); + bkg.borderWidth = v.borderWidth; bkg.cornerRadius = v.borderRadius; bkg.borderColor = v.borderColor ? v.borderColor.android : android.graphics.Color.TRANSPARENT; @@ -121,7 +125,7 @@ function onBorderPropertyChanged(v: view.View) { export class DefaultStyler implements definition.stylers.Styler { //Background methods private static setBackgroundProperty(view: view.View, newValue: any) { - (view.android).setBackgroundColor(newValue); + onBorderPropertyChanged(view); } private static resetBackgroundProperty(view: view.View, nativeValue: any) { @@ -143,12 +147,7 @@ export class DefaultStyler implements definition.stylers.Styler { //Background image methods private static setBackgroundImageSourceProperty(view: view.View, newValue: any) { - var nativeView = view.android; - var bmp = newValue; - var d = new android.graphics.drawable.BitmapDrawable(bmp); - d.setTileModeXY(android.graphics.Shader.TileMode.REPEAT, android.graphics.Shader.TileMode.REPEAT); - d.setDither(true); - nativeView.setBackgroundDrawable(d); + onBorderPropertyChanged(view); } private static resetBackgroundImageSourceProperty(view: view.View, nativeValue: any) { @@ -158,13 +157,7 @@ export class DefaultStyler implements definition.stylers.Styler { } private static getNativeBackgroundImageSourceValue(view: view.View): any { - var drawable = view.android.getBackground(); - - if (drawable instanceof android.graphics.drawable.BitmapDrawable) { - return drawable; - } - - return undefined; + return view.android.getBackground(); } //Border width methods diff --git a/ui/styling/stylers.ios.ts b/ui/styling/stylers.ios.ts index c5bdefe40..11e9ea95e 100644 --- a/ui/styling/stylers.ios.ts +++ b/ui/styling/stylers.ios.ts @@ -101,14 +101,14 @@ export class DefaultStyler implements definition.stylers.Styler { //Border color methods private static setBorderColorProperty(view: view.View, newValue: any) { - if (view._nativeView instanceof UIView && newValue instanceof color.Color) { - (view._nativeView).layer.borderColor = (newValue).ios.CGColor; + if (view._nativeView instanceof UIView && newValue instanceof UIColor) { + (view._nativeView).layer.borderColor = (newValue).CGColor; } } private static resetBorderColorProperty(view: view.View, nativeValue: any) { - if (view._nativeView instanceof UIView && nativeValue instanceof color.Color) { - (view._nativeView).layer.borderColor = (nativeValue).ios.CGColor; + if (view._nativeView instanceof UIView && nativeValue instanceof UIColor) { + (view._nativeView).layer.borderColor = (nativeValue).CGColor; } }