@nstudio/ui-collectionview 5.0.5 → 5.1.4

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