@nstudio/ui-collectionview 5.0.5 → 5.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.android.js CHANGED
@@ -1,10 +1,8 @@
1
1
  /* eslint-disable no-redeclare */
2
2
  import { ChangeType, ContentView, Property, ProxyViewContainer, Trace, Utils, View, booleanConverter, paddingBottomProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, profile } from '@nativescript/core';
3
- import { reorderLongPressEnabledProperty, reorderingEnabledProperty, reverseLayoutProperty, scrollBarIndicatorVisibleProperty } from './common';
3
+ import { reorderLongPressEnabledProperty, reorderingEnabledProperty, reverseLayoutProperty, scrollBarIndicatorVisibleProperty } from '.';
4
4
  import { CLog, CLogTypes, CollectionViewBase, ListViewViewTypes, isScrollEnabledProperty, orientationProperty } from './common';
5
5
  export * from './common';
6
- let CollectionViewCellHolder;
7
- let CollectionViewRecyclerView;
8
6
  var SimpleCallback = /** @class */ (function (_super) {
9
7
  __extends(SimpleCallback, _super);
10
8
  function SimpleCallback(param1, param2) {
@@ -125,6 +123,7 @@ export class CollectionView extends CollectionViewBase {
125
123
  initNativeView() {
126
124
  this.setOnLayoutChangeListener();
127
125
  super.initNativeView();
126
+ const nativeView = this.nativeViewProtected;
128
127
  this.recycledViewPool = new com.nativescript.collectionview.RecycledViewPool();
129
128
  this.recycledViewPoolDisposeListener = new com.nativescript.collectionview.RecycledViewPool.ViewPoolListener({
130
129
  onViewHolderDisposed: (holder) => {
@@ -136,14 +135,7 @@ export class CollectionView extends CollectionViewBase {
136
135
  }
137
136
  const isNonSync = holder['defaultItemView'] === true;
138
137
  const view = isNonSync ? holder.view.content : holder.view;
139
- const args = {
140
- eventName: CollectionViewBase.itemDisposingEvent,
141
- index: holder.getAdapterPosition(),
142
- object: this,
143
- view,
144
- android: holder
145
- };
146
- this.notify(args);
138
+ this.notifyForItemAtIndex(CollectionViewBase.itemDisposingEvent, view, holder.getAdapterPosition(), view.bindingContext, holder);
147
139
  if (view && view.isLoaded) {
148
140
  view.callUnloaded();
149
141
  }
@@ -161,44 +153,39 @@ export class CollectionView extends CollectionViewBase {
161
153
  }
162
154
  const isNonSync = holder['defaultItemView'] === true;
163
155
  const view = isNonSync ? holder.view.content : holder.view;
164
- const args = {
165
- eventName: CollectionViewBase.itemRecyclingEvent,
166
- index: holder.getAdapterPosition(),
167
- object: this,
168
- view,
169
- android: holder
170
- };
171
- this.notify(args);
156
+ this.notifyForItemAtIndex(CollectionViewBase.itemRecyclingEvent, view, holder.getAdapterPosition(), view.bindingContext, holder);
172
157
  }
173
158
  }));
174
- this.android.setRecyclerListener(recyclerListener);
175
- this.android.setRecycledViewPool(this.recycledViewPool);
159
+ nativeView.setRecyclerListener(recyclerListener);
160
+ nativeView.setRecycledViewPool(this.recycledViewPool);
176
161
  // nativeView.owner = new WeakRef(this);
177
162
  // nativeView.sizeChangedListener = new com.nativescript.collectionview.SizeChangedListener({
178
163
  // onSizeChanged: (w, h, oldW, oldH) => this.onSizeChanged(w, h),
179
164
  // });
180
165
  // const orientation = this._getLayoutManagarOrientation();
181
166
  // initGridLayoutManager();
167
+ let layoutManager;
182
168
  if (CollectionViewBase.layoutStyles[this.layoutStyle]) {
183
- this.android.layoutManager = CollectionViewBase.layoutStyles[this.layoutStyle].createLayout(this);
169
+ layoutManager = CollectionViewBase.layoutStyles[this.layoutStyle].createLayout(this);
184
170
  }
185
171
  else {
186
- this.android.layoutManager = new com.nativescript.collectionview.PreCachingGridLayoutManager(this._context, 1);
172
+ layoutManager = new com.nativescript.collectionview.PreCachingGridLayoutManager(this._context, 1);
187
173
  // layoutManager = new PreCachingGridLayoutManager(this._context, 1);
188
174
  // (layoutManager as any).owner = new WeakRef(this);
189
175
  }
190
176
  // this.spanSize
191
- this.android.setLayoutManager(this.android.layoutManager);
192
- this.android.sizeChangedListener = new com.nativescript.collectionview.SizeChangedListener({
177
+ nativeView.setLayoutManager(layoutManager);
178
+ nativeView.layoutManager = layoutManager;
179
+ nativeView.sizeChangedListener = new com.nativescript.collectionview.SizeChangedListener({
193
180
  onSizeChanged() { },
194
181
  onMeasure: () => this.updateInnerSize()
195
182
  });
196
183
  this.spanSize = this._getSpanSize;
197
- // const animator = new com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator();
198
- // // Change animations are enabled by default since support-v7-recyclerview v22.
199
- // // Need to disable them when using animation indicator.
200
- // animator.setSupportsChangeAnimations(false);
201
- // this.android.setItemAnimator(animator);
184
+ const animator = new com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator();
185
+ // Change animations are enabled by default since support-v7-recyclerview v22.
186
+ // Need to disable them when using animation indicator.
187
+ animator.setSupportsChangeAnimations(false);
188
+ nativeView.setItemAnimator(animator);
202
189
  this.refresh();
203
190
  }
204
191
  disposeNativeView() {
@@ -208,17 +195,18 @@ export class CollectionView extends CollectionViewBase {
208
195
  // return true;
209
196
  // });
210
197
  // this._realizedItems.clear();
211
- this.android.setRecyclerListener(null);
212
- this.android.setRecycledViewPool(null);
198
+ const nativeView = this.nativeViewProtected;
199
+ nativeView.setRecyclerListener(null);
200
+ nativeView.setRecycledViewPool(null);
213
201
  this.recycledViewPoolDisposeListener = null;
214
202
  this.recycledViewPool = null;
215
- if (this.android.scrollListener) {
216
- this.android.removeOnScrollListener(this.android.scrollListener);
217
- this.android.scrollListener = null;
203
+ if (nativeView.scrollListener) {
204
+ this.nativeView.removeOnScrollListener(nativeView.scrollListener);
205
+ nativeView.scrollListener = null;
218
206
  this._nScrollListener = null;
219
207
  }
220
- this.android.sizeChangedListener = null;
221
- this.android.layoutManager = null;
208
+ nativeView.sizeChangedListener = null;
209
+ nativeView.layoutManager = null;
222
210
  this._listViewAdapter = null;
223
211
  this._itemTouchHelper = null;
224
212
  this._simpleItemTouchCallback = null;
@@ -262,27 +250,24 @@ export class CollectionView extends CollectionViewBase {
262
250
  }
263
251
  attachScrollListener() {
264
252
  if (this._scrollOrLoadMoreChangeCount > 0 && this.isLoaded) {
265
- if (!this.android) {
266
- return;
267
- }
268
- if (!this.android.scrollListener) {
253
+ const nativeView = this.nativeViewProtected;
254
+ if (!nativeView.scrollListener) {
269
255
  this._nScrollListener = new com.nativescript.collectionview.OnScrollListener.Listener({
270
256
  onScrollStateChanged: this.onScrollStateChanged.bind(this),
271
257
  onScrolled: this.onScrolled.bind(this)
272
258
  });
273
- this.android.scrollListener = new com.nativescript.collectionview.OnScrollListener(this._nScrollListener);
274
- this.android.addOnScrollListener(this.android.scrollListener);
259
+ const scrollListener = new com.nativescript.collectionview.OnScrollListener(this._nScrollListener);
260
+ nativeView.addOnScrollListener(scrollListener);
261
+ nativeView.scrollListener = scrollListener;
275
262
  }
276
263
  }
277
264
  }
278
265
  detachScrollListener() {
279
266
  if (this._scrollOrLoadMoreChangeCount === 0 && this.isLoaded) {
280
- if (!this.android) {
281
- return;
282
- }
283
- if (this.android.scrollListener) {
284
- this.android.removeOnScrollListener(this.android.scrollListener);
285
- this.android.scrollListener = null;
267
+ const nativeView = this.nativeViewProtected;
268
+ if (nativeView.scrollListener) {
269
+ this.nativeView.removeOnScrollListener(nativeView.scrollListener);
270
+ nativeView.scrollListener = null;
286
271
  this._nScrollListener = null;
287
272
  }
288
273
  }
@@ -320,10 +305,7 @@ export class CollectionView extends CollectionViewBase {
320
305
  const lastVisibleItemPos = layoutManager['findLastCompletelyVisibleItemPosition']();
321
306
  const loadMoreItemIndex = this.items.length - this.loadMoreThreshold;
322
307
  if (lastVisibleItemPos === loadMoreItemIndex) {
323
- this.notify({
324
- eventName: CollectionViewBase.loadMoreItemsEvent,
325
- object: this
326
- });
308
+ this.notify({ eventName: CollectionViewBase.loadMoreItemsEvent });
327
309
  }
328
310
  }
329
311
  else if (layoutManager['findLastCompletelyVisibleItemPositions'] && layoutManager['getSpanCount']) {
@@ -337,10 +319,7 @@ export class CollectionView extends CollectionViewBase {
337
319
  }
338
320
  const loadMoreItemIndex = this.items.length - this.loadMoreThreshold;
339
321
  if (lastVisibleItemPos >= loadMoreItemIndex) {
340
- this.notify({
341
- eventName: CollectionViewBase.loadMoreItemsEvent,
342
- object: this
343
- });
322
+ this.notify({ eventName: CollectionViewBase.loadMoreItemsEvent });
344
323
  }
345
324
  }
346
325
  }
@@ -375,10 +354,10 @@ export class CollectionView extends CollectionViewBase {
375
354
  }
376
355
  //@ts-ignore
377
356
  get android() {
378
- return this.nativeViewProtected;
357
+ return this.nativeView;
379
358
  }
380
359
  get layoutManager() {
381
- return this.android && this.android.layoutManager;
360
+ return this.nativeViewProtected && this.nativeViewProtected.layoutManager;
382
361
  }
383
362
  _getViewLayoutParams() {
384
363
  if (this.isHorizontal()) {
@@ -398,21 +377,21 @@ export class CollectionView extends CollectionViewBase {
398
377
  }
399
378
  setNativePoolSize(key, nativeIndex) {
400
379
  if (this.desiredPoolSize.has(key)) {
401
- this.android.getRecycledViewPool().setMaxRecycledViews(nativeIndex, this.desiredPoolSize.get(key));
380
+ this.nativeViewProtected.getRecycledViewPool().setMaxRecycledViews(nativeIndex, this.desiredPoolSize.get(key));
402
381
  }
403
382
  else {
404
383
  if (this.defaultPoolSize >= 0) {
405
- this.android.getRecycledViewPool().setMaxRecycledViews(nativeIndex, this.defaultPoolSize);
384
+ this.nativeViewProtected.getRecycledViewPool().setMaxRecycledViews(nativeIndex, this.defaultPoolSize);
406
385
  }
407
386
  }
408
387
  }
409
388
  setPoolSizes() {
410
- if (!this.android || !this.templateTypeNumberString) {
389
+ if (!this.nativeViewProtected || !this.templateTypeNumberString) {
411
390
  return;
412
391
  }
413
392
  this.desiredPoolSize.forEach((v, k) => {
414
393
  if (this.templateTypeNumberString.has(k)) {
415
- this.android.getRecycledViewPool().setMaxRecycledViews(this.templateTypeNumberString.get(k), v);
394
+ this.nativeViewProtected.getRecycledViewPool().setMaxRecycledViews(this.templateTypeNumberString.get(k), v);
416
395
  }
417
396
  });
418
397
  }
@@ -474,9 +453,7 @@ export class CollectionView extends CollectionViewBase {
474
453
  }
475
454
  }
476
455
  [nestedScrollingEnabledProperty.setNative](value) {
477
- if (this.android) {
478
- this.android.setNestedScrollingEnabled(value);
479
- }
456
+ this.nativeViewProtected.setNestedScrollingEnabled(value);
480
457
  }
481
458
  [extraLayoutSpaceProperty.setNative](value) {
482
459
  const layoutManager = this.layoutManager;
@@ -485,9 +462,7 @@ export class CollectionView extends CollectionViewBase {
485
462
  }
486
463
  }
487
464
  [itemViewCacheSizeProperty.setNative](value) {
488
- if (this.android) {
489
- this.android.setItemViewCacheSize(value);
490
- }
465
+ this.nativeViewProtected.setItemViewCacheSize(value);
491
466
  }
492
467
  [scrollBarIndicatorVisibleProperty.getDefault]() {
493
468
  return true;
@@ -496,14 +471,14 @@ export class CollectionView extends CollectionViewBase {
496
471
  this.updateScrollBarVisibility(value);
497
472
  }
498
473
  updateScrollBarVisibility(value) {
499
- if (!this.android) {
474
+ if (!this.nativeViewProtected) {
500
475
  return;
501
476
  }
502
477
  if (this.orientation === 'horizontal') {
503
- this.android.setHorizontalScrollBarEnabled(value);
478
+ this.nativeViewProtected.setHorizontalScrollBarEnabled(value);
504
479
  }
505
480
  else {
506
- this.android.setVerticalScrollBarEnabled(value);
481
+ this.nativeViewProtected.setVerticalScrollBarEnabled(value);
507
482
  }
508
483
  }
509
484
  enumerateViewHolders(cb) {
@@ -534,11 +509,12 @@ export class CollectionView extends CollectionViewBase {
534
509
  }
535
510
  }
536
511
  onReorderLongPress(motionEvent) {
537
- if (!this.android) {
512
+ const collectionView = this.nativeViewProtected;
513
+ if (!collectionView) {
538
514
  return;
539
515
  }
540
- const view = this.android.findChildViewUnder(motionEvent.getX(), motionEvent.getY());
541
- const viewHolder = view != null ? this.android.getChildViewHolder(view) : null;
516
+ const view = collectionView.findChildViewUnder(motionEvent.getX(), motionEvent.getY());
517
+ const viewHolder = view != null ? collectionView.getChildViewHolder(view) : null;
542
518
  if (viewHolder) {
543
519
  this.startViewHolderDragging(viewHolder.getAdapterPosition(), viewHolder);
544
520
  }
@@ -552,9 +528,6 @@ export class CollectionView extends CollectionViewBase {
552
528
  super._reorderItemInSource(oldPosition, newPosition, false);
553
529
  }
554
530
  [reorderLongPressEnabledProperty.setNative](value) {
555
- if (!this.android) {
556
- return;
557
- }
558
531
  if (value) {
559
532
  if (!this._longPressGesture) {
560
533
  this._longPressGesture = new androidx.core.view.GestureDetectorCompat(this._context, new LongPressGestureListenerImpl(new WeakRef(this)));
@@ -569,25 +542,22 @@ export class CollectionView extends CollectionViewBase {
569
542
  onRequestDisallowInterceptTouchEvent: (disallowIntercept) => { }
570
543
  });
571
544
  }
572
- this.android.addOnItemTouchListener(this._itemTouchListerner);
545
+ this.nativeViewProtected.addOnItemTouchListener(this._itemTouchListerner);
573
546
  }
574
547
  else {
575
548
  if (this._itemTouchListerner) {
576
- this.android.removeOnItemTouchListener(this._itemTouchListerner);
549
+ this.nativeViewProtected.removeOnItemTouchListener(this._itemTouchListerner);
577
550
  }
578
551
  }
579
552
  }
580
553
  [reorderingEnabledProperty.setNative](value) {
581
- if (!this.android) {
582
- return;
583
- }
584
554
  if (value) {
585
555
  if (!this._simpleItemTouchCallback) {
586
556
  const ItemTouchHelper = androidx.recyclerview.widget.ItemTouchHelper;
587
557
  this._simpleItemTouchCallback = new SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.START | ItemTouchHelper.END, 0);
588
558
  this._simpleItemTouchCallback.owner = new WeakRef(this);
589
559
  this._itemTouchHelper = new androidx.recyclerview.widget.ItemTouchHelper(this._simpleItemTouchCallback);
590
- this._itemTouchHelper.attachToRecyclerView(this.android);
560
+ this._itemTouchHelper.attachToRecyclerView(this.nativeViewProtected);
591
561
  }
592
562
  }
593
563
  }
@@ -610,7 +580,7 @@ export class CollectionView extends CollectionViewBase {
610
580
  this.refresh();
611
581
  }
612
582
  setOnLayoutChangeListener() {
613
- if (this.android) {
583
+ if (this.nativeViewProtected) {
614
584
  const owner = this;
615
585
  this.layoutChangeListenerIsSet = true;
616
586
  this.layoutChangeListener =
@@ -625,7 +595,7 @@ export class CollectionView extends CollectionViewBase {
625
595
  }
626
596
  }
627
597
  });
628
- this.android.addOnLayoutChangeListener(this.layoutChangeListener);
598
+ this.nativeViewProtected.addOnLayoutChangeListener(this.layoutChangeListener);
629
599
  }
630
600
  }
631
601
  _updateSpanCount() {
@@ -754,7 +724,8 @@ export class CollectionView extends CollectionViewBase {
754
724
  });
755
725
  }
756
726
  refreshVisibleItems() {
757
- if (!this.android) {
727
+ const view = this.nativeViewProtected;
728
+ if (!view) {
758
729
  return;
759
730
  }
760
731
  const ids = Array.from(this._viewHolders)
@@ -764,7 +735,8 @@ export class CollectionView extends CollectionViewBase {
764
735
  this._listViewAdapter.notifyItemRangeChanged(ids[0], ids[ids.length - 1] - ids[0] + 1);
765
736
  }
766
737
  isItemAtIndexVisible(index) {
767
- if (!this.android) {
738
+ const view = this.nativeViewProtected;
739
+ if (!view) {
768
740
  return false;
769
741
  }
770
742
  const layoutManager = this.layoutManager;
@@ -776,9 +748,10 @@ export class CollectionView extends CollectionViewBase {
776
748
  return false;
777
749
  }
778
750
  refresh() {
779
- if (!this.android) {
751
+ if (!this.nativeViewProtected) {
780
752
  return;
781
753
  }
754
+ const view = this.nativeViewProtected;
782
755
  if (!this.isLoaded) {
783
756
  this._isDataDirty = true;
784
757
  return;
@@ -787,67 +760,65 @@ export class CollectionView extends CollectionViewBase {
787
760
  this._lastLayoutKey = this._innerWidth + '_' + this._innerHeight;
788
761
  let adapter = this._listViewAdapter;
789
762
  if (!adapter) {
790
- adapter = this._listViewAdapter = this.createComposedAdapter();
763
+ adapter = this._listViewAdapter = this.createComposedAdapter(this.nativeViewProtected);
791
764
  adapter.setHasStableIds(!!this._itemIdGenerator);
792
- this.android.setAdapter(adapter);
765
+ view.setAdapter(adapter);
793
766
  }
794
- else if (!this.android.getAdapter()) {
795
- this.android.setAdapter(adapter);
767
+ else if (!view.getAdapter()) {
768
+ view.setAdapter(adapter);
796
769
  }
797
770
  this._updateSpanCount();
798
771
  adapter.notifyDataSetChanged();
799
- const args = {
800
- eventName: CollectionViewBase.dataPopulatedEvent,
801
- object: this
802
- };
803
- this.notify(args);
772
+ this.notify({ eventName: CollectionViewBase.dataPopulatedEvent });
804
773
  }
805
774
  //@ts-ignore
806
775
  get scrollOffset() {
807
- if (!this.android) {
776
+ const view = this.nativeViewProtected;
777
+ if (!view) {
808
778
  return 0;
809
779
  }
810
- return (this.isHorizontal() ? this.android.computeHorizontalScrollOffset() : this.android.computeVerticalScrollOffset()) / Utils.layout.getDisplayDensity();
780
+ return (this.isHorizontal() ? view.computeHorizontalScrollOffset() : view.computeVerticalScrollOffset()) / Utils.layout.getDisplayDensity();
811
781
  }
812
782
  get verticalOffsetX() {
813
- if (!this.android) {
783
+ const view = this.nativeViewProtected;
784
+ if (!view) {
814
785
  return 0;
815
786
  }
816
- return this.android.computeHorizontalScrollOffset() / Utils.layout.getDisplayDensity();
787
+ return view.computeHorizontalScrollOffset() / Utils.layout.getDisplayDensity();
817
788
  }
818
789
  get verticalOffsetY() {
819
- if (!this.android) {
790
+ const view = this.nativeViewProtected;
791
+ if (!view) {
820
792
  return 0;
821
793
  }
822
- return this.android.computeVerticalScrollOffset() / Utils.layout.getDisplayDensity();
794
+ return view.computeVerticalScrollOffset() / Utils.layout.getDisplayDensity();
823
795
  }
824
796
  scrollToIndex(index, animated = true) {
825
- if (!this.android) {
797
+ if (!this.nativeViewProtected) {
826
798
  return;
827
799
  }
828
800
  if (animated) {
829
- this.android.smoothScrollToPosition(index);
801
+ this.nativeViewProtected.smoothScrollToPosition(index);
830
802
  }
831
803
  else {
832
- this.android.scrollToPosition(index);
804
+ this.nativeViewProtected.scrollToPosition(index);
833
805
  }
834
806
  }
835
807
  _setPadding(newPadding) {
836
- if (this.android) {
837
- const padding = {
838
- top: this.android.getPaddingTop(),
839
- right: this.android.getPaddingRight(),
840
- bottom: this.android.getPaddingBottom(),
841
- left: this.android.getPaddingLeft()
842
- };
843
- // tslint:disable-next-line:prefer-object-spread
844
- const newValue = Object.assign(padding, newPadding);
845
- this.android.setClipToPadding(false);
846
- this.android.setPadding(newValue.left, newValue.top, newValue.right, newValue.bottom);
847
- this.updateInnerSize();
848
- }
849
- }
850
- createComposedAdapter() {
808
+ const nativeView = this.nativeViewProtected;
809
+ const padding = {
810
+ top: nativeView.getPaddingTop(),
811
+ right: nativeView.getPaddingRight(),
812
+ bottom: nativeView.getPaddingBottom(),
813
+ left: nativeView.getPaddingLeft()
814
+ };
815
+ // tslint:disable-next-line:prefer-object-spread
816
+ const newValue = Object.assign(padding, newPadding);
817
+ nativeView.setClipToPadding(false);
818
+ nativeView.setPadding(newValue.left, newValue.top, newValue.right, newValue.bottom);
819
+ this.updateInnerSize();
820
+ }
821
+ createComposedAdapter(recyclerView) {
851
822
  const adapter = new com.nativescript.collectionview.Adapter();
852
823
  adapter.adapterInterface = new com.nativescript.collectionview.AdapterInterface({
853
824
  getItemId: this.getItemId.bind(this),
@@ -895,7 +866,7 @@ export class CollectionView extends CollectionViewBase {
895
866
  const selector = this._itemTemplateSelector;
896
867
  const dataItem = this.getItemAtIndex(position);
897
868
  if (dataItem) {
898
- selectorType = selector(dataItem, position, this.items);
869
+ selectorType = selector.call(this, dataItem, position, this.items);
899
870
  }
900
871
  }
901
872
  return this.templateKeyToNativeItem(selectorType);
@@ -997,28 +968,25 @@ export class CollectionView extends CollectionViewBase {
997
968
  }
998
969
  this._viewHolders.add(holder);
999
970
  if (Trace.isEnabled()) {
1000
- CLog(CLogTypes.log, 'onCreateViewHolder', this._viewHolders.size);
971
+ CLog(CLogTypes.log, 'onCreateViewHolder', viewType, this.getKeyByValue(viewType));
1001
972
  }
1002
973
  return holder;
1003
974
  }
975
+ notifyForItemAtIndex(eventName, view, index, bindingContext, native) {
976
+ const args = { eventName, object: this, index, view, ios: native, bindingContext };
977
+ this.notify(args);
978
+ return args;
979
+ }
1004
980
  onBindViewHolder(holder, position) {
1005
981
  if (Trace.isEnabled()) {
1006
982
  CLog(CLogTypes.log, 'onBindViewHolder', position);
1007
983
  }
1008
984
  let view = holder.view;
1009
- const bindingContext = this._prepareItem(view, position);
1010
985
  const isNonSync = holder['defaultItemView'] === true;
1011
- holder['position'] = position;
1012
986
  view = isNonSync ? view.content : view;
1013
- const args = {
1014
- eventName: CollectionViewBase.itemLoadingEvent,
1015
- index: position,
1016
- object: this,
1017
- view,
1018
- bindingContext,
1019
- android: holder
1020
- };
1021
- this.notify(args);
987
+ const bindingContext = this._prepareItem(view, position);
988
+ holder['position'] = position;
989
+ const args = this.notifyForItemAtIndex(CollectionViewBase.itemLoadingEvent, view, position, bindingContext, holder);
1022
990
  if (isNonSync && args.view !== view) {
1023
991
  view = args.view;
1024
992
  // the view has been changed on the event handler
@@ -1044,14 +1012,13 @@ export class CollectionView extends CollectionViewBase {
1044
1012
  if (height || !view.height) {
1045
1013
  view.height = Utils.layout.toDeviceIndependentPixels(height);
1046
1014
  }
1047
- if (this.hasListeners(CollectionViewBase.displayItemEvent)) {
1048
- this.notify({
1049
- eventName: CollectionViewBase.displayItemEvent,
1050
- index: position,
1051
- object: this,
1052
- cell: holder
1053
- });
1054
- }
1015
+ // if (this.hasListeners(CollectionViewBase.displayItemEvent) ) {
1016
+ // this.notify<CollectionViewItemDisplayEventData>({
1017
+ // eventName: CollectionViewBase.displayItemEvent,
1018
+ // index:position,
1019
+ // object: this,
1020
+ // });
1021
+ // }
1055
1022
  if (Trace.isEnabled()) {
1056
1023
  CLog(CLogTypes.log, 'onBindViewHolder done ', position);
1057
1024
  }
@@ -1092,6 +1059,8 @@ __decorate([
1092
1059
  __metadata("design:paramtypes", [CollectionViewCellHolder, Number]),
1093
1060
  __metadata("design:returntype", void 0)
1094
1061
  ], CollectionView.prototype, "onBindViewHolder", null);
1062
+ let CollectionViewCellHolder;
1063
+ let CollectionViewRecyclerView;
1095
1064
  itemViewCacheSizeProperty.register(CollectionViewBase);
1096
1065
  extraLayoutSpaceProperty.register(CollectionViewBase);
1097
1066
  nestedScrollingEnabledProperty.register(CollectionViewBase);