diff --git a/ui/button/button.android.ts b/ui/button/button.android.ts index b5f29d114..199fba08b 100644 --- a/ui/button/button.android.ts +++ b/ui/button/button.android.ts @@ -1,11 +1,8 @@ import common = require("ui/button/button-common"); +import utils = require("utils/utils") global.moduleMerge(common, exports); -interface Owned { - owner: any; -} - export class Button extends common.Button { private _android: android.widget.Button; private _isPressed: boolean; @@ -27,7 +24,7 @@ export class Button extends common.Button { this._android = new android.widget.Button(this._context); this._android.setOnClickListener(new android.view.View.OnClickListener( - { + { get owner() { return that.get(); }, diff --git a/ui/date-picker/date-picker.android.ts b/ui/date-picker/date-picker.android.ts index a121ae333..5fd09f310 100644 --- a/ui/date-picker/date-picker.android.ts +++ b/ui/date-picker/date-picker.android.ts @@ -2,6 +2,7 @@ import dependencyObservable = require("ui/core/dependency-observable"); import proxy = require("ui/core/proxy"); import types = require("utils/types"); +import utils = require("utils/utils") function onYearPropertyChanged(data: dependencyObservable.PropertyChangeData) { var picker = data.object; @@ -65,10 +66,6 @@ function onMinDatePropertyChanged(data: dependencyObservable.PropertyChangeData) global.moduleMerge(common, exports); -interface Owned { - owner: any; -} - export class DatePicker extends common.DatePicker { private _android: android.widget.DatePicker; public _listener: android.widget.DatePicker.OnDateChangedListener; @@ -83,7 +80,7 @@ export class DatePicker extends common.DatePicker { var that = new WeakRef(this); this._listener = new android.widget.DatePicker.OnDateChangedListener( - { + { get owner() { return that.get(); }, diff --git a/ui/list-picker/list-picker.android.ts b/ui/list-picker/list-picker.android.ts index 46d55cd99..0ac62c48b 100644 --- a/ui/list-picker/list-picker.android.ts +++ b/ui/list-picker/list-picker.android.ts @@ -1,13 +1,10 @@ import common = require("ui/list-picker/list-picker-common"); import dependencyObservable = require("ui/core/dependency-observable"); import types = require("utils/types"); +import utils = require("utils/utils") global.moduleMerge(common, exports); -interface Owned { - owner: any; -} - export class ListPicker extends common.ListPicker { private _android: android.widget.NumberPicker; private _valueChangedListener: android.widget.NumberPicker.OnValueChangeListener; @@ -33,7 +30,7 @@ export class ListPicker extends common.ListPicker { var that = new WeakRef(this); this._formatter = new android.widget.NumberPicker.Formatter( - { + { get owner(): ListPicker { return that.get(); }, @@ -48,7 +45,7 @@ export class ListPicker extends common.ListPicker { }); this._android.setFormatter(this._formatter); - this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener({ + this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener({ get owner() { return that.get(); }, diff --git a/ui/list-view/list-view.android.ts b/ui/list-view/list-view.android.ts index 8810b4b69..764fb33c7 100644 --- a/ui/list-view/list-view.android.ts +++ b/ui/list-view/list-view.android.ts @@ -7,6 +7,7 @@ import proxy = require("ui/core/proxy"); import dependencyObservable = require("ui/core/dependency-observable"); import color = require("color"); import definition = require("ui/list-view"); +import utils = require("utils/utils") var ITEMLOADING = common.ListView.itemLoadingEvent; var LOADMOREITEMS = common.ListView.loadMoreItemsEvent; @@ -27,10 +28,6 @@ function onSeparatorColorPropertyChanged(data: dependencyObservable.PropertyChan } } -interface Owned { - owner: any; -} - // register the setNativeValue callbacks (common.ListView.separatorColorProperty.metadata).onSetNativeValue = onSeparatorColorPropertyChanged; @@ -54,7 +51,7 @@ export class ListView extends common.ListView { var that = new WeakRef(this); // TODO: This causes many marshalling calls, rewrite in Java and generate bindings - this.android.setOnScrollListener(new android.widget.AbsListView.OnScrollListener({ + this.android.setOnScrollListener(new android.widget.AbsListView.OnScrollListener({ onScrollStateChanged: function (view: android.widget.AbsListView, scrollState: number) { var owner: ListView = this.owner; if (!owner) { diff --git a/ui/search-bar/search-bar.android.ts b/ui/search-bar/search-bar.android.ts index c708ca2dc..f6a303011 100644 --- a/ui/search-bar/search-bar.android.ts +++ b/ui/search-bar/search-bar.android.ts @@ -3,6 +3,7 @@ import dependencyObservable = require("ui/core/dependency-observable"); import proxy = require("ui/core/proxy"); import color = require("color"); import types = require("utils/types"); +import utils = require("utils/utils") var SEARCHTEXT = "searchText"; var QUERY = "query"; @@ -92,10 +93,6 @@ function _changeSearchViewHintColor(bar: android.widget.SearchView, color: numbe global.moduleMerge(common, exports); -interface Owned { - owner: any; -} - export class SearchBar extends common.SearchBar { private _android: android.widget.SearchView; @@ -105,7 +102,7 @@ export class SearchBar extends common.SearchBar { this._android.setIconified(false); var that = new WeakRef(this); - this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener({ + this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener({ get owner() { return that.get(); }, @@ -136,7 +133,7 @@ export class SearchBar extends common.SearchBar { } })); - this._android.setOnCloseListener(new android.widget.SearchView.OnCloseListener({ + this._android.setOnCloseListener(new android.widget.SearchView.OnCloseListener({ get owner() { return that.get(); }, diff --git a/ui/switch/switch.android.ts b/ui/switch/switch.android.ts index 7bd9d60cd..eeb431eff 100644 --- a/ui/switch/switch.android.ts +++ b/ui/switch/switch.android.ts @@ -1,6 +1,7 @@ import common = require("ui/switch/switch-common"); import dependencyObservable = require("ui/core/dependency-observable"); import proxy = require("ui/core/proxy"); +import utils = require("utils/utils") function onCheckedPropertyChanged(data: dependencyObservable.PropertyChangeData) { var swtch = data.object; @@ -16,10 +17,6 @@ function onCheckedPropertyChanged(data: dependencyObservable.PropertyChangeData) global.moduleMerge(common, exports); -interface Owned { - owner: any; -} - export class Switch extends common.Switch { private _android: android.widget.Switch; @@ -32,7 +29,7 @@ export class Switch extends common.Switch { var that = new WeakRef(this); - this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({ + this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({ get owner() { return that.get(); }, diff --git a/ui/time-picker/time-picker.android.ts b/ui/time-picker/time-picker.android.ts index 370917f6c..5bdc491eb 100644 --- a/ui/time-picker/time-picker.android.ts +++ b/ui/time-picker/time-picker.android.ts @@ -1,6 +1,7 @@ import common = require("ui/time-picker/time-picker-common"); import dependencyObservable = require("ui/core/dependency-observable"); import proxy = require("ui/core/proxy"); +import utils = require("utils/utils") function onHourPropertyChanged(data: dependencyObservable.PropertyChangeData) { var picker = data.object; @@ -18,10 +19,6 @@ function onMinutePropertyChanged(data: dependencyObservable.PropertyChangeData) global.moduleMerge(common, exports); -interface Owned { - owner: any; -} - export class TimePicker extends common.TimePicker { private _android: android.widget.TimePicker; private _listener: android.widget.TimePicker.OnTimeChangedListener; @@ -37,7 +34,7 @@ export class TimePicker extends common.TimePicker { var that = new WeakRef(this); this._listener = new android.widget.TimePicker.OnTimeChangedListener( - { + { get owner() { return that.get(); }, diff --git a/utils/utils.d.ts b/utils/utils.d.ts index c54596630..2f82dbacf 100644 --- a/utils/utils.d.ts +++ b/utils/utils.d.ts @@ -3,6 +3,15 @@ export var RESOURCE_PREFIX: string; + //@private + /** + * Used by various android event listener implementations + */ + interface Owned { + owner: any; + } + //@endprivate + /** * Utility module related to layout. */