From c18a76c93aa3631c5656c2769f4a0eec7f9cb408 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Tue, 28 Mar 2017 13:05:11 +0300 Subject: [PATCH] rename: _createNativeView to createNativeView; _initNativeView to initNativeView _disposeNativeView to disposeNativeView _resetNativeView to resetNativeView --- tests/app/ui/layouts/layout-helper.android.ts | 18 ++++++++--------- tests/app/ui/view/view-tests-common.ts | 4 ++-- .../ui/action-bar/action-bar.android.ts | 6 +++--- .../activity-indicator.android.ts | 2 +- tns-core-modules/ui/button/button.android.ts | 6 +++--- .../ui/core/view-base/view-base.d.ts | 19 +++++++++--------- .../ui/core/view-base/view-base.ts | 20 +++++++++---------- tns-core-modules/ui/core/view/view.android.ts | 2 +- .../ui/date-picker/date-picker.android.ts | 6 +++--- .../editable-text-base.android.ts | 8 ++++---- tns-core-modules/ui/frame/frame.android.ts | 8 ++++---- .../ui/html-view/html-view.android.ts | 2 +- tns-core-modules/ui/image/image.android.ts | 6 +++--- tns-core-modules/ui/label/label.android.ts | 4 ++-- .../absolute-layout.android.ts | 2 +- .../dock-layout/dock-layout.android.ts | 2 +- .../flexbox-layout/flexbox-layout.android.ts | 4 ++-- .../grid-layout/grid-layout.android.ts | 6 +++--- tns-core-modules/ui/layouts/layout.android.ts | 8 ++++---- .../stack-layout/stack-layout.android.ts | 2 +- .../wrap-layout/wrap-layout.android.ts | 2 +- .../ui/list-picker/list-picker.android.ts | 6 +++--- .../ui/list-view/list-view.android.ts | 8 ++++---- tns-core-modules/ui/page/page.android.ts | 4 ++-- .../ui/placeholder/placeholder.android.ts | 2 +- .../ui/progress/progress.android.ts | 2 +- .../proxy-view-container.ts | 2 +- .../ui/scroll-view/scroll-view.android.ts | 2 +- .../ui/search-bar/search-bar.android.ts | 6 +++--- .../ui/segmented-bar/segmented-bar.android.ts | 6 +++--- tns-core-modules/ui/slider/slider.android.ts | 6 +++--- tns-core-modules/ui/switch/switch.android.ts | 6 +++--- .../ui/tab-view/tab-view.android.ts | 6 +++--- .../ui/text-base/text-base.android.ts | 8 ++++---- .../ui/text-field/text-field.android.ts | 4 ++-- .../ui/text-view/text-view.android.ts | 4 ++-- .../ui/time-picker/time-picker.android.ts | 4 ++-- .../ui/web-view/web-view.android.ts | 8 ++++---- 38 files changed, 111 insertions(+), 110 deletions(-) diff --git a/tests/app/ui/layouts/layout-helper.android.ts b/tests/app/ui/layouts/layout-helper.android.ts index ba99ae74c..fe1aff643 100644 --- a/tests/app/ui/layouts/layout-helper.android.ts +++ b/tests/app/ui/layouts/layout-helper.android.ts @@ -68,15 +68,15 @@ class NativeGridLayout extends org.nativescript.widgets.GridLayout { export class MyButton extends Button implements def.MyButton { nativeView: NativeButton; - public _createNativeView() { + public createNativeView() { return new NativeButton(this._context, this); } - public _initNativeView(): void { + public initNativeView(): void { this.nativeView.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { this.nativeView.owner = undefined; } @@ -121,15 +121,15 @@ export class MyButton extends Button implements def.MyButton { export class MyStackLayout extends StackLayout implements def.MyStackLayout { nativeView: NativeStackLayout; - public _createNativeView() { + public createNativeView() { return new NativeStackLayout(this._context, this); } - public _initNativeView(): void { + public initNativeView(): void { this.nativeView.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { this.nativeView.owner = undefined; } @@ -174,15 +174,15 @@ export class MyStackLayout extends StackLayout implements def.MyStackLayout { export class MyGridLayout extends GridLayout implements def.MyGridLayout { nativeView: NativeGridLayout; - public _createNativeView() { + public createNativeView() { return new NativeGridLayout(this._context, this); } - public _initNativeView(): void { + public initNativeView(): void { this.nativeView.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { this.nativeView.owner = undefined; } diff --git a/tests/app/ui/view/view-tests-common.ts b/tests/app/ui/view/view-tests-common.ts index 54defc16f..92f43ed30 100644 --- a/tests/app/ui/view/view-tests-common.ts +++ b/tests/app/ui/view/view-tests-common.ts @@ -281,13 +281,13 @@ class TestView extends Layout { this.nativeView = undefined; } - public _createNativeView() { + public createNativeView() { if (isIOS) { this.nativeView = this._nativeView; return this._nativeView; } - return super._createNativeView(); + return super.createNativeView(); } public toString() { diff --git a/tns-core-modules/ui/action-bar/action-bar.android.ts b/tns-core-modules/ui/action-bar/action-bar.android.ts index 77970e4b2..9150a8f0e 100644 --- a/tns-core-modules/ui/action-bar/action-bar.android.ts +++ b/tns-core-modules/ui/action-bar/action-bar.android.ts @@ -127,7 +127,7 @@ export class ActionBar extends ActionBarBase { } } - public _createNativeView() { + public createNativeView() { initializeMenuItemClickListener(); const toolbar = new android.support.v7.widget.Toolbar(this._context); const menuItemClickListener = new MenuItemClickListener(this); @@ -136,11 +136,11 @@ export class ActionBar extends ActionBarBase { return toolbar; } - public _initNativeView(): void { + public initNativeView(): void { (this.nativeView).menuItemClickListener.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { (this.nativeView).menuItemClickListener.owner = null; } diff --git a/tns-core-modules/ui/activity-indicator/activity-indicator.android.ts b/tns-core-modules/ui/activity-indicator/activity-indicator.android.ts index a672528df..4ac27acca 100644 --- a/tns-core-modules/ui/activity-indicator/activity-indicator.android.ts +++ b/tns-core-modules/ui/activity-indicator/activity-indicator.android.ts @@ -5,7 +5,7 @@ export * from "./activity-indicator-common"; export class ActivityIndicator extends ActivityIndicatorBase { nativeView: android.widget.ProgressBar; - public _createNativeView() { + public createNativeView() { const progressBar = new android.widget.ProgressBar(this._context); progressBar.setVisibility(android.view.View.INVISIBLE); progressBar.setIndeterminate(true); diff --git a/tns-core-modules/ui/button/button.android.ts b/tns-core-modules/ui/button/button.android.ts index 34a8e1cc9..d41c03844 100644 --- a/tns-core-modules/ui/button/button.android.ts +++ b/tns-core-modules/ui/button/button.android.ts @@ -41,7 +41,7 @@ export class Button extends ButtonBase { private _highlightedHandler: (args: TouchGestureEventData) => void; - public _createNativeView() { + public createNativeView() { initializeClickListener(); const button = new android.widget.Button(this._context); const clickListener = new ClickListener(this); @@ -50,11 +50,11 @@ export class Button extends ButtonBase { return button; } - public _initNativeView(): void { + public initNativeView(): void { (this.nativeView).clickListener.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { (this.nativeView).clickListener.owner = null; } diff --git a/tns-core-modules/ui/core/view-base/view-base.d.ts b/tns-core-modules/ui/core/view-base/view-base.d.ts index c91ab99ce..93a273472 100644 --- a/tns-core-modules/ui/core/view-base/view-base.d.ts +++ b/tns-core-modules/ui/core/view-base/view-base.d.ts @@ -202,24 +202,25 @@ export abstract class ViewBase extends Observable { _tearDownUI(force?: boolean): void; /** - * Creates a native view + * Creates a native view. + * Returns either android.view.View or UIView. */ - _createNativeView(): Object; - - /** - * Clean up references to the native view. - */ - _disposeNativeView(): void; + createNativeView(): Object; /** * Initializes properties/listeners of the native view. */ - _initNativeView(): void; + initNativeView(): void; + + /** + * Clean up references to the native view. + */ + disposeNativeView(): void; /** * Resets properties/listeners set to the native view. */ - _resetNativeView(): void; + resetNativeView(): void; _isAddedToNativeVisualTree: boolean; diff --git a/tns-core-modules/ui/core/view-base/view-base.ts b/tns-core-modules/ui/core/view-base/view-base.ts index 227a2ebbe..fce712a8f 100644 --- a/tns-core-modules/ui/core/view-base/view-base.ts +++ b/tns-core-modules/ui/core/view-base/view-base.ts @@ -126,7 +126,7 @@ function putNativeView(context: Object, view: ViewBase): void { list.push(new WeakRef(view.nativeView)); } -export class ViewBase extends Observable implements ViewBaseDefinition { +export abstract class ViewBase extends Observable implements ViewBaseDefinition { public static loadedEvent = "loaded"; public static unloadedEvent = "unloaded"; @@ -588,19 +588,19 @@ export class ViewBase extends Observable implements ViewBaseDefinition { } } - public _createNativeView(): Object { + public createNativeView(): Object { return undefined; } - public _disposeNativeView() { + public disposeNativeView() { // } - public _initNativeView(): void { + public initNativeView(): void { // } - public _resetNativeView(): void { + public resetNativeView(): void { if (this.nativeView && this.recycleNativeView && isAndroid) { resetNativeView(this); } @@ -627,7 +627,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition { } if (!nativeView) { - nativeView = this._createNativeView(); + nativeView = this.createNativeView(); } this._androidView = this.nativeView = nativeView; @@ -659,14 +659,14 @@ export class ViewBase extends Observable implements ViewBaseDefinition { } } else { // TODO: Implement _createNativeView for iOS - this._createNativeView(); + this.createNativeView(); if (!currentNativeView) { console.log(`${this.typeName} doesnt have NativeView !!!!! =================`); } // this.nativeView = this._iosView = (this)._nativeView; } - this._initNativeView(); + this.initNativeView(); if (this.parent) { let nativeIndex = this.parent._childIndexToNativeChildIndex(atIndex); @@ -695,7 +695,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition { traceWrite(`${this}._tearDownUI(${force})`, traceCategories.VisualTreeEvents); } - this._resetNativeView(); + this.resetNativeView(); this.eachChild((child) => { child._tearDownUI(force); @@ -714,7 +714,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition { } } - this._disposeNativeView(); + this.disposeNativeView(); this.nativeView = null; this._androidView = null; diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index 005253756..e746e5f99 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -471,7 +471,7 @@ export class View extends ViewCommon { export class CustomLayoutView extends View implements CustomLayoutViewDefinition { nativeView: android.view.ViewGroup; - public _createNativeView() { + public createNativeView() { return new org.nativescript.widgets.ContentLayout(this._context); } diff --git a/tns-core-modules/ui/date-picker/date-picker.android.ts b/tns-core-modules/ui/date-picker/date-picker.android.ts index 5758c6e5e..4b29cd8e6 100644 --- a/tns-core-modules/ui/date-picker/date-picker.android.ts +++ b/tns-core-modules/ui/date-picker/date-picker.android.ts @@ -53,7 +53,7 @@ function initializeDateChangedListener(): void { export class DatePicker extends DatePickerBase { nativeView: android.widget.DatePicker; - public _createNativeView() { + public createNativeView() { initializeDateChangedListener(); const picker = new android.widget.DatePicker(this._context); picker.setCalendarViewShown(false); @@ -63,11 +63,11 @@ export class DatePicker extends DatePickerBase { return picker; } - public _initNativeView(): void { + public initNativeView(): void { (this.nativeView).listener.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { (this.nativeView).listener.owner = null; } diff --git a/tns-core-modules/ui/editable-text-base/editable-text-base.android.ts b/tns-core-modules/ui/editable-text-base/editable-text-base.android.ts index 358f34634..8d7e6d546 100644 --- a/tns-core-modules/ui/editable-text-base/editable-text-base.android.ts +++ b/tns-core-modules/ui/editable-text-base/editable-text-base.android.ts @@ -136,7 +136,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon { public abstract _onReturnPress(): void; - public _createNativeView() { + public createNativeView() { initializeEditTextListeners(); const editText = new android.widget.EditText(this._context); this._configureEditText(editText); @@ -149,7 +149,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon { return editText; } - public _initNativeView(): void { + public initNativeView(): void { const nativeView = this.nativeView; (nativeView).listener.owner = this; this._keyListenerCache = nativeView.getKeyListener(); @@ -168,12 +168,12 @@ export abstract class EditableTextBase extends EditableTextBaseCommon { // this._android.removeTextChangedListener(this._editTextListeners); // } // } - // super._resetNativeView(); + // super.resetNativeView(); // } // public _disposeNativeView(force?: boolean) { // this._android = undefined; - // super._disposeNativeView(); + // super.disposeNativeView(); // } public dismissSoftInput() { diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index 5b01d2344..5191f7008 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -289,7 +289,7 @@ export class Frame extends FrameBase { } } - public _createNativeView() { + public createNativeView() { // TODO: probably memory leak. // this._listener = new android.view.View.OnAttachStateChangeListener({ // onViewAttachedToWindow: this.onNativeViewAttachedToWindow.bind(this), @@ -303,17 +303,17 @@ export class Frame extends FrameBase { return root; } - public _initNativeView(): void { + public initNativeView(): void { this._android.rootViewGroup = this.nativeView; this._android.rootViewGroup.setId(this._containerViewId); // this._android.rootViewGroup.addOnAttachStateChangeListener(this._listener); } - // public _resetNativeView() { + // public resetNativeView() { // this._android.rootViewGroup.removeOnAttachStateChangeListener(this._listener); // } - public _disposeNativeView() { + public disposeNativeView() { // we should keep the reference to underlying native object, since frame can contain many pages. this._android.rootViewGroup = null; } diff --git a/tns-core-modules/ui/html-view/html-view.android.ts b/tns-core-modules/ui/html-view/html-view.android.ts index 3c83257d8..702eb9193 100644 --- a/tns-core-modules/ui/html-view/html-view.android.ts +++ b/tns-core-modules/ui/html-view/html-view.android.ts @@ -7,7 +7,7 @@ export * from "./html-view-common"; export class HtmlView extends HtmlViewBase { nativeView: android.widget.TextView; - public _createNativeView() { + public createNativeView() { const textView = new android.widget.TextView(this._context); // This makes the html work textView.setLinksClickable(true); diff --git a/tns-core-modules/ui/image/image.android.ts b/tns-core-modules/ui/image/image.android.ts index e9934fb13..708c80c8b 100644 --- a/tns-core-modules/ui/image/image.android.ts +++ b/tns-core-modules/ui/image/image.android.ts @@ -82,7 +82,7 @@ export class Image extends ImageBase { public decodeHeight = 0; public useCache = true; - public _createNativeView() { + public createNativeView() { initializeImageLoadedListener(); if (!imageFetcher) { initImageCache(this._context); @@ -96,11 +96,11 @@ export class Image extends ImageBase { return imageView; } - public _initNativeView(): void { + public initNativeView(): void { (this.nativeView).listener.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { (this.nativeView).listener.owner = null; } diff --git a/tns-core-modules/ui/label/label.android.ts b/tns-core-modules/ui/label/label.android.ts index c09514537..9c9edc9e7 100644 --- a/tns-core-modules/ui/label/label.android.ts +++ b/tns-core-modules/ui/label/label.android.ts @@ -13,14 +13,14 @@ export class Label extends TextBase implements LabelDefinition { this.style.whiteSpace = value ? WhiteSpace.NORMAL : WhiteSpace.NO_WRAP; } - public _createNativeView() { + public createNativeView() { const textView = new android.widget.TextView(this._context); textView.setSingleLine(true); textView.setEllipsize(android.text.TextUtils.TruncateAt.END); return textView; } - public _initNativeView(): void { + public initNativeView(): void { const textView = this.nativeView; textView.setSingleLine(true); // textView.setEllipsize(android.text.TextUtils.TruncateAt.END); diff --git a/tns-core-modules/ui/layouts/absolute-layout/absolute-layout.android.ts b/tns-core-modules/ui/layouts/absolute-layout/absolute-layout.android.ts index 67e9ee8e7..a8abba226 100644 --- a/tns-core-modules/ui/layouts/absolute-layout/absolute-layout.android.ts +++ b/tns-core-modules/ui/layouts/absolute-layout/absolute-layout.android.ts @@ -19,7 +19,7 @@ View.prototype[leftProperty.setNative] = makeNativeSetter(function(this: export class AbsoluteLayout extends AbsoluteLayoutBase { nativeView: org.nativescript.widgets.AbsoluteLayout; - public _createNativeView() { + public createNativeView() { return new org.nativescript.widgets.AbsoluteLayout(this._context); } } diff --git a/tns-core-modules/ui/layouts/dock-layout/dock-layout.android.ts b/tns-core-modules/ui/layouts/dock-layout/dock-layout.android.ts index 3a6efaed3..8f5878063 100644 --- a/tns-core-modules/ui/layouts/dock-layout/dock-layout.android.ts +++ b/tns-core-modules/ui/layouts/dock-layout/dock-layout.android.ts @@ -34,7 +34,7 @@ View.prototype[dockProperty.setNative] = function(this: View, value: "left" | "t export class DockLayout extends DockLayoutBase { nativeView: org.nativescript.widgets.DockLayout; - public _createNativeView() { + public createNativeView() { return new org.nativescript.widgets.DockLayout(this._context); } diff --git a/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout.android.ts b/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout.android.ts index 143502dca..b34d986a5 100644 --- a/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout.android.ts +++ b/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout.android.ts @@ -79,11 +79,11 @@ const alignSelfMap = { export class FlexboxLayout extends FlexboxLayoutBase { nativeView: org.nativescript.widgets.FlexboxLayout; - public _createNativeView() { + public createNativeView() { return new org.nativescript.widgets.FlexboxLayout(this._context); } - public _disposeNativeView() { + public disposeNativeView() { (this.nativeView).invalidateOrdersCache(); } diff --git a/tns-core-modules/ui/layouts/grid-layout/grid-layout.android.ts b/tns-core-modules/ui/layouts/grid-layout/grid-layout.android.ts index 396d326e8..c72d04db3 100644 --- a/tns-core-modules/ui/layouts/grid-layout/grid-layout.android.ts +++ b/tns-core-modules/ui/layouts/grid-layout/grid-layout.android.ts @@ -52,17 +52,17 @@ export class ItemSpec extends ItemSpecBase { export class GridLayout extends GridLayoutBase { nativeView: org.nativescript.widgets.GridLayout; - public _createNativeView() { + public createNativeView() { return new org.nativescript.widgets.GridLayout(this._context); } - public _initNativeView(): void { + public initNativeView(): void { // Update native GridLayout this.rowsInternal.forEach((itemSpec: ItemSpec, index, rows) => { this._onRowAdded(itemSpec); }, this); this.columnsInternal.forEach((itemSpec: ItemSpec, index, rows) => { this._onColumnAdded(itemSpec); }, this); } - public _disposeNativeView() { + public disposeNativeView() { // Update native GridLayout for (let i = this.rowsInternal.length; i--; i >= 0) { const itemSpec = this.rowsInternal[i]; diff --git a/tns-core-modules/ui/layouts/layout.android.ts b/tns-core-modules/ui/layouts/layout.android.ts index 46e5bfb42..4c449905b 100644 --- a/tns-core-modules/ui/layouts/layout.android.ts +++ b/tns-core-modules/ui/layouts/layout.android.ts @@ -41,18 +41,18 @@ export class Layout extends LayoutBase implements LayoutDefinition { _measuredWidth: number; _measuredHeight: number; - public _createNativeView() { + public createNativeView() { initializeNativeViewGroup(); return new NativeViewGroup(this._context); } - public _initNativeView(): void { + public initNativeView(): void { (this.nativeView)[OWNER] = this; } - public _disposeNativeView() { + public disposeNativeView() { (this.nativeView)[OWNER] = undefined; - super._disposeNativeView(); + super.disposeNativeView(); } public measure(widthMeasureSpec: number, heightMeasureSpec: number): void { diff --git a/tns-core-modules/ui/layouts/stack-layout/stack-layout.android.ts b/tns-core-modules/ui/layouts/stack-layout/stack-layout.android.ts index 0663743a6..410dc6fba 100644 --- a/tns-core-modules/ui/layouts/stack-layout/stack-layout.android.ts +++ b/tns-core-modules/ui/layouts/stack-layout/stack-layout.android.ts @@ -5,7 +5,7 @@ export * from "./stack-layout-common"; export class StackLayout extends StackLayoutBase { nativeView: org.nativescript.widgets.StackLayout; - public _createNativeView() { + public createNativeView() { return new org.nativescript.widgets.StackLayout(this._context); } diff --git a/tns-core-modules/ui/layouts/wrap-layout/wrap-layout.android.ts b/tns-core-modules/ui/layouts/wrap-layout/wrap-layout.android.ts index 503ff8861..7561e90ec 100644 --- a/tns-core-modules/ui/layouts/wrap-layout/wrap-layout.android.ts +++ b/tns-core-modules/ui/layouts/wrap-layout/wrap-layout.android.ts @@ -5,7 +5,7 @@ export * from "./wrap-layout-common"; export class WrapLayout extends WrapLayoutBase { nativeView: org.nativescript.widgets.WrapLayout; - public _createNativeView() { + public createNativeView() { return new org.nativescript.widgets.WrapLayout(this._context); } diff --git a/tns-core-modules/ui/list-picker/list-picker.android.ts b/tns-core-modules/ui/list-picker/list-picker.android.ts index a3428fc0a..3db53e575 100644 --- a/tns-core-modules/ui/list-picker/list-picker.android.ts +++ b/tns-core-modules/ui/list-picker/list-picker.android.ts @@ -72,7 +72,7 @@ export class ListPicker extends ListPickerBase { nativeView: android.widget.NumberPicker; private _selectorWheelPaint: android.graphics.Paint; - public _createNativeView() { + public createNativeView() { initializeNativeClasses(); const picker = new android.widget.NumberPicker(this._context); @@ -98,7 +98,7 @@ export class ListPicker extends ListPickerBase { return picker; } - public _initNativeView(): void { + public initNativeView(): void { const nativeView = this.nativeView; this._selectorWheelPaint = getSelectorWheelPaint(nativeView); (nativeView).formatter.owner = this; @@ -115,7 +115,7 @@ export class ListPicker extends ListPickerBase { } } - public _disposeNativeView() { + public disposeNativeView() { const nativeView = this.nativeView; (nativeView).formatter.owner = null; (nativeView).valueChangedListener.owner = null; diff --git a/tns-core-modules/ui/list-view/list-view.android.ts b/tns-core-modules/ui/list-view/list-view.android.ts index b04528464..31a9d6627 100644 --- a/tns-core-modules/ui/list-view/list-view.android.ts +++ b/tns-core-modules/ui/list-view/list-view.android.ts @@ -49,7 +49,7 @@ export class ListView extends ListViewBase { public _realizedItems = new Map(); public _realizedTemplates = new Map>(); - public _createNativeView() { + public createNativeView() { initializeItemClickListener(); const listView = new android.widget.ListView(this._context); @@ -73,7 +73,7 @@ export class ListView extends ListViewBase { return listView; } - public _initNativeView(): void { + public initNativeView(): void { const nativeView: any = this.nativeView; (nativeView).itemClickListener.owner = this; const adapter = (nativeView).adapter; @@ -85,13 +85,13 @@ export class ListView extends ListViewBase { nativeView.setId(this._androidViewId); } - public _disposeNativeView() { + public disposeNativeView() { const nativeView = this.nativeView; nativeView.setAdapter(null); (nativeView).itemClickListener.owner = null; (nativeView).adapter.owner = null; this.clearRealizedCells(); - super._disposeNativeView(); + super.disposeNativeView(); } public refresh() { diff --git a/tns-core-modules/ui/page/page.android.ts b/tns-core-modules/ui/page/page.android.ts index 925335b3f..a790f1ef5 100644 --- a/tns-core-modules/ui/page/page.android.ts +++ b/tns-core-modules/ui/page/page.android.ts @@ -90,7 +90,7 @@ export class Page extends PageBase { nativeView: org.nativescript.widgets.GridLayout; private _isBackNavigation = false; - public _createNativeView() { + public createNativeView() { const layout = new org.nativescript.widgets.GridLayout(this._context); layout.addRow(new org.nativescript.widgets.ItemSpec(1, org.nativescript.widgets.GridUnitType.auto)); layout.addRow(new org.nativescript.widgets.ItemSpec(1, org.nativescript.widgets.GridUnitType.star)); @@ -98,7 +98,7 @@ export class Page extends PageBase { return layout; } - public _initNativeView(): void { + public initNativeView(): void { this.nativeView.setBackgroundColor(-1); // White color. } diff --git a/tns-core-modules/ui/placeholder/placeholder.android.ts b/tns-core-modules/ui/placeholder/placeholder.android.ts index 952e629b6..306329fd5 100644 --- a/tns-core-modules/ui/placeholder/placeholder.android.ts +++ b/tns-core-modules/ui/placeholder/placeholder.android.ts @@ -4,7 +4,7 @@ import { View } from "../core/view" export class Placeholder extends View implements PlaceholderDefinition { public static creatingViewEvent = "creatingView"; - public _createNativeView() { + public createNativeView() { let args = { eventName: Placeholder.creatingViewEvent, object: this, view: undefined, context: this._context }; this.notify(args); return args.view; diff --git a/tns-core-modules/ui/progress/progress.android.ts b/tns-core-modules/ui/progress/progress.android.ts index 7e3a6569c..cbb7aadf2 100644 --- a/tns-core-modules/ui/progress/progress.android.ts +++ b/tns-core-modules/ui/progress/progress.android.ts @@ -10,7 +10,7 @@ const R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL = 0x01010078; export class Progress extends ProgressBase { nativeView: android.widget.ProgressBar; - public _createNativeView() { + public createNativeView() { return new android.widget.ProgressBar(this._context, null, R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL); } diff --git a/tns-core-modules/ui/proxy-view-container/proxy-view-container.ts b/tns-core-modules/ui/proxy-view-container/proxy-view-container.ts index 6357cfb56..988f6e862 100644 --- a/tns-core-modules/ui/proxy-view-container/proxy-view-container.ts +++ b/tns-core-modules/ui/proxy-view-container/proxy-view-container.ts @@ -34,7 +34,7 @@ export class ProxyViewContainer extends LayoutBase implements ProxyViewContainer return false; } - public _createNativeView() { + public createNativeView() { return undefined; } diff --git a/tns-core-modules/ui/scroll-view/scroll-view.android.ts b/tns-core-modules/ui/scroll-view/scroll-view.android.ts index 885a6ed2f..a5ec3fdcc 100644 --- a/tns-core-modules/ui/scroll-view/scroll-view.android.ts +++ b/tns-core-modules/ui/scroll-view/scroll-view.android.ts @@ -70,7 +70,7 @@ export class ScrollView extends ScrollViewBase { } } - public _createNativeView() { + public createNativeView() { const nativeView = this.orientation === "horizontal" ? new org.nativescript.widgets.HorizontalScrollView(this._context) : new org.nativescript.widgets.VerticalScrollView(this._context); if (this._androidViewId < 0) { this._androidViewId = android.view.View.generateViewId(); diff --git a/tns-core-modules/ui/search-bar/search-bar.android.ts b/tns-core-modules/ui/search-bar/search-bar.android.ts index a2647787f..384c06d60 100644 --- a/tns-core-modules/ui/search-bar/search-bar.android.ts +++ b/tns-core-modules/ui/search-bar/search-bar.android.ts @@ -91,7 +91,7 @@ export class SearchBar extends SearchBarBase { return result; } - public _createNativeView() { + public createNativeView() { initializeNativeClasses(); const nativeView = new android.widget.SearchView(this._context); nativeView.setIconified(false); @@ -107,13 +107,13 @@ export class SearchBar extends SearchBarBase { return nativeView; } - public _initNativeView(): void { + public initNativeView(): void { const nativeView: any = this.nativeView; nativeView.closeListener.owner = this; nativeView.queryTextListener.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { const nativeView: any = this.nativeView; nativeView.closeListener.owner = null; nativeView.queryTextListener.owner = null; diff --git a/tns-core-modules/ui/segmented-bar/segmented-bar.android.ts b/tns-core-modules/ui/segmented-bar/segmented-bar.android.ts index 0ade8e383..fcfeec235 100644 --- a/tns-core-modules/ui/segmented-bar/segmented-bar.android.ts +++ b/tns-core-modules/ui/segmented-bar/segmented-bar.android.ts @@ -183,7 +183,7 @@ export class SegmentedBar extends SegmentedBarBase { return !this._addingTab; } - public _createNativeView() { + public createNativeView() { initializeNativeClasses(); const context: android.content.Context = this._context; @@ -210,13 +210,13 @@ export class SegmentedBar extends SegmentedBarBase { return nativeView; } - public _initNativeView(): void { + public initNativeView(): void { const nativeView: any = this.nativeView; nativeView.listener.owner = this; this._tabContentFactory = this._tabContentFactory || new TabContentFactory(this); } - public _disposeNativeView() { + public disposeNativeView() { const nativeView: any = this.nativeView; nativeView.listener.owner = null; } diff --git a/tns-core-modules/ui/slider/slider.android.ts b/tns-core-modules/ui/slider/slider.android.ts index 7940c55ab..f1ee137d8 100644 --- a/tns-core-modules/ui/slider/slider.android.ts +++ b/tns-core-modules/ui/slider/slider.android.ts @@ -48,7 +48,7 @@ export class Slider extends SliderBase { _supressNativeValue: boolean; nativeView: android.widget.SeekBar; - public _createNativeView() { + public createNativeView() { initializeSeekBarChangeListener(); const listener = new SeekBarChangeListener(this); const nativeView = new android.widget.SeekBar(this._context); @@ -57,12 +57,12 @@ export class Slider extends SliderBase { return nativeView; } - public _initNativeView(): void { + public initNativeView(): void { const nativeView: any = this.nativeView; nativeView.listener.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { const nativeView: any = this.nativeView; nativeView.listener.owner = null; } diff --git a/tns-core-modules/ui/switch/switch.android.ts b/tns-core-modules/ui/switch/switch.android.ts index 0d2fcc9ad..8401f3f52 100644 --- a/tns-core-modules/ui/switch/switch.android.ts +++ b/tns-core-modules/ui/switch/switch.android.ts @@ -35,7 +35,7 @@ export class Switch extends SwitchBase { nativeView: android.widget.Switch; public checked: boolean; - public _createNativeView() { + public createNativeView() { initializeCheckedChangeListener(); const nativeView = new android.widget.Switch(this._context); const listener = new CheckedChangeListener(this); @@ -44,12 +44,12 @@ export class Switch extends SwitchBase { return nativeView; } - public _initNativeView(): void { + public initNativeView(): void { const nativeView: any = this.nativeView; nativeView.listener.owner = this; } - public _disposeNativeView() { + public disposeNativeView() { const nativeView: any = this.nativeView; nativeView.listener.owner = null; } diff --git a/tns-core-modules/ui/tab-view/tab-view.android.ts b/tns-core-modules/ui/tab-view/tab-view.android.ts index 18704a9f9..8afadca7c 100644 --- a/tns-core-modules/ui/tab-view/tab-view.android.ts +++ b/tns-core-modules/ui/tab-view/tab-view.android.ts @@ -263,7 +263,7 @@ export class TabView extends TabViewBase { } } - public _createNativeView() { + public createNativeView() { initializeNativeClasses(); if (traceEnabled()) { traceWrite("TabView._createUI(" + this + ");", traceCategory); @@ -308,7 +308,7 @@ export class TabView extends TabViewBase { return nativeView; } - public _initNativeView(): void { + public initNativeView(): void { if (this._androidViewId < 0) { this._androidViewId = android.view.View.generateViewId(); } @@ -325,7 +325,7 @@ export class TabView extends TabViewBase { (this._pagerAdapter).owner = this; } - public _disposeNativeView() { + public disposeNativeView() { // this._tabLayout.setItems(null, null); this._pagerAdapter.notifyDataSetChanged(); (this._pagerAdapter).owner = null; diff --git a/tns-core-modules/ui/text-base/text-base.android.ts b/tns-core-modules/ui/text-base/text-base.android.ts index 0c5ca4bbb..9d4968bcb 100644 --- a/tns-core-modules/ui/text-base/text-base.android.ts +++ b/tns-core-modules/ui/text-base/text-base.android.ts @@ -51,13 +51,13 @@ export class TextBase extends TextBaseCommon { nativeView: android.widget.TextView; _defaultTransformationMethod: android.text.method.TransformationMethod; - public _initNativeView(): void { + public initNativeView(): void { this._defaultTransformationMethod = this.nativeView.getTransformationMethod(); - super._initNativeView(); + super.initNativeView(); } - public _resetNativeView(): void { - super._resetNativeView(); + public resetNativeView(): void { + super.resetNativeView(); // We reset it here too because this could be changed by multiple properties - whiteSpace, secure, textTransform this.nativeView.setTransformationMethod(this._defaultTransformationMethod); } diff --git a/tns-core-modules/ui/text-field/text-field.android.ts b/tns-core-modules/ui/text-field/text-field.android.ts index adb0f58a0..6343d1a02 100644 --- a/tns-core-modules/ui/text-field/text-field.android.ts +++ b/tns-core-modules/ui/text-field/text-field.android.ts @@ -10,9 +10,9 @@ export class TextField extends TextFieldBase { editText.setHorizontallyScrolling(true); } - public _initNativeView(): void { + public initNativeView(): void { // TODO: We should be able to reset it using only our properties. Check it first. - super._initNativeView(); + super.initNativeView(); this.nativeView.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_NORMAL | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); } diff --git a/tns-core-modules/ui/text-view/text-view.android.ts b/tns-core-modules/ui/text-view/text-view.android.ts index 474211afe..9e12a6222 100644 --- a/tns-core-modules/ui/text-view/text-view.android.ts +++ b/tns-core-modules/ui/text-view/text-view.android.ts @@ -9,9 +9,9 @@ export class TextView extends EditableTextBase implements TextViewDefinition { editText.setGravity(android.view.Gravity.TOP | android.view.Gravity.LEFT); } - public _initNativeView(): void { + public initNativeView(): void { // TODO: We should be able to reset it using only our properties. Check it first. - super._initNativeView(); + super.initNativeView(); this.nativeView.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_NORMAL | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE); } } diff --git a/tns-core-modules/ui/time-picker/time-picker.android.ts b/tns-core-modules/ui/time-picker/time-picker.android.ts index f7d161bf1..680cc8e86 100644 --- a/tns-core-modules/ui/time-picker/time-picker.android.ts +++ b/tns-core-modules/ui/time-picker/time-picker.android.ts @@ -44,7 +44,7 @@ export class TimePicker extends TimePickerBase { nativeView: android.widget.TimePicker; updatingNativeValue: boolean; - public _createNativeView() { + public createNativeView() { initializeTimeChangedListener(); const nativeView = new android.widget.TimePicker(this._context); const listener = new TimeChangedListener(this); @@ -54,7 +54,7 @@ export class TimePicker extends TimePickerBase { return nativeView; } - public _initNativeView(): void { + public initNativeView(): void { const nativeView: any = this.nativeView; nativeView.listener.owner = this; diff --git a/tns-core-modules/ui/web-view/web-view.android.ts b/tns-core-modules/ui/web-view/web-view.android.ts index de11a3cf2..92f7719af 100644 --- a/tns-core-modules/ui/web-view/web-view.android.ts +++ b/tns-core-modules/ui/web-view/web-view.android.ts @@ -88,7 +88,7 @@ function initializeWebViewClient(): void { export class WebView extends WebViewBase { nativeView: android.webkit.WebView; - public _createNativeView() { + public createNativeView() { initializeWebViewClient(); const nativeView = new android.webkit.WebView(this._context); @@ -100,18 +100,18 @@ export class WebView extends WebViewBase { return nativeView; } - public _initNativeView(): void { + public initNativeView(): void { (this.nativeView).client.owner = this; } - public _resetNativeView() { + public resetNativeView() { const nativeView = this.nativeView; if (nativeView) { nativeView.destroy(); } (nativeView).client.owner = null; - super._resetNativeView(); + super.resetNativeView(); } public _loadFileOrResource(path: string, content: string) {