Skip to content

Commit 2b28730

Browse files
committed
Split get/set native to getDefault setNative
1 parent a777e16 commit 2b28730

File tree

60 files changed

+777
-907
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+777
-907
lines changed

tests/app/ui/view/view-tests-common.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,18 +285,18 @@ class TestView extends Layout {
285285
this.setMeasuredDimension(100, 100);
286286
}
287287

288-
get [customCssProperty.native](): string {
288+
[customCssProperty.getDefault](): string {
289289
return "customCssPropertyDefaultValue";
290290
}
291-
set [customCssProperty.native](value: string) {
291+
[customCssProperty.setNative](value: string) {
292292
this.cssPropCounter++;
293293
this.cssPropNativeValue = value;
294294
}
295295

296-
get [customViewProperty.native](): string {
296+
[customViewProperty.getDefault](): string {
297297
return "customViewPropertyDefaultValue";
298298
}
299-
set [customViewProperty.native](value: string) {
299+
[customViewProperty.setNative](value: string) {
300300
this.viewPropCounter++;
301301
this.viewPropNativeValue = value;
302302
}

tests/app/ui/view/view-tests.ios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ global.moduleMerge(commonTests, exports);
1212
class MyGrid extends grid.GridLayout {
1313
public backgroundSetterCount: number = 0;
1414

15-
get [view.backgroundInternalProperty.native](): any {
15+
[view.backgroundInternalProperty.getDefault](): any {
1616
return null;
1717
}
18-
set [view.backgroundInternalProperty.native](value: any) {
18+
[view.backgroundInternalProperty.setNative](value: any) {
1919
this.backgroundSetterCount ++;
2020
}
2121

tns-core-modules/ui/action-bar/action-bar.android.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,15 @@ export class ActionBar extends ActionBarBase {
355355
}
356356
}
357357

358-
get [colorProperty.native](): number {
358+
[colorProperty.getDefault](): number {
359359
if (!defaultTitleTextColor) {
360360
let textView = new android.widget.TextView(this._context);
361361
defaultTitleTextColor = textView.getTextColors().getDefaultColor();
362362
}
363363

364364
return defaultTitleTextColor;
365365
}
366-
set [colorProperty.native](value: number | Color) {
366+
[colorProperty.setNative](value: number | Color) {
367367
let color = value instanceof Color ? value.android : value;
368368
this.nativeView.setTitleTextColor(color);
369369
}

tns-core-modules/ui/action-bar/action-bar.ios.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,10 @@ export class ActionBar extends ActionBarBase {
306306
return (<UINavigationController>page.frame.ios.controller).navigationBar;
307307
}
308308

309-
get [colorProperty.native](): UIColor {
309+
[colorProperty.getDefault](): UIColor {
310310
return null;
311311
}
312-
set [colorProperty.native](color: Color) {
312+
[colorProperty.setNative](color: Color) {
313313
const navBar = this.navBar;
314314
if (color) {
315315
navBar.tintColor = color.ios;
@@ -320,22 +320,22 @@ export class ActionBar extends ActionBarBase {
320320
}
321321
}
322322

323-
get [backgroundColorProperty.native](): UIColor {
323+
[backgroundColorProperty.getDefault](): UIColor {
324324
// This getter is never called.
325325
// CssAnimationProperty use default value form their constructor.
326326
return null;
327327
}
328-
set [backgroundColorProperty.native](value: UIColor | Color) {
328+
[backgroundColorProperty.setNative](value: UIColor | Color) {
329329
let navBar = this.navBar;
330330
if (navBar) {
331331
let color = value instanceof Color ? value.ios : value;
332332
navBar.barTintColor = color;
333333
}
334334
}
335335

336-
get [backgroundInternalProperty.native](): UIColor {
336+
[backgroundInternalProperty.getDefault](): UIColor {
337337
return null;
338338
}
339-
set [backgroundInternalProperty.native](value: UIColor) { // tslint:disable-line
339+
[backgroundInternalProperty.setNative](value: UIColor) { // tslint:disable-line
340340
}
341341
}

tns-core-modules/ui/activity-indicator/activity-indicator.android.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ export class ActivityIndicator extends ActivityIndicatorBase {
1616
return this._progressBar;
1717
}
1818

19-
get [busyProperty.native](): boolean {
19+
[busyProperty.getDefault](): boolean {
2020
return false;
2121
}
22-
set [busyProperty.native](value: boolean) {
22+
[busyProperty.setNative](value: boolean) {
2323
if (this.visibility === Visibility.VISIBLE) {
2424
this._progressBar.setVisibility(value ? android.view.View.VISIBLE : android.view.View.INVISIBLE);
2525
}
2626
}
2727

28-
get [visibilityProperty.native](): Visibility {
28+
[visibilityProperty.getDefault](): Visibility {
2929
return Visibility.HIDDEN;
3030
}
31-
set [visibilityProperty.native](value: Visibility) {
31+
[visibilityProperty.setNative](value: Visibility) {
3232
switch (value) {
3333
case Visibility.VISIBLE:
3434
this._progressBar.setVisibility(this.busy ? android.view.View.VISIBLE : android.view.View.INVISIBLE);
@@ -44,14 +44,13 @@ export class ActivityIndicator extends ActivityIndicatorBase {
4444
}
4545
}
4646

47-
get [colorProperty.native](): number {
47+
[colorProperty.getDefault](): number {
4848
return -1;
4949
}
50-
set [colorProperty.native](value: number | Color) {
50+
[colorProperty.setNative](value: number | Color) {
5151
if (value instanceof Color) {
5252
this._progressBar.getIndeterminateDrawable().setColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_IN);
53-
}
54-
else {
53+
} else {
5554
this._progressBar.getIndeterminateDrawable().clearColorFilter();
5655
}
5756
}

tns-core-modules/ui/activity-indicator/activity-indicator.ios.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ export class ActivityIndicator extends ActivityIndicatorBase {
1515
return this.nativeView;
1616
}
1717

18-
get [busyProperty.native](): boolean {
18+
[busyProperty.getDefault](): boolean {
1919
if ((<any>this.nativeView).isAnimating) {
2020
return (<any>this.nativeView).isAnimating();
2121
}
2222
else {
2323
return this.nativeView.animating;
2424
}
2525
}
26-
set [busyProperty.native](value: boolean) {
26+
[busyProperty.setNative](value: boolean) {
2727
let nativeView = this.nativeView;
2828
if (value) {
2929
nativeView.startAnimating();
@@ -36,10 +36,10 @@ export class ActivityIndicator extends ActivityIndicatorBase {
3636
}
3737
}
3838

39-
get [colorProperty.native](): UIColor {
39+
[colorProperty.getDefault](): UIColor {
4040
return this.nativeView.color;
4141
}
42-
set [colorProperty.native](value: UIColor | Color) {
42+
[colorProperty.setNative](value: UIColor | Color) {
4343
this.nativeView.color = value instanceof Color ? value.ios : value;
4444
}
4545
}

tns-core-modules/ui/animation/animation.android.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export class Animation extends AnimationBase {
259259
propertyAnimation.target.style[opacityProperty.keyframe] = originalValue1;
260260
}
261261
if (propertyAnimation.target.nativeView) {
262-
propertyAnimation.target[opacityProperty.native] = propertyAnimation.target.style.opacity;
262+
propertyAnimation.target[opacityProperty.setNative](propertyAnimation.target.style.opacity);
263263
}
264264
}));
265265
animators.push(android.animation.ObjectAnimator.ofFloat(nativeView, "alpha", nativeArray));
@@ -287,8 +287,8 @@ export class Animation extends AnimationBase {
287287
propertyAnimation.target.style[backgroundColorProperty.name] = originalValue1;
288288
} else {
289289
propertyAnimation.target.style[backgroundColorProperty.keyframe] = originalValue1;
290-
if (propertyAnimation.target.nativeView) {
291-
propertyAnimation.target[backgroundColorProperty.native] = propertyAnimation.target.style.backgroundColor;
290+
if (propertyAnimation.target.nativeView && propertyAnimation.target[backgroundColorProperty.setNative]) {
291+
propertyAnimation.target[backgroundColorProperty.setNative](propertyAnimation.target.style.backgroundColor);
292292
}
293293
}
294294
}));
@@ -324,8 +324,8 @@ export class Animation extends AnimationBase {
324324
propertyAnimation.target.style[translateXProperty.keyframe] = originalValue1;
325325
propertyAnimation.target.style[translateYProperty.keyframe] = originalValue2;
326326
if (propertyAnimation.target.nativeView) {
327-
propertyAnimation.target[translateXProperty.native] = propertyAnimation.target.style.translateX;
328-
propertyAnimation.target[translateYProperty.native] = propertyAnimation.target.style.translateY;
327+
propertyAnimation.target[translateXProperty.setNative](propertyAnimation.target.style.translateX);
328+
propertyAnimation.target[translateYProperty.setNative](propertyAnimation.target.style.translateY);
329329
}
330330
}
331331
}));
@@ -365,8 +365,8 @@ export class Animation extends AnimationBase {
365365
propertyAnimation.target.style[scaleXProperty.keyframe] = originalValue1;
366366
propertyAnimation.target.style[scaleYProperty.keyframe] = originalValue2;
367367
if (propertyAnimation.target.nativeView) {
368-
propertyAnimation.target[scaleXProperty.native] = propertyAnimation.target.style.scaleX;
369-
propertyAnimation.target[scaleYProperty.native] = propertyAnimation.target.style.scaleY;
368+
propertyAnimation.target[scaleXProperty.setNative](propertyAnimation.target.style.scaleX);
369+
propertyAnimation.target[scaleYProperty.setNative](propertyAnimation.target.style.scaleY);
370370
}
371371
}
372372
}));
@@ -390,7 +390,7 @@ export class Animation extends AnimationBase {
390390
} else {
391391
propertyAnimation.target.style[rotateProperty.keyframe] = originalValue1;
392392
if (propertyAnimation.target.nativeView) {
393-
propertyAnimation.target[rotateProperty.native] = propertyAnimation.target.style.rotate;
393+
propertyAnimation.target[rotateProperty.setNative](propertyAnimation.target.style.rotate);
394394
}
395395
}
396396
}));

tns-core-modules/ui/button/button.android.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,38 +65,38 @@ export class Button extends ButtonBase {
6565
}
6666
}
6767

68-
get [paddingTopProperty.native](): Length {
68+
[paddingTopProperty.getDefault](): Length {
6969
return { value: this._defaultPaddingTop, unit: "px" }
7070
}
71-
set [paddingTopProperty.native](value: Length) {
71+
[paddingTopProperty.setNative](value: Length) {
7272
org.nativescript.widgets.ViewHelper.setPaddingTop(this.nativeView, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderTopWidth, 0));
7373
}
7474

75-
get [paddingRightProperty.native](): Length {
75+
[paddingRightProperty.getDefault](): Length {
7676
return { value: this._defaultPaddingRight, unit: "px" }
7777
}
78-
set [paddingRightProperty.native](value: Length) {
78+
[paddingRightProperty.setNative](value: Length) {
7979
org.nativescript.widgets.ViewHelper.setPaddingRight(this.nativeView, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderRightWidth, 0));
8080
}
8181

82-
get [paddingBottomProperty.native](): Length {
82+
[paddingBottomProperty.getDefault](): Length {
8383
return { value: this._defaultPaddingBottom, unit: "px" }
8484
}
85-
set [paddingBottomProperty.native](value: Length) {
85+
[paddingBottomProperty.setNative](value: Length) {
8686
org.nativescript.widgets.ViewHelper.setPaddingBottom(this.nativeView, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderBottomWidth, 0));
8787
}
8888

89-
get [paddingLeftProperty.native](): Length {
89+
[paddingLeftProperty.getDefault](): Length {
9090
return { value: this._defaultPaddingLeft, unit: "px" }
9191
}
92-
set [paddingLeftProperty.native](value: Length) {
92+
[paddingLeftProperty.setNative](value: Length) {
9393
org.nativescript.widgets.ViewHelper.setPaddingLeft(this.nativeView, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderLeftWidth, 0));
9494
}
9595

96-
get [zIndexProperty.native](): number {
96+
[zIndexProperty.getDefault](): number {
9797
return org.nativescript.widgets.ViewHelper.getZIndex(this.nativeView);
9898
}
99-
set [zIndexProperty.native](value: number) {
99+
[zIndexProperty.setNative](value: number) {
100100
org.nativescript.widgets.ViewHelper.setZIndex(this.nativeView, value);
101101
// API >= 21
102102
if (this.nativeView.setStateListAnimator) {

0 commit comments

Comments
 (0)