android LayoutParams are not overridden (#2383)

* LayoutParams are no longer overriden with CommonLayoutParams

* Small code refactoring to get intellisense
This commit is contained in:
Hristo Hristov
2016-06-29 17:13:37 +03:00
committed by Hristo Hristov
parent cdee27f130
commit f201465fb3
5 changed files with 102 additions and 72 deletions

View File

@@ -10,13 +10,11 @@ function setNativeProperty(data: PropertyChangeData, setter: (lp: org.nativescri
var view = data.object;
if (view instanceof View) {
var nativeView: android.view.View = view._nativeView;
var lp = <org.nativescript.widgets.CommonLayoutParams>nativeView.getLayoutParams();
if (!(lp instanceof org.nativescript.widgets.CommonLayoutParams)) {
lp = new org.nativescript.widgets.CommonLayoutParams();
var lp = nativeView.getLayoutParams() || new org.nativescript.widgets.CommonLayoutParams();
if (lp instanceof org.nativescript.widgets.CommonLayoutParams) {
setter(lp);
nativeView.setLayoutParams(lp);
}
setter(lp);
nativeView.setLayoutParams(lp);
}
}