Skip to content

Commit c18a76c

Browse files
Hristo HristovHristo Hristov
authored andcommitted
rename:
_createNativeView to createNativeView; _initNativeView to initNativeView _disposeNativeView to disposeNativeView _resetNativeView to resetNativeView
1 parent f2898f8 commit c18a76c

38 files changed

+109
-108
lines changed

tests/app/ui/layouts/layout-helper.android.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ class NativeGridLayout extends org.nativescript.widgets.GridLayout {
6868
export class MyButton extends Button implements def.MyButton {
6969
nativeView: NativeButton;
7070

71-
public _createNativeView() {
71+
public createNativeView() {
7272
return new NativeButton(this._context, this);
7373
}
7474

75-
public _initNativeView(): void {
75+
public initNativeView(): void {
7676
this.nativeView.owner = this;
7777
}
7878

79-
public _disposeNativeView() {
79+
public disposeNativeView() {
8080
this.nativeView.owner = undefined;
8181
}
8282

@@ -121,15 +121,15 @@ export class MyButton extends Button implements def.MyButton {
121121
export class MyStackLayout extends StackLayout implements def.MyStackLayout {
122122
nativeView: NativeStackLayout;
123123

124-
public _createNativeView() {
124+
public createNativeView() {
125125
return new NativeStackLayout(this._context, this);
126126
}
127127

128-
public _initNativeView(): void {
128+
public initNativeView(): void {
129129
this.nativeView.owner = this;
130130
}
131131

132-
public _disposeNativeView() {
132+
public disposeNativeView() {
133133
this.nativeView.owner = undefined;
134134
}
135135

@@ -174,15 +174,15 @@ export class MyStackLayout extends StackLayout implements def.MyStackLayout {
174174
export class MyGridLayout extends GridLayout implements def.MyGridLayout {
175175
nativeView: NativeGridLayout;
176176

177-
public _createNativeView() {
177+
public createNativeView() {
178178
return new NativeGridLayout(this._context, this);
179179
}
180180

181-
public _initNativeView(): void {
181+
public initNativeView(): void {
182182
this.nativeView.owner = this;
183183
}
184184

185-
public _disposeNativeView() {
185+
public disposeNativeView() {
186186
this.nativeView.owner = undefined;
187187
}
188188

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,13 @@ class TestView extends Layout {
281281
this.nativeView = undefined;
282282
}
283283

284-
public _createNativeView() {
284+
public createNativeView() {
285285
if (isIOS) {
286286
this.nativeView = this._nativeView;
287287
return this._nativeView;
288288
}
289289

290-
return super._createNativeView();
290+
return super.createNativeView();
291291
}
292292

293293
public toString() {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class ActionBar extends ActionBarBase {
127127
}
128128
}
129129

130-
public _createNativeView() {
130+
public createNativeView() {
131131
initializeMenuItemClickListener();
132132
const toolbar = new android.support.v7.widget.Toolbar(this._context);
133133
const menuItemClickListener = new MenuItemClickListener(this);
@@ -136,11 +136,11 @@ export class ActionBar extends ActionBarBase {
136136
return toolbar;
137137
}
138138

139-
public _initNativeView(): void {
139+
public initNativeView(): void {
140140
(<any>this.nativeView).menuItemClickListener.owner = this;
141141
}
142142

143-
public _disposeNativeView() {
143+
public disposeNativeView() {
144144
(<any>this.nativeView).menuItemClickListener.owner = null;
145145
}
146146

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export * from "./activity-indicator-common";
55
export class ActivityIndicator extends ActivityIndicatorBase {
66
nativeView: android.widget.ProgressBar;
77

8-
public _createNativeView() {
8+
public createNativeView() {
99
const progressBar = new android.widget.ProgressBar(this._context);
1010
progressBar.setVisibility(android.view.View.INVISIBLE);
1111
progressBar.setIndeterminate(true);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class Button extends ButtonBase {
4141

4242
private _highlightedHandler: (args: TouchGestureEventData) => void;
4343

44-
public _createNativeView() {
44+
public createNativeView() {
4545
initializeClickListener();
4646
const button = new android.widget.Button(this._context);
4747
const clickListener = new ClickListener(this);
@@ -50,11 +50,11 @@ export class Button extends ButtonBase {
5050
return button;
5151
}
5252

53-
public _initNativeView(): void {
53+
public initNativeView(): void {
5454
(<any>this.nativeView).clickListener.owner = this;
5555
}
5656

57-
public _disposeNativeView() {
57+
public disposeNativeView() {
5858
(<any>this.nativeView).clickListener.owner = null;
5959
}
6060

tns-core-modules/ui/core/view-base/view-base.d.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,24 +202,25 @@ export abstract class ViewBase extends Observable {
202202
_tearDownUI(force?: boolean): void;
203203

204204
/**
205-
* Creates a native view
205+
* Creates a native view.
206+
* Returns either android.view.View or UIView.
206207
*/
207-
_createNativeView(): Object;
208+
createNativeView(): Object;
208209

209210
/**
210-
* Clean up references to the native view.
211+
* Initializes properties/listeners of the native view.
211212
*/
212-
_disposeNativeView(): void;
213+
initNativeView(): void;
213214

214215
/**
215-
* Initializes properties/listeners of the native view.
216+
* Clean up references to the native view.
216217
*/
217-
_initNativeView(): void;
218+
disposeNativeView(): void;
218219

219220
/**
220221
* Resets properties/listeners set to the native view.
221222
*/
222-
_resetNativeView(): void;
223+
resetNativeView(): void;
223224

224225
_isAddedToNativeVisualTree: boolean;
225226

tns-core-modules/ui/core/view-base/view-base.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function putNativeView(context: Object, view: ViewBase): void {
126126
list.push(new WeakRef(view.nativeView));
127127
}
128128

129-
export class ViewBase extends Observable implements ViewBaseDefinition {
129+
export abstract class ViewBase extends Observable implements ViewBaseDefinition {
130130
public static loadedEvent = "loaded";
131131
public static unloadedEvent = "unloaded";
132132

@@ -588,19 +588,19 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
588588
}
589589
}
590590

591-
public _createNativeView(): Object {
591+
public createNativeView(): Object {
592592
return undefined;
593593
}
594594

595-
public _disposeNativeView() {
595+
public disposeNativeView() {
596596
//
597597
}
598598

599-
public _initNativeView(): void {
599+
public initNativeView(): void {
600600
//
601601
}
602602

603-
public _resetNativeView(): void {
603+
public resetNativeView(): void {
604604
if (this.nativeView && this.recycleNativeView && isAndroid) {
605605
resetNativeView(this);
606606
}
@@ -627,7 +627,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
627627
}
628628

629629
if (!nativeView) {
630-
nativeView = <android.view.View>this._createNativeView();
630+
nativeView = <android.view.View>this.createNativeView();
631631
}
632632

633633
this._androidView = this.nativeView = nativeView;
@@ -659,14 +659,14 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
659659
}
660660
} else {
661661
// TODO: Implement _createNativeView for iOS
662-
this._createNativeView();
662+
this.createNativeView();
663663
if (!currentNativeView) {
664664
console.log(`${this.typeName} doesnt have NativeView !!!!! =================`);
665665
}
666666
// this.nativeView = this._iosView = (<any>this)._nativeView;
667667
}
668668

669-
this._initNativeView();
669+
this.initNativeView();
670670

671671
if (this.parent) {
672672
let nativeIndex = this.parent._childIndexToNativeChildIndex(atIndex);
@@ -695,7 +695,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
695695
traceWrite(`${this}._tearDownUI(${force})`, traceCategories.VisualTreeEvents);
696696
}
697697

698-
this._resetNativeView();
698+
this.resetNativeView();
699699

700700
this.eachChild((child) => {
701701
child._tearDownUI(force);
@@ -714,7 +714,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
714714
}
715715
}
716716

717-
this._disposeNativeView();
717+
this.disposeNativeView();
718718

719719
this.nativeView = null;
720720
this._androidView = null;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ export class View extends ViewCommon {
471471
export class CustomLayoutView extends View implements CustomLayoutViewDefinition {
472472
nativeView: android.view.ViewGroup;
473473

474-
public _createNativeView() {
474+
public createNativeView() {
475475
return new org.nativescript.widgets.ContentLayout(this._context);
476476
}
477477

tns-core-modules/ui/date-picker/date-picker.android.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function initializeDateChangedListener(): void {
5353
export class DatePicker extends DatePickerBase {
5454
nativeView: android.widget.DatePicker;
5555

56-
public _createNativeView() {
56+
public createNativeView() {
5757
initializeDateChangedListener();
5858
const picker = new android.widget.DatePicker(this._context);
5959
picker.setCalendarViewShown(false);
@@ -63,11 +63,11 @@ export class DatePicker extends DatePickerBase {
6363
return picker;
6464
}
6565

66-
public _initNativeView(): void {
66+
public initNativeView(): void {
6767
(<any>this.nativeView).listener.owner = this;
6868
}
6969

70-
public _disposeNativeView() {
70+
public disposeNativeView() {
7171
(<any>this.nativeView).listener.owner = null;
7272
}
7373

tns-core-modules/ui/editable-text-base/editable-text-base.android.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
136136

137137
public abstract _onReturnPress(): void;
138138

139-
public _createNativeView() {
139+
public createNativeView() {
140140
initializeEditTextListeners();
141141
const editText = new android.widget.EditText(this._context);
142142
this._configureEditText(editText);
@@ -149,7 +149,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
149149
return editText;
150150
}
151151

152-
public _initNativeView(): void {
152+
public initNativeView(): void {
153153
const nativeView = this.nativeView;
154154
(<any>nativeView).listener.owner = this;
155155
this._keyListenerCache = nativeView.getKeyListener();
@@ -168,12 +168,12 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
168168
// this._android.removeTextChangedListener(this._editTextListeners);
169169
// }
170170
// }
171-
// super._resetNativeView();
171+
// super.resetNativeView();
172172
// }
173173

174174
// public _disposeNativeView(force?: boolean) {
175175
// this._android = undefined;
176-
// super._disposeNativeView();
176+
// super.disposeNativeView();
177177
// }
178178

179179
public dismissSoftInput() {

0 commit comments

Comments
 (0)